1 /*****************************************************************************
2 * input_ext-intf.h: structures of the input exported to the interface
3 * This header provides structures to read the stream descriptors and
4 * control the pace of reading.
5 *****************************************************************************
6 * Copyright (C) 1999, 2000, 2003 VideoLAN
9 * Authors: Christophe Massiot <massiot@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 #ifndef _VLC_INPUT_EXT_INTF_H
27 #define _VLC_INPUT_EXT_INTF_H 1
29 #include "vlc_block.h"
33 * Communication input -> interface
36 #define REQUESTED_MPEG 1
37 #define REQUESTED_A52 2
38 #define REQUESTED_LPCM 3
39 #define REQUESTED_DTS 4
40 #define REQUESTED_NOAUDIO 255
42 /*****************************************************************************
43 * es_descriptor_t: elementary stream descriptor
44 *****************************************************************************
45 * Describes an elementary stream, and includes fields required to handle and
46 * demultiplex this elementary stream.
47 *****************************************************************************/
48 struct es_descriptor_t
50 uint16_t i_id; /* stream ID for PS, PID for TS */
51 uint8_t i_stream_id; /* stream ID defined in the PES */
52 vlc_fourcc_t i_fourcc; /* stream type */
53 uint8_t i_cat; /* stream category (audio, video, spu) */
54 int i_demux_fd; /* used to store demux device
56 char *psz_desc; /* description of ES: audio language
57 * for instance ; NULL if not
60 /* Demultiplexer information */
61 es_sys_t * p_demux_data;
62 pgrm_descriptor_t * p_pgrm; /* very convenient in the demultiplexer */
64 /* PES parser information */
65 pes_packet_t * p_pes; /* Current PES */
66 unsigned int i_pes_real_size; /* as indicated by the header */
68 /* Decoder information */
70 void * p_waveformatex;
71 void * p_bitmapinfoheader;
76 count_t c_packets; /* total packets read */
77 count_t c_invalid_packets; /* invalid packets read */
79 /* XXX hack: to force a decoder instead of mode based on sout */
80 vlc_bool_t b_force_decoder;
83 /*****************************************************************************
85 *****************************************************************************
86 * Describes a program and list associated elementary streams. It is build by
87 * the PSI decoder upon the informations carried in program map sections
88 *****************************************************************************/
89 struct pgrm_descriptor_t
91 /* Program characteristics */
92 uint16_t i_number; /* program number */
93 uint8_t i_version; /* version number */
94 vlc_bool_t b_is_ok; /* Is the description up to date ? */
96 /* Service Descriptor (program name) - DVB extension */
100 /* Synchronization information */
102 mtime_t cr_ref, sysdate_ref;
103 mtime_t last_cr; /* reference to detect unexpected stream
106 count_t c_average_count;
107 /* counter used to compute dynamic average values */
110 /* Demultiplexer data */
111 pgrm_sys_t * p_demux_data;
113 unsigned int i_es_number; /* size of the following array */
114 es_descriptor_t ** pp_es; /* array of pointers to ES */
119 #define SYNCHRO_START 1
120 #define SYNCHRO_REINIT 2
122 /*****************************************************************************
124 *****************************************************************************
125 * Attributes for current area (title for DVD)
126 *****************************************************************************/
129 /* selected area attributes */
130 unsigned int i_id; /* identificator for area */
131 off_t i_start; /* start offset of area */
132 off_t i_size; /* total size of the area
133 * (in arbitrary units) */
135 /* navigation parameters */
136 off_t i_tell; /* actual location in the area
137 * (in arbitrary units) */
138 off_t i_seek; /* next requested location
139 * (changed by the interface thread */
141 /* area subdivision */
142 unsigned int i_part_nb; /* number of parts (chapter for DVD)*/
143 unsigned int i_part; /* currently selected part */
146 /* offset to plugin related data */
150 /*****************************************************************************
151 * stream_descriptor_t
152 *****************************************************************************
153 * Describes a stream and list its associated programs. Build upon
154 * the information carried in program association sections (for instance)
155 *****************************************************************************/
156 struct stream_descriptor_t
158 uint16_t i_stream_id; /* stream id */
159 vlc_bool_t b_changed; /* if stream has been changed,
160 we have to inform the interface */
161 vlc_mutex_t stream_lock; /* to be taken every time you read
162 * or modify stream, pgrm or es */
164 /* Input method data */
165 unsigned int i_method; /* input method for stream: file,
167 vlc_bool_t b_pace_control; /* can we read when we want ? */
168 vlc_bool_t b_seekable; /* can we do lseek() ? */
170 /* if (b_seekable) : */
171 unsigned int i_area_nb;
172 input_area_t ** pp_areas; /* list of areas in stream == offset
173 * interval with own properties */
174 input_area_t * p_selected_area;
175 input_area_t * p_new_area; /* Newly selected area from
178 uint32_t i_mux_rate; /* the rate we read the stream (in
179 * units of 50 bytes/s) ; 0 if undef */
181 /* New status and rate requested by the interface */
182 unsigned int i_new_status, i_new_rate;
183 int b_new_mute; /* int because it can be -1 */
184 vlc_cond_t stream_wait; /* interface -> input in case of a
185 * status change request */
186 /* Demultiplexer data */
189 /* Programs descriptions */
190 unsigned int i_pgrm_number; /* size of the following array */
191 pgrm_descriptor_t ** pp_programs; /* array of pointers to pgrm */
192 pgrm_descriptor_t * p_selected_program; /* currently
194 pgrm_descriptor_t * p_new_program; /* Newly selected program */
195 /* ES descriptions */
196 unsigned int i_es_number;
197 es_descriptor_t ** pp_es; /* carried elementary streams */
198 unsigned int i_selected_es_number;
199 es_descriptor_t ** pp_selected_es; /* ES with a decoder */
200 es_descriptor_t * p_newly_selected_es; /* ES selected from
202 es_descriptor_t * p_removed_es; /* ES removed from the interface */
205 stream_ctrl_t control;
207 /* Optional stream output */
208 sout_instance_t * p_sout;
211 count_t c_packets_read; /* packets read */
212 count_t c_packets_trashed; /* trashed packets */
215 #define MUTE_NO_CHANGE -1
217 /*****************************************************************************
219 *****************************************************************************/
227 char *psz_name; /**< Name of this info */
228 char *psz_value; /**< Value of the info */
235 struct info_category_t
237 char *psz_name; /**< Name of this category */
238 int i_infos; /**< Number of infos in the category */
239 struct info_t **pp_infos; /**< Pointer to an array of infos */
242 /*****************************************************************************
244 *****************************************************************************
245 * Describes an input and is used to spawn input_thread_t objects.
246 *****************************************************************************/
249 char *psz_name; /**< text describing this item */
250 char *psz_uri; /**< mrl of this item */
252 int i_options; /**< Number of input options */
253 char **ppsz_options; /**< Array of input options */
255 mtime_t i_duration; /**< A hint about the duration of this
256 * item, in milliseconds*/
258 int i_categories; /**< Number of info categories */
259 info_category_t **pp_categories; /**< Pointer to the first info category */
261 vlc_mutex_t lock; /**< Item cannot be changed without this lock */
264 /*****************************************************************************
266 *****************************************************************************
267 * This structure includes all the local static variables of an input thread
268 *****************************************************************************/
269 struct input_thread_t
273 /* Thread properties */
275 vlc_bool_t b_out_pace_control;
279 ssize_t (* pf_read ) ( input_thread_t *, byte_t *, size_t );
280 int (* pf_set_program )( input_thread_t *, pgrm_descriptor_t * );
281 int (* pf_set_area )( input_thread_t *, input_area_t * );
282 void (* pf_seek ) ( input_thread_t *, off_t );
283 int (* pf_access_control )( input_thread_t *, int, va_list );
284 access_sys_t * p_access_data;
286 int i_pts_delay; /* internal caching */
294 int (* pf_demux ) ( input_thread_t * );
295 int (* pf_rewind ) ( input_thread_t * );
296 /* NULL if we don't support going *
297 * backwards (it's gonna be fun) */
298 int (* pf_demux_control ) ( input_thread_t *, int, va_list );
299 demux_sys_t * p_demux_data; /* data of the demux */
305 input_buffers_t *p_method_data; /* data of the packet manager */
306 data_buffer_t * p_data_buffer;
307 byte_t * p_current_data;
308 byte_t * p_last_data;
311 /* General stream description */
312 stream_descriptor_t stream;
314 /* Input item description */
315 input_item_t *p_item;
319 char * psz_dupsource;
328 seekpoint_t **pp_bookmarks;
330 /* private, do not touch it */
331 input_thread_sys_t *p_sys;
335 /* The first figure is a general method that can be used in interface plugins ;
336 * The second figure is a detailed sub-method */
337 #define INPUT_METHOD_NONE 0x0 /* input thread is inactive */
338 #define INPUT_METHOD_FILE 0x10 /* stream is read from file p_source */
339 #define INPUT_METHOD_DISC 0x20 /* stream is read directly from disc */
340 #define INPUT_METHOD_DVD 0x21 /* stream is read from DVD */
341 #define INPUT_METHOD_VCD 0x22 /* stream is read from VCD */
342 #define INPUT_METHOD_CDDA 0x23 /* stream is read from CDDA */
343 #define INPUT_METHOD_NETWORK 0x30 /* stream is read from network */
344 #define INPUT_METHOD_UCAST 0x31 /* UDP unicast */
345 #define INPUT_METHOD_MCAST 0x32 /* UDP multicast */
346 #define INPUT_METHOD_BCAST 0x33 /* UDP broadcast */
347 #define INPUT_METHOD_VLAN_BCAST 0x34 /* UDP broadcast with VLANs */
348 #define INPUT_METHOD_SATELLITE 0x40 /* stream is read from a */
350 #define INPUT_METHOD_SLP 0x50 /* SLP stream */
352 /*****************************************************************************
354 *****************************************************************************/
355 #define input_CreateThread(a,b) __input_CreateThread(VLC_OBJECT(a),b)
356 VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item_t * ) );
357 VLC_EXPORT( void, input_StopThread, ( input_thread_t * ) );
358 VLC_EXPORT( void, input_DestroyThread, ( input_thread_t * ) );
360 #endif /* "input_ext-intf.h" */