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 */
33 /* Decoder information */
34 struct decoder_fifo_s * p_decoder_fifo;
35 vlc_thread_t thread_id; /* ID of the decoder */
38 count_t c_payload_bytes;/* total of payload useful bytes */
39 count_t c_packets; /* total packets read */
40 count_t c_invalid_packets; /* invalid packets read */
44 /* Special PID values - note that the PID is only on 13 bits, and that values
45 * greater than 0x1fff have no meaning in a stream */
46 #define PROGRAM_ASSOCIATION_TABLE_PID 0x0000
47 #define CONDITIONNAL_ACCESS_TABLE_PID 0x0001 /* not used */
48 #define EMPTY_ID 0xffff /* empty record in a table */
50 /* ES streams types - see ISO/IEC 13818-1 table 2-29 numbers */
51 #define MPEG1_VIDEO_ES 0x01
52 #define MPEG2_VIDEO_ES 0x02
53 #define MPEG1_AUDIO_ES 0x03
54 #define MPEG2_AUDIO_ES 0x04
55 #define AC3_AUDIO_ES 0x81
56 #define DVD_SPU_ES 0x82 /* 0x82 might violate the norm */
57 #define LPCM_AUDIO_ES 0x83
59 /*****************************************************************************
61 *****************************************************************************
62 * Describes a program and list associated elementary streams. It is build by
63 * the PSI decoder upon the informations carried in program map sections
64 *****************************************************************************/
65 typedef struct pgrm_descriptor_s
67 /* Program characteristics */
68 u16 i_number; /* program number */
69 u8 i_version; /* version number */
70 boolean_t b_is_ok; /* Is the description up to date ? */
72 /* Service Descriptor (program name) - DVB extension */
76 /* Synchronization information */
77 /* system_date = PTS_date + delta_cr + delta_absolute */
79 mtime_t delta_absolute;
81 count_t c_average_count;
82 /* counter used to compute dynamic average values */
84 boolean_t b_discontinuity;
86 /* Demultiplexer data */
89 /* Decoders control */
90 struct vout_thread_s * p_vout;
91 struct aout_thread_s * p_aout;
93 int i_es_number; /* size of the following array */
94 es_descriptor_t ** pp_es; /* array of pointers to ES */
99 #define SYNCHRO_NOT_STARTED 1
100 #define SYNCHRO_START 2
101 #define SYNCHRO_REINIT 3
103 /*****************************************************************************
104 * stream_descriptor_t
105 *****************************************************************************
106 * Describes a stream and list its associated programs. Build upon
107 * the information carried in program association sections (for instance)
108 *****************************************************************************/
109 typedef struct stream_descriptor_s
111 u16 i_stream_id; /* stream id */
112 vlc_mutex_t stream_lock; /* to be taken every time you read
113 * or modify stream, pgrm or es */
115 /* Input method data */
116 boolean_t b_pace_control; /* can we read when we want ? */
117 boolean_t b_seekable; /* can we do lseek() ? */
118 /* if (b_seekable) : */
119 off_t i_size; /* total size of the file (in bytes) */
120 off_t i_tell;/* actual location in the file (in bytes) */
122 /* Demultiplexer data */
125 /* Programs description */
126 int i_pgrm_number; /* size of the following array */
127 pgrm_descriptor_t ** pp_programs; /* array of pointers to pgrm */
130 stream_ctrl_t control;
131 } stream_descriptor_t;
133 /*****************************************************************************
135 *****************************************************************************
136 * This structure gives plugins pointers to the useful functions of input
137 *****************************************************************************/
138 struct input_thread_s;
139 struct data_packet_s;
140 struct es_descriptor_s;
142 typedef struct i_p_config_s
144 int (* pf_peek_stream)( struct input_thread_s *,
145 byte_t * buffer, size_t );
146 void (* pf_demux_pes)( struct input_thread_s *,
147 struct data_packet_s *,
148 struct es_descriptor_s *,
149 boolean_t b_unit_start,
150 boolean_t b_packet_lost );
153 /*****************************************************************************
155 *****************************************************************************
156 * This structure includes all the local static variables of an input thread
157 *****************************************************************************/
158 struct aout_thread_s;
159 struct vout_thread_s;
161 typedef struct input_thread_s
163 /* Thread properties and locks */
164 boolean_t b_die; /* 'die' flag */
166 vlc_thread_t thread_id; /* id for thread functions */
167 int * pi_status; /* temporary status flag */
169 struct input_config_s * p_config;
171 struct input_capabilities_s *
172 pp_plugins[INPUT_MAX_PLUGINS];/* list of plugins */
173 struct input_capabilities_s *
174 p_plugin; /* selected plugin */
175 i_p_config_t i_p_config; /* plugin configuration */
177 int i_handle; /* socket or file descriptor */
178 void * p_method_data;
180 /* General stream description */
181 stream_descriptor_t stream; /* PAT tables */
182 es_descriptor_t p_es[INPUT_MAX_ES];
183 /* carried elementary streams */
185 /* List of streams to demux */
186 es_descriptor_t * pp_selected_es[INPUT_MAX_SELECTED_ES];
188 /* For auto-launch of decoders */
189 struct aout_thread_s * p_default_aout;
190 struct vout_thread_s * p_default_vout;
194 count_t c_bytes; /* bytes read */
195 count_t c_payload_bytes; /* payload useful bytes */
196 count_t c_packets_read; /* packets read */
197 count_t c_packets_trashed; /* trashed packets */
203 * Communication interface -> input
206 /*****************************************************************************
208 *****************************************************************************
209 * This structure is given by the interface to an input thread
210 *****************************************************************************/
211 typedef struct input_config_s
213 /* Input method description */
214 int i_method; /* input method */
215 char * p_source; /* source */
217 /* For auto-launch of decoders */
218 struct aout_thread_s * p_default_aout;
219 struct vout_thread_s * p_default_vout;
223 #define INPUT_METHOD_NONE 0 /* input thread is inactive */
224 #define INPUT_METHOD_FILE 10 /* stream is read from file p_source */
225 #define INPUT_METHOD_UCAST 20 /* UDP unicast */
226 #define INPUT_METHOD_MCAST 21 /* UDP multicast */
227 #define INPUT_METHOD_BCAST 22 /* UDP broadcast */
228 #define INPUT_METHOD_VLAN_BCAST 32 /* UDP broadcast with VLANs */
230 /*****************************************************************************
232 *****************************************************************************/
233 struct input_thread_s * input_CreateThread( struct input_config_s *,
235 void input_DestroyThread( struct input_thread_s *,
237 void input_PauseProgram( struct input_thread_s *,
238 struct pgrm_descriptor_s * );
239 void input_PlayProgram( struct input_thread_s *,
240 struct pgrm_descriptor_s * );
241 void input_FFProgram( struct input_thread_s *,
242 struct pgrm_descriptor_s * );
243 void input_SMProgram( struct input_thread_s *,
244 struct pgrm_descriptor_s * );
245 void input_RewindProgram( struct input_thread_s *,
246 struct pgrm_descriptor_s * );