123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- #ifndef __RUNAV_H__
- #define __RUNAV_H__
- #define LIBRUNAV_VERSION_MAJOR 1
- #define LIBRUNAV_VERSION_MINOR 0
- #define LIBRUNAV_VERSION_MICRO 0
- #include <stdint.h>
- #define RUNAV_OPTION_REWIND (1<<0)
- #define RUNAV_OPTION_VERBOSE (1<<1)
- #define RUNAV_OPTION_LOWMEM_OFF (1<<2)
- //#define RUNAV_OPTION_DEBUG_MODE1 (1<<3)
- #define RUNAV_OPTION_DIRECIO_DISABLE (1<<3)
- #define RUNAV_OPTION_DEBUG_MODE2 (1<<4)
- #define RUNAV_OPTION_DEBUG_MODE3 (1<<5)
- #define RUNAV_VIDEO_DISABLE (1<<6)
- #define RUNAV_AUDIO_DISABLE (1<<7)
- #define RUNAV_OPTION_RCD_FORMAT (1<<8)
- #define RUNAV_PVR_TIMESHIFT (1<<9)
- #define REPEAT_AB_ENABLE ((avinfo.repeatAB_flags & SET_A_POINT)&&(avinfo.repeatAB_flags & SET_B_POINT))
- enum
- {
- RUNAV_STREAM_TYPE_UNKNOWN = -1,
- RUNAV_STREAM_TYPE_VIDEO,
- RUNAV_STREAM_TYPE_AUDIO,
- RUNAV_STREAM_TYPE_DATA,
- RUNAV_STREAM_TYPE_SUBTITLE,
- RUNAV_STREAM_TYPE_ATTACHMENT,
- RUNAV_STREAM_TYPE_NB
- };
- enum
- {
- RUNAV_AUDIO_FORMAL,
- RUNAV_AUDIO_HI,
- RUNAV_AUDIO_VI,
- };
- typedef struct
- {
- int track;
- int prog_id;
- int index;
- int id;
- int type;
- int errflags;
- int flags;
- int unsupport;
- int sample_rate;
- int channels;
- char lang[4];
- char codec_name[32];
- const char *prog_name;
- const char *title;
- } runav_stream_t;
- typedef struct
- {
- char country_code[4];
- int rating;
- } runav_rating_info_t;
- typedef struct
- {
- /* current program */
- int prog_id;
- int track_video;
- int track_audio;
- int track_subtitle;
- /* all streams */
- int nb_streams;
- runav_stream_t *streams;
- /*for subtitle*/
- void * subtitle_info_list;
- } runav_stream_info_t;
- enum
- {
- RUNAV_EVENT_EOF,
- RUNAV_EVENT_VIDEO_UNSUPPORT,
- RUNAV_EVENT_AUDIO_UNSUPPORT,
- RUNAV_EVENT_INPROCESS,
- RUNAV_EVENT_FINISH,
- RUNAV_EVENT_HEAD_OF_FILE,
- RUNAV_EVENT_AUDIO_SUPPORT,
- RUNAV_EVENT_UNKNOWN_FORMAT,
- RUNAV_EVENT_STREAM_INFO,
- RUNAV_EVENT_FILE_NOT_EXIST,
- RUNAV_EVENT_OOM,
- RUNAV_EVENT_SEEK_COMPLETE,
- RUNAV_EVENT_NEXT_PROG,
- RUNAV_EVENT_BUFFERING_START,
- RUNAV_EVENT_BUFFERING_END,
- RUNAV_EVENT_RATING_UPDATE,
- };
- enum
- {
- RUNAV_SEEK_CUR,
- RUNAV_SEEK_SET
- };
- typedef void (*event_handler_t)(int event_id, void *arg);
- typedef char* (*get_conti_filename_t)(int b_next_file);
- typedef struct
- {
- long long duration; /* seconds */
- char codec_video[32];
- char codec_audio[32];
- char lang_audio[4];
- char format[32];
- int width;
- int height;
- int sample_rate;
- int channels;
- int bit_rate;
- int frame_rate; //in x_100
- int nb_programs;
- int prog_id;
- } media_info_t;
- /*
- * init operation
- *
- * @parameter: fname
- * @parameter: opt
- * @parameter: event handler
- * return -1 if any error
- */
- int runav_init(const char *fname, unsigned int opt, event_handler_t callback);
- int runav_init1(const char *fname, unsigned int opt, event_handler_t callback, get_conti_filename_t get_cont_filename);
- int runav_init_fpos(const char *fname, unsigned int opt, event_handler_t callback, int64_t fpos);
- /*
- * exit operation
- */
- void runav_exit(void);
- /*
- * playblack operations
- */
- void runav_play(void);
- void runav_play_begin_settings(void);
- void runav_pause(void);
- void runav_stop(void);
- void runav_step(int num);
- void runav_step_example(int num);
- void runav_set_blackscreen(int enable);
- /*
- * seek operation
- * return -1 if any error
- */
- int runav_seek(double offset, int whence);
- int runav_fast_forward(int num);
- int runav_fast_backward(int num);
- unsigned int runav_TS_relative_seek(double offset, int whence);
- int runav_cur_fname(char* fname);
- void runav_set_head_pos(int64_t pos);
- int runav_slow_play(int num);
- int runav_fast_play(int num);
- /*
- * read/write option settings
- */
- unsigned int runav_getopt(void);
- void runav_setopt(unsigned int opt);
- /* Gets the current time in microseconds. */
- int runav_gettime(unsigned int *current_time);
- int runav_getCurrentTime(unsigned int *current_time);
- int runav_getstc(unsigned int *current_time);
- /* Get Info after runav_init() */
- void runav_getinfo(media_info_t *info);
- void runav_getcnt(int *cnt_vframe, int *cnt_aframe);
- int64_t runav_get_fpos();
- /* Set video/audio/subtitle stream index */
- int runav_stream_setidx(int type, int index);
- int runav_stream_setall(int vstrea_index, int astream_index, int sstream_index);
- void* runav_getstream(int stream_index);
- int runav_next_prog(int offset);
- int runav_prog(int prog_id);
- /* runav callback functions -- subtitle */
- enum
- {
- RUNAV_STATE_IDLE,
- RUNAV_STATE_PLAY,
- RUNAV_STATE_PAUSE,
- RUNAV_STATE_FF,
- RUNAV_STATE_FB
- };
- enum
- {
- NONE = 0,
- SET_A_POINT,
- SET_B_POINT
- };
- typedef struct
- {
- void* (*init)(const char * fname, void * stream_info);
- int (*exit)();
- int (*set_data)(int index, char *data, int size, unsigned long long pts, int duration, unsigned long long convergence_duration);
- int (*subt_on)(int id);
- int (*subt_off)();
- int (*change_state)(int new_state);
- } runav_subtitle_funs_t;
- typedef struct
- {
- void (*init)(char magNo, char pageNo, const char * fname, void * stream_info);
- void (*exit)();
- void (*set_data)(unsigned char *data, int size, unsigned long long pts);
- void (*ttsubt_on)(int id, char magNo, char pageNo);
- void (*ttsubt_off)();
- } runav_ttsubtitle_funs_t;
- extern runav_subtitle_funs_t * runav_subtitle_funs_ptr;
- extern runav_ttsubtitle_funs_t * runav_ttsubtitle_funs_ptr;
- int runav_subtitle_on(int id);
- int runav_subtitle_off();
- void runav_setfrate(int input_frate);
- unsigned int runav_getfrate();
- void runav_find_audio_duration();
- void send_event(int event_id, void *arg);
- void runav_setOutputWindow(int XStart, int YStart, int XEnd, int YEnd, char FullScreen);
- void runav_set_repeatAB(unsigned int set_time, int flagAB);
- void runav_reset_repeatAB();
- int runav_status_repeatAB();
- #endif
|