1 /* Structures exported to the interface */
4 * Communication input -> interface
6 #define INPUT_MAX_PLUGINS 1
8 /*****************************************************************************
9 * es_descriptor_t: elementary stream descriptor
10 *****************************************************************************
11 * Describes an elementary stream, and includes fields required to handle and
12 * demultiplex this elementary stream.
13 *****************************************************************************/
14 struct decoder_fifo_s; /* defined in input_ext-dec.h */
15 struct pgrm_descriptor_s;
17 typedef struct es_descriptor_s
19 u16 i_id; /* stream ID for PS, PID for TS */
20 u8 i_stream_id; /* stream ID defined in the PES */
21 u8 i_type; /* stream type */
23 /* Demultiplexer information */
25 struct pgrm_descriptor_s *
26 p_pgrm; /* very convenient in the demultiplexer */
28 /* PES parser information */
29 struct pes_packet_s * p_pes; /* Current PES */
30 struct data_packet_s * p_last; /* The last packet gathered at present */
31 int i_pes_real_size; /* as indicated by the header */
32 boolean_t b_discontinuity; /* Stream changed */
34 /* Decoder information */
35 struct decoder_fifo_s * p_decoder_fifo;
36 vlc_thread_t thread_id; /* ID of the decoder */
39 count_t c_payload_bytes;/* total of payload useful bytes */
40 count_t c_packets; /* total packets read */
41 count_t c_invalid_packets; /* invalid packets read */
45 /* Special PID values - note that the PID is only on 13 bits, and that values
46 * greater than 0x1fff have no meaning in a stream */
47 #define PROGRAM_ASSOCIATION_TABLE_PID 0x0000
48 #define CONDITIONNAL_ACCESS_TABLE_PID 0x0001 /* not used */
49 #define EMPTY_ID 0xffff /* empty record in a table */
51 /* ES streams types - see ISO/IEC 13818-1 table 2-29 numbers */
52 #define MPEG1_VIDEO_ES 0x01
53 #define MPEG2_VIDEO_ES 0x02
54 #define MPEG1_AUDIO_ES 0x03
55 #define MPEG2_AUDIO_ES 0x04
56 #define AC3_AUDIO_ES 0x81
57 #define DVD_SPU_ES 0x82 /* 0x82 might violate the norm */
58 #define LPCM_AUDIO_ES 0x83
60 /*****************************************************************************
62 *****************************************************************************
63 * Describes a program and list associated elementary streams. It is build by
64 * the PSI decoder upon the informations carried in program map sections
65 *****************************************************************************/
66 typedef struct pgrm_descriptor_s
68 /* Program characteristics */
69 u16 i_number; /* program number */
70 u8 i_version; /* version number */
71 boolean_t b_is_ok; /* Is the description up to date ? */
73 /* Service Descriptor (program name) - DVB extension */
77 /* Synchronization information */
78 /* system_date = PTS_date + delta_cr + delta_absolute */
80 mtime_t delta_absolute;
82 count_t c_average_count;
83 /* counter used to compute dynamic average values */
85 boolean_t b_discontinuity;
87 /* Demultiplexer data */
90 /* Decoders control */
91 struct vout_thread_s * p_vout;
92 struct aout_thread_s * p_aout;
94 int i_es_number; /* size of the following array */
95 es_descriptor_t ** pp_es; /* array of pointers to ES */
100 #define SYNCHRO_NOT_STARTED 1
101 #define SYNCHRO_START 2
102 #define SYNCHRO_REINIT 3
104 /*****************************************************************************
105 * stream_descriptor_t
106 *****************************************************************************
107 * Describes a stream and list its associated programs. Build upon
108 * the information carried in program association sections (for instance)
109 *****************************************************************************/
110 typedef struct stream_descriptor_s
112 u16 i_stream_id; /* stream id */
113 vlc_mutex_t stream_lock; /* to be taken every time you read
114 * or modify stream, pgrm or es */
116 /* Input method data */
117 boolean_t b_pace_control; /* can we read when we want ? */
118 boolean_t b_seekable; /* can we do lseek() ? */
119 /* if (b_seekable) : */
120 off_t i_size; /* total size of the file (in bytes) */
121 off_t i_tell;/* actual location in the file (in bytes) */
123 /* Demultiplexer data */
126 /* Programs description */
127 int i_pgrm_number; /* size of the following array */
128 pgrm_descriptor_t ** pp_programs; /* array of pointers to pgrm */
131 stream_ctrl_t control;
132 } stream_descriptor_t;
134 /*****************************************************************************
136 *****************************************************************************
137 * This structure gives plugins pointers to the useful functions of input
138 *****************************************************************************/
139 struct input_thread_s;
140 struct data_packet_s;
141 struct es_descriptor_s;
143 typedef struct i_p_config_s
145 int (* pf_peek_stream)( struct input_thread_s *,
146 byte_t * buffer, size_t );
147 void (* pf_demux_pes)( struct input_thread_s *,
148 struct data_packet_s *,
149 struct es_descriptor_s *,
150 boolean_t b_unit_start,
151 boolean_t b_packet_lost );
154 /*****************************************************************************
156 *****************************************************************************
157 * This structure includes all the local static variables of an input thread
158 *****************************************************************************/
159 struct aout_thread_s;
160 struct vout_thread_s;
162 typedef struct input_thread_s
164 /* Thread properties and locks */
165 boolean_t b_die; /* 'die' flag */
167 vlc_thread_t thread_id; /* id for thread functions */
168 int * pi_status; /* temporary status flag */
170 struct input_config_s * p_config;
172 struct input_capabilities_s *
173 pp_plugins[INPUT_MAX_PLUGINS];/* list of plugins */
174 struct input_capabilities_s *
175 p_plugin; /* selected plugin */
176 i_p_config_t i_p_config; /* plugin configuration */
178 int i_handle; /* socket or file descriptor */
179 void * p_method_data;
181 /* General stream description */
182 stream_descriptor_t stream; /* PAT tables */
183 es_descriptor_t p_es[INPUT_MAX_ES];
184 /* carried elementary streams */
186 /* List of streams to demux */
187 es_descriptor_t * pp_selected_es[INPUT_MAX_SELECTED_ES];
189 /* For auto-launch of decoders */
190 struct aout_thread_s * p_default_aout;
191 struct vout_thread_s * p_default_vout;
195 count_t c_bytes; /* bytes read */
196 count_t c_payload_bytes; /* payload useful bytes */
197 count_t c_packets_read; /* packets read */
198 count_t c_packets_trashed; /* trashed packets */
204 * Communication interface -> input
207 /*****************************************************************************
209 *****************************************************************************
210 * This structure is given by the interface to an input thread
211 *****************************************************************************/
212 typedef struct input_config_s
214 /* Input method description */
215 int i_method; /* input method */
216 char * p_source; /* source */
218 /* For auto-launch of decoders */
219 struct aout_thread_s * p_default_aout;
220 struct vout_thread_s * p_default_vout;
224 #define INPUT_METHOD_NONE 0 /* input thread is inactive */
225 #define INPUT_METHOD_FILE 10 /* stream is read from file p_source */
226 #define INPUT_METHOD_UCAST 20 /* UDP unicast */
227 #define INPUT_METHOD_MCAST 21 /* UDP multicast */
228 #define INPUT_METHOD_BCAST 22 /* UDP broadcast */
229 #define INPUT_METHOD_VLAN_BCAST 32 /* UDP broadcast with VLANs */
231 /*****************************************************************************
233 *****************************************************************************/
234 struct input_thread_s * input_CreateThread( struct input_config_s *,
236 void input_DestroyThread( struct input_thread_s *,
238 void input_PauseProgram( struct input_thread_s *,
239 struct pgrm_descriptor_s * );
240 void input_PlayProgram( struct input_thread_s *,
241 struct pgrm_descriptor_s * );
242 void input_FFProgram( struct input_thread_s *,
243 struct pgrm_descriptor_s * );
244 void input_SMProgram( struct input_thread_s *,
245 struct pgrm_descriptor_s * );
246 void input_RewindProgram( struct input_thread_s *,
247 struct pgrm_descriptor_s * );