1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  | #ifndef PLAYER_H 
 |  #define PLAYER_H 
 |  #ifdef __cplusplus 
 |  extern "C" { 
 |  #endif 
 |    
 |  #include <stdlib.h> 
 |  #include <stdbool.h> 
 |    
 |  __attribute ((visibility("default"))) int player_init(); 
 |    
 |  typedef struct player* player_handle_t; 
 |    
 |  typedef struct { 
 |      size_t preprocess_buf_size; 
 |      size_t decode_buf_size; 
 |      char *name; 
 |  } player_cfg_t; 
 |    
 |  __attribute ((visibility("default"))) player_handle_t player_create(player_cfg_t *cfg); 
 |    
 |  typedef enum { 
 |      //本地流 
 |      PLAY_TYPE_NATIVE = 0, 
 |      //网络流 
 |      PLAY_TYPE_NETWORK, 
 |      //应用流 
 |      PLAY_TYPE_APP, 
 |  }play_type_t; 
 |    
 |  typedef struct { 
 |      play_type_t type; 
 |      char *target; 
 |      bool need_free; 
 |    
 |      //当播放PCM数据流时需要指定下面三个参数 
 |      int samplerate; 
 |      int bits; 
 |      int channels; 
 |  }play_cfg_t; 
 |    
 |  typedef enum { 
 |      //空闲状态 
 |      PLAYER_STATE_IDLE = 0, 
 |      //运行状态 
 |      PLAYER_STATE_RUNNING, 
 |      //暂停状态 
 |      PLAYER_STATE_PAUSED 
 |  }player_state_t; 
 |    
 |  __attribute ((visibility("default"))) int player_play(player_handle_t self, play_cfg_t *cfg); 
 |  __attribute ((visibility("default"))) int player_pause(player_handle_t self); 
 |  __attribute ((visibility("default"))) int player_resume(player_handle_t self); 
 |  __attribute ((visibility("default"))) int player_stop(player_handle_t self); 
 |  __attribute ((visibility("default"))) int player_wait_idle(player_handle_t self); 
 |  __attribute ((visibility("default"))) void player_destroy(player_handle_t self); 
 |  __attribute ((visibility("default"))) void player_deinit(); 
 |    
 |  #ifdef __cplusplus 
 |  } 
 |  #endif 
 |  #endif 
 |  
  |