123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- #ifndef __RUNAV_H__
- #define __RUNAV_H__
- #define LIBRUNAV_VERSION_MAJOR 1
- #define LIBRUNAV_VERSION_MINOR 0
- #define LIBRUNAV_VERSION_MICRO 0
- #include <stdint.h>
- #include "types.h"
- #ifdef CONFIG_USE_PROPRIETARY_MHEG5
- #include "aes_key.h"
- #endif
- #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 RUNAV_DROP_CACHE_DISABLE (1<<10)
- #define RUNAV_OPTION_CIPLUS (1<<11)
- #define RUNAV_MIRACAST (1<<12)
- #define RUNAV_ZMCAST (1<<13)
- #define RUNAV_ZICAST (1<<14)
- #define RUNAV_DLNA (1<<15)
- #define RUNAV_AIRPLAY (1<<16)
- #define RUNAV_DLNA_RANGEBYTE_SEEKABLE (1<<17)
- #define RUNAV_AIRPLAY_STREAMING (1<<18)
- #define REPEAT_AB_ENABLE ((avinfo.repeatAB_flags & SET_A_POINT)&&(avinfo.repeatAB_flags & SET_B_POINT))
- #define MAX_PROG_NAME 128
- #ifdef CONFIG_SUPPORT_MIRACAST
- #define MIRACAST_DROP_ERRORFRAME 0
- #define MIRACAST_DELAY_HANDLE 1
- #define MIRACAST_DEBUG_INFO 0
- #endif
- 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,
- //RUNAV_EVENT_UPDATE_STREAM_INFO,
- };
- enum
- {
- RUNAV_AUDIO_FORMAL,
- RUNAV_AUDIO_CE,
- RUNAV_AUDIO_HI,
- RUNAV_AUDIO_VI,
- RUNAV_AUDIO_MIXED_VI,
- };
- typedef enum _TS_SUB_TYPE
- {
- TS_SUBTITLE_NON,
- TS_SUBTITLE_SUB,
- TS_SUBTITLE_TTX,
- TS_SUBTITLE_PGS
- }TS_SUB_TYPE;
- typedef struct
- {
- int subtitling_type;
- int composition_page_id;
- int ancillary_page_id;
- } runav_ts_sub_info_t;
- typedef struct
- {
- int teletext_type;
- int teletext_magazine_number;
- int teletext_page_number;
- } runav_tt_sub_info_t;
- typedef struct
- {
- TS_SUB_TYPE sub_type;
- union{
- runav_ts_sub_info_t sub;
- runav_tt_sub_info_t ttx;
- }info;
- }runav_sub_info;
- 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];
- char prog_name[MAX_PROG_NAME];
- int pid;
- int has_tt_data;
- int component_tag;
- runav_sub_info sub_info;
- } runav_stream_t;
- typedef struct
- {
- char country_code[4];
- int rating;
- int64_t update_pts;
- } 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;
- int nb_sub_total; //should equal nb_dvb_sub+nb_dvb_ttx
- int nb_dvb_sub;
- int nb_dvb_ttx;
- 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_UPDATE_STREAM_INFO,
- RUNAV_EVENT_FILE_NOT_EXIST,
- RUNAV_EVENT_OOM,
- RUNAV_EVENT_SEEK_COMPLETE,
- RUNAV_EVENT_SEEK_FAIL,
- RUNAV_EVENT_NEXT_PROG,
- RUNAV_EVENT_BUFFERING_START,
- RUNAV_EVENT_BUFFERING_END,
- RUNAV_EVENT_RATING_UPDATE,
- RUNAV_EVENT_NO_AUDIO,
- RUNAV_EVENT_UPDATE_TIME,
- RUNAV_EVENT_RESUME_PLAY,
- RUNAV_EVENT_PVR_NEXT_FILE,
- #ifdef CONFIG_SUPPORT_DIVXDRM
- RUNAV_EVENT_DIVXDRM_RENTAL_EXPIRED,
- RUNAV_EVENT_DIVXDRM_RENTAL_VIEW,
- RUNAV_EVENT_DIVXDRM_NOT_AUTHORIZED,
- RUNAV_EVENT_DIVXDRM_WRONG_VERSION,
- #endif
- RUNAV_EVENT_RATING_UPDATE2, //without thread, use in runav_init
- #ifdef CONFIG_SUPPORT_DASH
- RUNAV_EVENT_DASH_CHANGESTREAM,
- #endif
- RUNAV_EVENT_POOR_NETWORK,
- RUNAV_EVENT_SET_PLAYLIST_RELOAD_TIME,
- //RUNAV_EVENT_SEEK_START,
- };
- enum
- {
- RUNAV_SEEK_CUR,
- RUNAV_SEEK_SET,
- RUNAV_SEEK_REPEATAB
- };
- 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;
- int is_progressive; //only valid for mpeg12, avc and avs recently
- int has_tt_data;
- } media_info_t;
- #ifdef CONFIG_SUPPORT_DIVXDRM
- //Activation Status
- enum
- {
- DRMSTATUS_IsActived,
- DRMSTATUS_NeverRegistered,
- DRMSTATUS_NotActived,
- };
- typedef struct
- {
- int count;
- int limit;
- } rental_info;
- // Divx DRM function
- // return value: Activation Status
- int DivxDRM_GetActivationStatus(void);
- // parameter: DeRegistrationCode: 11 byte array
- // return value: 0 success, -1 failed
- int DivxDRM_Deactivate(char *DeRegistrationCode);
- // parameter: RegistrationCode: 11 byte array
- // return value: 0 success, -1 failed
- int DivxDrm_GetRegistrationCode(char *RegistrationCode);
- #endif
- /*
- * 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);
- /*
- * get init status
- */
- int runav_get_init_status(void);
- /*
- * exit operation
- */
- int 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);
- int runav_audio_fast_forward(int num);
- int runav_audio_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);
- void runav_set_filesize(int64_t size);
- 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);
- //int64_t runav_getCurPos();
- int64_t runav_timeshift_set_eof(int eof_enable);
- void runav_timeshift_to_livedtv(unsigned char enable);
- void runav_set_duration(int set_duration , int max_record_time);
- /* 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_setidx_by_component_tag(int type, int component_tag);
- void runav_set_ad_enable(int enable);
- void runav_set_ad_index(int main_index, int ad_inedx);
- int runav_next_prog(int offset);
- int runav_prog(int prog_id);
- void runav_set_def_prog(int prog_id);
- #ifdef CONFIG_SUPPORT_DASH
- int runav_switch_dash_stream_idx(int type, int stream_index);
- #endif
- /* runav callback functions -- subtitle */
- void runav_set_monflg(int flg);
- 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, UINT64 pts, UINT64 Audio_pts, UINT64 Video_pts,int duration, UINT64 convergence_duration);
- int (*subt_on)(int id, char magNo, char pageNo);
- int (*subt_off)();
- int (*change_state)(int new_state);
- } runav_subtitle_funs_t;
- typedef enum
- {
- type_none, //nothing exist?
- type_asf,
- type_ogg,
- type_flac,
- type_mp3,
- type_mp3_id3v2
- } metadata_type_e;
- typedef struct
- {
- UINT64 pic_offset;
- UINT32 pic_size;
- } metadata_pic_info;
- typedef struct
- {
- int s[100]; //second
- char song[100][50]; //50 isn't limited
- } LYRICS;
- typedef struct _ID3_TAG
- {
- char* data;
- char encodeType;
- }ID3_TAG, *pID3_TAG;
- typedef struct
- {
- metadata_type_e info_type;
- ID3_TAG title;
- ID3_TAG artist;
- ID3_TAG album;
- ID3_TAG genre;
- ID3_TAG year;
- ID3_TAG track;
- LYRICS *l;
- metadata_pic_info pic_info;
- } runav_metadata_info_t;
- extern runav_subtitle_funs_t * runav_subtitle_funs_ptr;
- int runav_subtitle_on(int id);
- int runav_subtitle_off();
- void runav_setfrate(int input_frate);
- unsigned int runav_getfrate();
- void runav_setbyterate_timeshift(long Byterate, int normal_play);
- 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);
- int runav_set_repeatAB(unsigned int set_time, int flagAB);
- void runav_reset_repeatAB();
- int runav_status_repeatAB();
- int runav_checkNormalScreen();
- int runav_get_id3metadata_info(runav_metadata_info_t* pID3Info);
- int runav_get_id3pic_data(char* buf, UINT32 bufsize, UINT64 offset);
- void runav_stream_info_allocate(void);
- #ifdef CONFIG_USE_PROPRIETARY_MHEG5
- void runav_set_aes_key(aes_key_t *aes_key);
- #else
- void runav_set_aes_key(unsigned char* odd, unsigned char* even, unsigned char* civ);
- #endif
- #ifdef CONFIG_SUPPORT_MIRACAST
- void runav_miracast_setfrate(int frate);
- void runav_miracast_set_audiotype(int audio_type);
- void runav_set_play();
- unsigned long runav_is_miracast();
- #endif
- void runav_get_status(unsigned char *p_init, unsigned char *p_exit);
- int runav_find_first_pts(void);
- #ifdef CONFIG_SUPPORT_NEW_AIRPLAY
- //for airplay youtube
- void runav_locking_YT_m3u8_file(void);
- void runav_unlocking_YT_m3u8_file(void);
- #endif
- #endif
|