00001 /***************************************************************************** 00002 * vlc_demux.h 00003 ***************************************************************************** 00004 * Copyright (C) 1999-2005 VideoLAN (Centrale Réseaux) and its contributors 00005 * $Id: vlc_demux.h 12202 2005-08-15 14:57:02Z zorglub $ 00006 * 00007 * Authors: Laurent Aimar <[email protected]> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00022 *****************************************************************************/ 00023 00024 #ifndef _VLC_DEMUX_H 00025 #define _VLC_DEMUX_H 1 00026 00032 struct demux_t 00033 { 00034 VLC_COMMON_MEMBERS 00035 00036 /* Module properties */ 00037 module_t *p_module; 00038 00039 /* eg informative but needed (we can have access+demux) */ 00040 char *psz_access; 00041 char *psz_demux; 00042 char *psz_path; 00043 00044 /* input stream */ 00045 stream_t *s; /* NULL in case of a access+demux in one */ 00046 00047 /* es output */ 00048 es_out_t *out; /* our p_es_out */ 00049 00050 /* set by demuxer */ 00051 int (*pf_demux) ( demux_t * ); /* demux one frame only */ 00052 int (*pf_control)( demux_t *, int i_query, va_list args); 00053 00054 /* Demux has to maintain them uptodate 00055 * when it is responsible of seekpoint/title */ 00056 struct 00057 { 00058 unsigned int i_update; /* Demux sets them on change, 00059 Input removes them once take into account*/ 00060 /* Seekpoint/Title at demux level */ 00061 int i_title; /* idem, start from 0 (could be menu) */ 00062 int i_seekpoint; /* idem, start from 0 */ 00063 } info; 00064 demux_sys_t *p_sys; 00065 }; 00066 00067 enum demux_query_e 00068 { 00069 /* I. Common queries to access_demux and demux */ 00070 /* POSITION double between 0.0 and 1.0 */ 00071 DEMUX_GET_POSITION, /* arg1= double * res= */ 00072 DEMUX_SET_POSITION, /* arg1= double res=can fail */ 00073 00074 /* LENGTH/TIME in microsecond, 0 if unknown */ 00075 DEMUX_GET_LENGTH, /* arg1= int64_t * res= */ 00076 DEMUX_GET_TIME, /* arg1= int64_t * res= */ 00077 DEMUX_SET_TIME, /* arg1= int64_t res=can fail */ 00078 00079 /* TITLE_INFO only if more than 1 title or 1 chapter */ 00080 DEMUX_GET_TITLE_INFO, /* arg1=input_title_t*** arg2=int* can fail */ 00081 00082 /* TITLE/SEEKPOINT, only when TITLE_INFO succeed */ 00083 DEMUX_SET_TITLE, /* arg1= int can fail */ 00084 DEMUX_SET_SEEKPOINT, /* arg1= int can fail */ 00085 00086 /* DEMUX_SET_GROUP only a hit for demuxer (mainly DVB) to allow not 00087 * reading everything (you should not use this to call es_out_Control) 00088 * if you don't know what to do with it, just IGNORE it, it is safe(r) 00089 * -1 means all group, 0 default group (first es added) */ 00090 DEMUX_SET_GROUP, /* arg1= int can fail */ 00091 00092 /* Ask the demux to demux until the given date at the next pf_demux call 00093 * but not more (and not less, at the precision avaiable of course). 00094 * XXX: not mandatory (except for subtitle demux) but I will help a lot 00095 * for multi-input 00096 */ 00097 DEMUX_SET_NEXT_DEMUX_TIME, /* arg1= int64_t * can fail */ 00098 /* FPS for correct subtitles handling */ 00099 DEMUX_GET_FPS, /* arg1= float * res=can fail */ 00100 /* Meta data */ 00101 DEMUX_GET_META, /* arg1= vlc_meta_t ** res=can fail */ 00102 00103 00104 /* II. Specific access_demux queries */ 00105 DEMUX_CAN_PAUSE, /* arg1= vlc_bool_t* cannot fail */ 00106 DEMUX_CAN_CONTROL_PACE, /* arg1= vlc_bool_t* cannot fail */ 00107 DEMUX_GET_PTS_DELAY, /* arg1= int64_t* cannot fail */ 00108 DEMUX_SET_PAUSE_STATE /* arg1= vlc_bool_t can fail */ 00109 }; 00110 00111 /* stream_t *s could be null and then it mean a access+demux in one */ 00112 #define demux2_New( a, b, c, d, e, f,g ) __demux2_New(VLC_OBJECT(a),b,c,d,e,f,g) 00113 VLC_EXPORT( demux_t *, __demux2_New, ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path, stream_t *s, es_out_t *out, vlc_bool_t ) ); 00114 VLC_EXPORT( void, demux2_Delete, ( demux_t * ) ); 00115 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 ) ); 00116 00117 static inline int demux2_Demux( demux_t *p_demux ) 00118 { 00119 return p_demux->pf_demux( p_demux ); 00120 } 00121 static inline int demux2_vaControl( demux_t *p_demux, int i_query, va_list args ) 00122 { 00123 return p_demux->pf_control( p_demux, i_query, args ); 00124 } 00125 static inline int demux2_Control( demux_t *p_demux, int i_query, ... ) 00126 { 00127 va_list args; 00128 int i_result; 00129 00130 va_start( args, i_query ); 00131 i_result = demux2_vaControl( p_demux, i_query, args ); 00132 va_end( args ); 00133 return i_result; 00134 } 00139 #endif