runav.h.tmp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. #ifndef __RUNAV_H__
  2. #define __RUNAV_H__
  3. #define LIBRUNAV_VERSION_MAJOR 1
  4. #define LIBRUNAV_VERSION_MINOR 0
  5. #define LIBRUNAV_VERSION_MICRO 0
  6. #include <stdint.h>
  7. #define RUNAV_OPTION_REWIND (1<<0)
  8. #define RUNAV_OPTION_VERBOSE (1<<1)
  9. #define RUNAV_OPTION_LOWMEM_OFF (1<<2)
  10. //#define RUNAV_OPTION_DEBUG_MODE1 (1<<3)
  11. #define RUNAV_OPTION_DIRECIO_DISABLE (1<<3)
  12. #define RUNAV_OPTION_DEBUG_MODE2 (1<<4)
  13. #define RUNAV_OPTION_DEBUG_MODE3 (1<<5)
  14. #define RUNAV_VIDEO_DISABLE (1<<6)
  15. #define RUNAV_AUDIO_DISABLE (1<<7)
  16. #define RUNAV_OPTION_RCD_FORMAT (1<<8)
  17. #define RUNAV_PVR_TIMESHIFT (1<<9)
  18. #define REPEAT_AB_ENABLE ((avinfo.repeatAB_flags & SET_A_POINT)&&(avinfo.repeatAB_flags & SET_B_POINT))
  19. enum
  20. {
  21. RUNAV_STREAM_TYPE_UNKNOWN = -1,
  22. RUNAV_STREAM_TYPE_VIDEO,
  23. RUNAV_STREAM_TYPE_AUDIO,
  24. RUNAV_STREAM_TYPE_DATA,
  25. RUNAV_STREAM_TYPE_SUBTITLE,
  26. RUNAV_STREAM_TYPE_ATTACHMENT,
  27. RUNAV_STREAM_TYPE_NB
  28. };
  29. enum
  30. {
  31. RUNAV_AUDIO_FORMAL,
  32. RUNAV_AUDIO_HI,
  33. RUNAV_AUDIO_VI,
  34. };
  35. typedef struct
  36. {
  37. int track;
  38. int prog_id;
  39. int index;
  40. int id;
  41. int type;
  42. int errflags;
  43. int flags;
  44. int unsupport;
  45. int sample_rate;
  46. int channels;
  47. char lang[4];
  48. char codec_name[32];
  49. const char *prog_name;
  50. const char *title;
  51. } runav_stream_t;
  52. typedef struct
  53. {
  54. char country_code[4];
  55. int rating;
  56. } runav_rating_info_t;
  57. typedef struct
  58. {
  59. /* current program */
  60. int prog_id;
  61. int track_video;
  62. int track_audio;
  63. int track_subtitle;
  64. /* all streams */
  65. int nb_streams;
  66. runav_stream_t *streams;
  67. /*for subtitle*/
  68. void * subtitle_info_list;
  69. } runav_stream_info_t;
  70. enum
  71. {
  72. RUNAV_EVENT_EOF,
  73. RUNAV_EVENT_VIDEO_UNSUPPORT,
  74. RUNAV_EVENT_AUDIO_UNSUPPORT,
  75. RUNAV_EVENT_INPROCESS,
  76. RUNAV_EVENT_FINISH,
  77. RUNAV_EVENT_HEAD_OF_FILE,
  78. RUNAV_EVENT_AUDIO_SUPPORT,
  79. RUNAV_EVENT_UNKNOWN_FORMAT,
  80. RUNAV_EVENT_STREAM_INFO,
  81. RUNAV_EVENT_FILE_NOT_EXIST,
  82. RUNAV_EVENT_OOM,
  83. RUNAV_EVENT_SEEK_COMPLETE,
  84. RUNAV_EVENT_NEXT_PROG,
  85. RUNAV_EVENT_BUFFERING_START,
  86. RUNAV_EVENT_BUFFERING_END,
  87. RUNAV_EVENT_RATING_UPDATE,
  88. };
  89. enum
  90. {
  91. RUNAV_SEEK_CUR,
  92. RUNAV_SEEK_SET
  93. };
  94. typedef void (*event_handler_t)(int event_id, void *arg);
  95. typedef char* (*get_conti_filename_t)(int b_next_file);
  96. typedef struct
  97. {
  98. long long duration; /* seconds */
  99. char codec_video[32];
  100. char codec_audio[32];
  101. char lang_audio[4];
  102. char format[32];
  103. int width;
  104. int height;
  105. int sample_rate;
  106. int channels;
  107. int bit_rate;
  108. int frame_rate; //in x_100
  109. int nb_programs;
  110. int prog_id;
  111. } media_info_t;
  112. /*
  113. * init operation
  114. *
  115. * @parameter: fname
  116. * @parameter: opt
  117. * @parameter: event handler
  118. * return -1 if any error
  119. */
  120. int runav_init(const char *fname, unsigned int opt, event_handler_t callback);
  121. int runav_init1(const char *fname, unsigned int opt, event_handler_t callback, get_conti_filename_t get_cont_filename);
  122. int runav_init_fpos(const char *fname, unsigned int opt, event_handler_t callback, int64_t fpos);
  123. /*
  124. * exit operation
  125. */
  126. void runav_exit(void);
  127. /*
  128. * playblack operations
  129. */
  130. void runav_play(void);
  131. void runav_play_begin_settings(void);
  132. void runav_pause(void);
  133. void runav_stop(void);
  134. void runav_step(int num);
  135. void runav_step_example(int num);
  136. void runav_set_blackscreen(int enable);
  137. /*
  138. * seek operation
  139. * return -1 if any error
  140. */
  141. int runav_seek(double offset, int whence);
  142. int runav_fast_forward(int num);
  143. int runav_fast_backward(int num);
  144. unsigned int runav_TS_relative_seek(double offset, int whence);
  145. int runav_cur_fname(char* fname);
  146. void runav_set_head_pos(int64_t pos);
  147. int runav_slow_play(int num);
  148. int runav_fast_play(int num);
  149. /*
  150. * read/write option settings
  151. */
  152. unsigned int runav_getopt(void);
  153. void runav_setopt(unsigned int opt);
  154. /* Gets the current time in microseconds. */
  155. int runav_gettime(unsigned int *current_time);
  156. int runav_getCurrentTime(unsigned int *current_time);
  157. int runav_getstc(unsigned int *current_time);
  158. /* Get Info after runav_init() */
  159. void runav_getinfo(media_info_t *info);
  160. void runav_getcnt(int *cnt_vframe, int *cnt_aframe);
  161. int64_t runav_get_fpos();
  162. /* Set video/audio/subtitle stream index */
  163. int runav_stream_setidx(int type, int index);
  164. int runav_stream_setall(int vstrea_index, int astream_index, int sstream_index);
  165. void* runav_getstream(int stream_index);
  166. int runav_next_prog(int offset);
  167. int runav_prog(int prog_id);
  168. /* runav callback functions -- subtitle */
  169. enum
  170. {
  171. RUNAV_STATE_IDLE,
  172. RUNAV_STATE_PLAY,
  173. RUNAV_STATE_PAUSE,
  174. RUNAV_STATE_FF,
  175. RUNAV_STATE_FB
  176. };
  177. enum
  178. {
  179. NONE = 0,
  180. SET_A_POINT,
  181. SET_B_POINT
  182. };
  183. typedef struct
  184. {
  185. void* (*init)(const char * fname, void * stream_info);
  186. int (*exit)();
  187. int (*set_data)(int index, char *data, int size, unsigned long long pts, int duration, unsigned long long convergence_duration);
  188. int (*subt_on)(int id);
  189. int (*subt_off)();
  190. int (*change_state)(int new_state);
  191. } runav_subtitle_funs_t;
  192. typedef struct
  193. {
  194. void (*init)(char magNo, char pageNo, const char * fname, void * stream_info);
  195. void (*exit)();
  196. void (*set_data)(unsigned char *data, int size, unsigned long long pts);
  197. void (*ttsubt_on)(int id, char magNo, char pageNo);
  198. void (*ttsubt_off)();
  199. } runav_ttsubtitle_funs_t;
  200. extern runav_subtitle_funs_t * runav_subtitle_funs_ptr;
  201. extern runav_ttsubtitle_funs_t * runav_ttsubtitle_funs_ptr;
  202. int runav_subtitle_on(int id);
  203. int runav_subtitle_off();
  204. void runav_setfrate(int input_frate);
  205. unsigned int runav_getfrate();
  206. void runav_find_audio_duration();
  207. void send_event(int event_id, void *arg);
  208. void runav_setOutputWindow(int XStart, int YStart, int XEnd, int YEnd, char FullScreen);
  209. void runav_set_repeatAB(unsigned int set_time, int flagAB);
  210. void runav_reset_repeatAB();
  211. int runav_status_repeatAB();
  212. #endif