comparison libmpdemux/demuxer.h @ 30644:390c8d36d463

Drop weird and unnecessary _s/_st suffixes from demuxer struct names.
author diego
date Sun, 21 Feb 2010 20:03:49 +0000
parents 8239ceb64ff7
children 9fc9d1e788aa
comparison
equal deleted inserted replaced
30643:81099607ec11 30644:390c8d36d463
116 #define SEEK_FACTOR (1 << 1) 116 #define SEEK_FACTOR (1 << 1)
117 117
118 #define MP_INPUT_BUFFER_PADDING_SIZE 8 118 #define MP_INPUT_BUFFER_PADDING_SIZE 8
119 119
120 // Holds one packet/frame/whatever 120 // Holds one packet/frame/whatever
121 typedef struct demux_packet_st { 121 typedef struct demux_packet {
122 int len; 122 int len;
123 double pts; 123 double pts;
124 double endpts; 124 double endpts;
125 double stream_pts; 125 double stream_pts;
126 off_t pos; // position in index (AVI) or file (MPG) 126 off_t pos; // position in index (AVI) or file (MPG)
127 unsigned char* buffer; 127 unsigned char* buffer;
128 int flags; // keyframe, etc 128 int flags; // keyframe, etc
129 int refcount; //refcounter for the master packet, if 0, buffer can be free()d 129 int refcount; //refcounter for the master packet, if 0, buffer can be free()d
130 struct demux_packet_st* master; //pointer to the master packet if this one is a cloned one 130 struct demux_packet* master; //pointer to the master packet if this one is a cloned one
131 struct demux_packet_st* next; 131 struct demux_packet* next;
132 } demux_packet_t; 132 } demux_packet_t;
133 133
134 typedef struct { 134 typedef struct {
135 int buffer_pos; // current buffer position 135 int buffer_pos; // current buffer position
136 int buffer_size; // current buffer size 136 int buffer_size; // current buffer size
149 int bytes; // total bytes of packets in buffer 149 int bytes; // total bytes of packets in buffer
150 demux_packet_t *first; // read to current buffer from here 150 demux_packet_t *first; // read to current buffer from here
151 demux_packet_t *last; // append new packets from input stream to here 151 demux_packet_t *last; // append new packets from input stream to here
152 demux_packet_t *current;// needed for refcounting of the buffer 152 demux_packet_t *current;// needed for refcounting of the buffer
153 int id; // stream ID (for multiple audio/video streams) 153 int id; // stream ID (for multiple audio/video streams)
154 struct demuxer_st *demuxer; // parent demuxer structure (stream handler) 154 struct demuxer *demuxer; // parent demuxer structure (stream handler)
155 // ---- asf ----- 155 // ---- asf -----
156 demux_packet_t *asf_packet; // read asf fragments here 156 demux_packet_t *asf_packet; // read asf fragments here
157 int asf_seq; 157 int asf_seq;
158 // ---- mov ----- 158 // ---- mov -----
159 unsigned int ss_mul,ss_div; 159 unsigned int ss_mul,ss_div;
160 // ---- stream header ---- 160 // ---- stream header ----
161 void* sh; 161 void* sh;
162 } demux_stream_t; 162 } demux_stream_t;
163 163
164 typedef struct demuxer_info_st { 164 typedef struct demuxer_info {
165 char *name; 165 char *name;
166 char *author; 166 char *author;
167 char *encoder; 167 char *encoder;
168 char *comments; 168 char *comments;
169 char *copyright; 169 char *copyright;
171 171
172 #define MAX_A_STREAMS 256 172 #define MAX_A_STREAMS 256
173 #define MAX_V_STREAMS 256 173 #define MAX_V_STREAMS 256
174 #define MAX_S_STREAMS 256 174 #define MAX_S_STREAMS 256
175 175
176 struct demuxer_st; 176 struct demuxer;
177 177
178 extern int correct_pts; 178 extern int correct_pts;
179 extern int user_correct_pts; 179 extern int user_correct_pts;
180 180
181 /** 181 /**
182 * Demuxer description structure 182 * Demuxer description structure
183 */ 183 */
184 typedef struct demuxers_desc_st { 184 typedef struct demuxer_desc {
185 const char *info; ///< What is it (long name and/or description) 185 const char *info; ///< What is it (long name and/or description)
186 const char *name; ///< Demuxer name, used with -demuxer switch 186 const char *name; ///< Demuxer name, used with -demuxer switch
187 const char *shortdesc; ///< Description printed at demuxer detection 187 const char *shortdesc; ///< Description printed at demuxer detection
188 const char *author; ///< Demuxer author(s) 188 const char *author; ///< Demuxer author(s)
189 const char *comment; ///< Comment, printed with -demuxer help 189 const char *comment; ///< Comment, printed with -demuxer help
190 190
191 int type; ///< DEMUXER_TYPE_xxx 191 int type; ///< DEMUXER_TYPE_xxx
192 int safe_check; ///< If 1 detection is safe and fast, do it before file extension check 192 int safe_check; ///< If 1 detection is safe and fast, do it before file extension check
193 193
194 /// Check if can demux the file, return DEMUXER_TYPE_xxx on success 194 /// Check if can demux the file, return DEMUXER_TYPE_xxx on success
195 int (*check_file)(struct demuxer_st *demuxer); ///< Mandatory if safe_check == 1, else optional 195 int (*check_file)(struct demuxer *demuxer); ///< Mandatory if safe_check == 1, else optional
196 /// Get packets from file, return 0 on eof 196 /// Get packets from file, return 0 on eof
197 int (*fill_buffer)(struct demuxer_st *demuxer, demux_stream_t *ds); ///< Mandatory 197 int (*fill_buffer)(struct demuxer *demuxer, demux_stream_t *ds); ///< Mandatory
198 /// Open the demuxer, return demuxer on success, NULL on failure 198 /// Open the demuxer, return demuxer on success, NULL on failure
199 struct demuxer_st* (*open)(struct demuxer_st *demuxer); ///< Optional 199 struct demuxer* (*open)(struct demuxer *demuxer); ///< Optional
200 /// Close the demuxer 200 /// Close the demuxer
201 void (*close)(struct demuxer_st *demuxer); ///< Optional 201 void (*close)(struct demuxer *demuxer); ///< Optional
202 // Seek 202 // Seek
203 void (*seek)(struct demuxer_st *demuxer, float rel_seek_secs, float audio_delay, int flags); ///< Optional 203 void (*seek)(struct demuxer *demuxer, float rel_seek_secs, float audio_delay, int flags); ///< Optional
204 // Control 204 // Control
205 int (*control)(struct demuxer_st *demuxer, int cmd, void *arg); ///< Optional 205 int (*control)(struct demuxer *demuxer, int cmd, void *arg); ///< Optional
206 } demuxer_desc_t; 206 } demuxer_desc_t;
207 207
208 typedef struct demux_chapter_s 208 typedef struct demux_chapter
209 { 209 {
210 uint64_t start, end; 210 uint64_t start, end;
211 char* name; 211 char* name;
212 } demux_chapter_t; 212 } demux_chapter_t;
213 213
214 typedef struct demux_attachment_s 214 typedef struct demux_attachment
215 { 215 {
216 char* name; 216 char* name;
217 char* type; 217 char* type;
218 void* data; 218 void* data;
219 unsigned int data_size; 219 unsigned int data_size;
220 } demux_attachment_t; 220 } demux_attachment_t;
221 221
222 typedef struct demuxer_st { 222 typedef struct demuxer {
223 const demuxer_desc_t *desc; ///< Demuxer description structure 223 const demuxer_desc_t *desc; ///< Demuxer description structure
224 off_t filepos; // input stream current pos. 224 off_t filepos; // input stream current pos.
225 off_t movi_start; 225 off_t movi_start;
226 off_t movi_end; 226 off_t movi_end;
227 stream_t *stream; 227 stream_t *stream;
332 return NULL; 332 return NULL;
333 } 333 }
334 return realloc(ptr, nmemb * size); 334 return realloc(ptr, nmemb * size);
335 } 335 }
336 336
337 demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id); 337 demux_stream_t* new_demuxer_stream(struct demuxer *demuxer,int id);
338 demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename); 338 demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename);
339 void free_demuxer_stream(demux_stream_t *ds); 339 void free_demuxer_stream(demux_stream_t *ds);
340 void free_demuxer(demuxer_t *demuxer); 340 void free_demuxer(demuxer_t *demuxer);
341 341
342 void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp); 342 void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp);