X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_demux.h;h=45b3c8765cec115a6da23574b1bcbed52a545702;hb=61817460a63d12c6769c7cc25b04a5c092a64e97;hp=1a680ac4fbf2774bc07b2d0cb26fcd2e28c461af;hpb=82e1801b17ec4bc103540c699f2fc4d16e652e81;p=vlc diff --git a/include/vlc_demux.h b/include/vlc_demux.h index 1a680ac4fb..45b3c8765c 100644 --- a/include/vlc_demux.h +++ b/include/vlc_demux.h @@ -72,6 +72,16 @@ struct demux_t demux_sys_t *p_sys; }; + +/* demux_meta_t is returned by "meta reader" module to the demuxer */ +struct demux_meta_t +{ + vlc_meta_t *p_meta; /**< meta data */ + + int i_attachments; /**< number of attachments */ + input_attachment_t **attachments; /**< array of attachments */ +}; + enum demux_query_e { /* I. Common queries to access_demux and demux */ @@ -85,7 +95,7 @@ enum demux_query_e DEMUX_SET_TIME, /* arg1= int64_t res=can fail */ /* TITLE_INFO only if more than 1 title or 1 chapter */ - DEMUX_GET_TITLE_INFO, /* arg1=input_title_t*** arg2=int* + DEMUX_GET_TITLE_INFO, /* arg1=input_title_t*** arg2=int* arg3=int*pi_title_offset(0), arg4=int*pi_seekpoint_offset(0) can fail */ /* TITLE/SEEKPOINT, only when TITLE_INFO succeed */ DEMUX_SET_TITLE, /* arg1= int can fail */ @@ -104,19 +114,32 @@ enum demux_query_e */ DEMUX_SET_NEXT_DEMUX_TIME, /* arg1= int64_t * can fail */ /* FPS for correct subtitles handling */ - DEMUX_GET_FPS, /* arg1= float * res=can fail */ + DEMUX_GET_FPS, /* arg1= double * res=can fail */ /* Meta data */ DEMUX_GET_META, /* arg1= vlc_meta_t ** res=can fail */ + DEMUX_HAS_UNSUPPORTED_META, /* arg1= vlc_bool_t * res can fail */ /* Attachments */ DEMUX_GET_ATTACHMENTS, /* arg1=input_attachment_t***, int* res=can fail */ /* II. Specific access_demux queries */ - DEMUX_CAN_PAUSE, /* arg1= vlc_bool_t* cannot fail */ - DEMUX_CAN_CONTROL_PACE, /* arg1= vlc_bool_t* cannot fail */ + DEMUX_CAN_PAUSE, /* arg1= vlc_bool_t* can fail (assume false)*/ + DEMUX_SET_PAUSE_STATE, /* arg1= vlc_bool_t can fail */ + DEMUX_GET_PTS_DELAY, /* arg1= int64_t* cannot fail */ - DEMUX_SET_PAUSE_STATE /* arg1= vlc_bool_t can fail */ + + /* DEMUX_CAN_CONTROL_PACE returns true (*pb_pace) if we can read the + * data at our pace */ + DEMUX_CAN_CONTROL_PACE, /* arg1= vlc_bool_t*pb_pace can fail (assume false) */ + + /* DEMUX_CAN_CONTROL_RATE is called only if DEMUX_CAN_CONTROL_PACE has returned false. + * *pb_rate should be true when the rate can be changed (using DEMUX_SET_RATE) + * *pb_ts_rescale should be true when the timestamps (pts/dts/pcr) have to be rescaled */ + DEMUX_CAN_CONTROL_RATE, /* arg1= vlc_bool_t*pb_rate arg2= vlc_bool_t*pb_ts_rescale can fail(assume false) */ + /* DEMUX_SET_RATE is called only if DEMUX_CAN_CONTROL_RATE has returned true. + * It should return the value really used in *pi_rate */ + DEMUX_SET_RATE, /* arg1= int*pi_rate can fail */ }; VLC_EXPORT( int, demux2_vaControlHelper, ( stream_t *, int64_t i_start, int64_t i_end, int i_bitrate, int i_align, int i_query, va_list args ) ); @@ -128,7 +151,7 @@ VLC_EXPORT( int, demux2_vaControlHelper, ( stream_t *, int64_t i_start, in static inline vlc_bool_t demux2_IsPathExtension( demux_t *p_demux, const char *psz_extension ) { const char *psz_ext = strrchr ( p_demux->psz_path, '.' ); - if( !psz_ext || strcmp( psz_ext, psz_extension ) ) + if( !psz_ext || strcasecmp( psz_ext, psz_extension ) ) return VLC_FALSE; return VLC_TRUE; } @@ -140,24 +163,21 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name return VLC_TRUE; } -#define STANDARD_DEMUX_INIT \ - p_demux->pf_control = Control; \ - p_demux->pf_demux = Demux; \ +#define DEMUX_INIT_COMMON() do { \ + p_demux->pf_control = Control; \ + p_demux->pf_demux = Demux; \ MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \ - memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); + memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); } while(0) -#define STANDARD_DEMUX_INIT_MSG( msg ) \ - p_demux->pf_control = Control; \ - p_demux->pf_demux = Demux; \ - MALLOC_ERR( p_demux->p_sys, demux_sys_t ); \ - memset( p_demux->p_sys, 0, sizeof( demux_sys_t ) ); \ - msg_Dbg( p_demux, msg ); \ +#define STANDARD_DEMUX_INIT_MSG( msg ) do { \ + DEMUX_INIT_COMMON(); \ + msg_Dbg( p_demux, msg ); } while(0) #define DEMUX_BY_EXTENSION( ext ) \ demux_t *p_demux = (demux_t *)p_this; \ if( !demux2_IsPathExtension( p_demux, ext ) ) \ return VLC_EGENERIC; \ - STANDARD_DEMUX_INIT; + DEMUX_INIT_COMMON(); #define DEMUX_BY_EXTENSION_MSG( ext, msg ) \ demux_t *p_demux = (demux_t *)p_this; \ @@ -169,7 +189,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name demux_t *p_demux = (demux_t *)p_this; \ if( !demux2_IsPathExtension( p_demux, ext ) && !demux2_IsForced( p_demux, module ) ) \ return VLC_EGENERIC; \ - STANDARD_DEMUX_INIT; + DEMUX_INIT_COMMON(); #define DEMUX_BY_EXTENSION_OR_FORCED_MSG( ext, module, msg ) \ demux_t *p_demux = (demux_t *)p_this; \ @@ -185,10 +205,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name if( stream_Peek( p_demux->s , &zepeek, size ) < size ) { \ msg_Dbg( p_demux, "not enough data" ); goto error; } -#define CHECK_DISCARD_PEEK( size ) { uint8_t *p_peek; \ - if( stream_Peek( p_demux->s , &p_peek, size ) < size ) return VLC_EGENERIC;} - -#define POKE( peek, stuff, size ) (strncasecmp( (char *)peek, stuff, size )==0) +#define POKE( peek, stuff, size ) (strncasecmp( (const char *)peek, stuff, size )==0) #define COMMON_INIT_PACKETIZER( location ) \ location = vlc_object_create( p_demux, VLC_OBJECT_PACKETIZER ); \