Statistics
| Branch: | Revision:

ffmpeg / libavformat / avformat.h @ f3356e9c

History | View | Annotate | Download (21.6 KB)

1
#ifndef AVFORMAT_H
2
#define AVFORMAT_H
3

    
4
#ifdef __cplusplus
5
extern "C" {
6
#endif
7

    
8
#define LIBAVFORMAT_BUILD       4623
9

    
10
#define LIBAVFORMAT_VERSION_INT FFMPEG_VERSION_INT
11
#define LIBAVFORMAT_VERSION     FFMPEG_VERSION
12
#define LIBAVFORMAT_IDENT        "FFmpeg" FFMPEG_VERSION "b" AV_STRINGIFY(LIBAVFORMAT_BUILD)
13

    
14
#include <time.h>
15
#include <stdio.h>  /* FILE */
16
#include "avcodec.h"
17

    
18
#include "avio.h"
19

    
20
/* packet functions */
21

    
22
#ifndef MAXINT64
23
#define MAXINT64 int64_t_C(0x7fffffffffffffff)
24
#endif
25

    
26
#ifndef MININT64
27
#define MININT64 int64_t_C(0x8000000000000000)
28
#endif
29

    
30
typedef struct AVPacket {
31
    int64_t pts; /* presentation time stamp in AV_TIME_BASE units (or
32
                    pts_den units in muxers or demuxers) */
33
    int64_t dts; /* decompression time stamp in AV_TIME_BASE units (or
34
                    pts_den units in muxers or demuxers) */
35
    uint8_t *data;
36
    int   size;
37
    int   stream_index;
38
    int   flags;
39
    int   duration; /* presentation duration (0 if not available) */
40
    void  (*destruct)(struct AVPacket *);
41
    void  *priv;
42
} AVPacket; 
43
#define PKT_FLAG_KEY   0x0001
44

    
45
void av_destruct_packet_nofree(AVPacket *pkt);
46

    
47
/* initialize optional fields of a packet */
48
static inline void av_init_packet(AVPacket *pkt)
49
{
50
    pkt->pts   = AV_NOPTS_VALUE;
51
    pkt->dts   = AV_NOPTS_VALUE;
52
    pkt->duration = 0;
53
    pkt->flags = 0;
54
    pkt->stream_index = 0;
55
    pkt->destruct= av_destruct_packet_nofree;
56
}
57

    
58
int av_new_packet(AVPacket *pkt, int size);
59
int av_dup_packet(AVPacket *pkt);
60

    
61
/**
62
 * Free a packet
63
 *
64
 * @param pkt packet to free
65
 */
66
static inline void av_free_packet(AVPacket *pkt)
67
{
68
    if (pkt && pkt->destruct) {
69
        pkt->destruct(pkt);
70
    }
71
}
72

    
73
/*************************************************/
74
/* fractional numbers for exact pts handling */
75

    
76
/* the exact value of the fractional number is: 'val + num / den'. num
77
   is assumed to be such as 0 <= num < den */
78
typedef struct AVFrac {
79
    int64_t val, num, den; 
80
} AVFrac;
81

    
82
void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den);
83
void av_frac_add(AVFrac *f, int64_t incr);
84
void av_frac_set(AVFrac *f, int64_t val);
85

    
86
/*************************************************/
87
/* input/output formats */
88

    
89
struct AVFormatContext;
90

    
91
/* this structure contains the data a format has to probe a file */
92
typedef struct AVProbeData {
93
    const char *filename;
94
    unsigned char *buf;
95
    int buf_size;
96
} AVProbeData;
97

    
98
#define AVPROBE_SCORE_MAX 100
99

    
100
typedef struct AVFormatParameters {
101
    int frame_rate;
102
    int frame_rate_base;
103
    int sample_rate;
104
    int channels;
105
    int width;
106
    int height;
107
    enum PixelFormat pix_fmt;
108
    struct AVImageFormat *image_format;
109
    int channel; /* used to select dv channel */
110
    const char *device; /* video4linux, audio or DV device */
111
    const char *standard; /* tv standard, NTSC, PAL, SECAM */
112
    int mpeg2ts_raw:1;  /* force raw MPEG2 transport stream output, if possible */
113
    int mpeg2ts_compute_pcr:1; /* compute exact PCR for each transport
114
                                  stream packet (only meaningful if
115
                                  mpeg2ts_raw is TRUE */
116
    int initial_pause:1;       /* do not begin to play the stream
117
                                  immediately (RTSP only) */
118
    enum CodecID video_codec_id;
119
    enum CodecID audio_codec_id;
120
} AVFormatParameters;
121

    
122
#define AVFMT_NOFILE        0x0001 /* no file should be opened */
123
#define AVFMT_NEEDNUMBER    0x0002 /* needs '%d' in filename */ 
124
#define AVFMT_SHOW_IDS      0x0008 /* show format stream IDs numbers */
125
#define AVFMT_RAWPICTURE    0x0020 /* format wants AVPicture structure for
126
                                      raw picture data */
127

    
128
typedef struct AVOutputFormat {
129
    const char *name;
130
    const char *long_name;
131
    const char *mime_type;
132
    const char *extensions; /* comma separated extensions */
133
    /* size of private data so that it can be allocated in the wrapper */
134
    int priv_data_size;
135
    /* output support */
136
    enum CodecID audio_codec; /* default audio codec */
137
    enum CodecID video_codec; /* default video codec */
138
    int (*write_header)(struct AVFormatContext *);
139
    int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
140
    int (*write_trailer)(struct AVFormatContext *);
141
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */
142
    int flags;
143
    /* currently only used to set pixel format if not YUV420P */
144
    int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *);
145
    int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush);
146
    /* private fields */
147
    struct AVOutputFormat *next;
148
} AVOutputFormat;
149

    
150
typedef struct AVInputFormat {
151
    const char *name;
152
    const char *long_name;
153
    /* size of private data so that it can be allocated in the wrapper */
154
    int priv_data_size;
155
    /* tell if a given file has a chance of being parsing by this format */
156
    int (*read_probe)(AVProbeData *);
157
    /* read the format header and initialize the AVFormatContext
158
       structure. Return 0 if OK. 'ap' if non NULL contains
159
       additionnal paramters. Only used in raw format right
160
       now. 'av_new_stream' should be called to create new streams.  */
161
    int (*read_header)(struct AVFormatContext *,
162
                       AVFormatParameters *ap);
163
    /* read one packet and put it in 'pkt'. pts and flags are also
164
       set. 'av_new_stream' can be called only if the flag
165
       AVFMTCTX_NOHEADER is used. */
166
    int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
167
    /* close the stream. The AVFormatContext and AVStreams are not
168
       freed by this function */
169
    int (*read_close)(struct AVFormatContext *);
170
    /** 
171
     * seek to a given timestamp relative to the frames in 
172
     * stream component stream_index
173
     * @param stream_index must not be -1
174
     * @param flags selects which direction should be preferred if no exact 
175
     *              match is available
176
     */
177
    int (*read_seek)(struct AVFormatContext *, 
178
                     int stream_index, int64_t timestamp, int flags);
179
    /**
180
     * gets the next timestamp in AV_TIME_BASE units.
181
     */
182
    int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
183
                              int64_t *pos, int64_t pos_limit);
184
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */
185
    int flags;
186
    /* if extensions are defined, then no probe is done. You should
187
       usually not use extension format guessing because it is not
188
       reliable enough */
189
    const char *extensions;
190
    /* general purpose read only value that the format can use */
191
    int value;
192

    
193
    /* start/resume playing - only meaningful if using a network based format
194
       (RTSP) */
195
    int (*read_play)(struct AVFormatContext *);
196

    
197
    /* pause playing - only meaningful if using a network based format
198
       (RTSP) */
199
    int (*read_pause)(struct AVFormatContext *);
200

    
201
    /* private fields */
202
    struct AVInputFormat *next;
203
} AVInputFormat;
204

    
205
typedef struct AVIndexEntry {
206
    int64_t pos;
207
    int64_t timestamp;
208
#define AVINDEX_KEYFRAME 0x0001
209
/* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed */
210
    int flags;
211
    int min_distance;         /* min distance between this and the previous keyframe, used to avoid unneeded searching */
212
} AVIndexEntry;
213

    
214
enum AVDiscard{
215
//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames)
216
    AVDISCARD_NONE   =-16, ///< discard nothing
217
    AVDISCARD_DEFAULT=  0, ///< discard useless packets like 0 size packets in avi
218
    AVDISCARD_BIDIR  = 16, ///< discard all bidirectional frames
219
    AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
220
    AVDISCARD_ALL    = 48, ///< discard all
221
};
222

    
223
typedef struct AVStream {
224
    int index;    /* stream index in AVFormatContext */
225
    int id;       /* format specific stream id */
226
    AVCodecContext codec; /* codec context */
227
    int r_frame_rate;     /* real frame rate of the stream */
228
    int r_frame_rate_base;/* real frame rate base of the stream */
229
    void *priv_data;
230
    /* internal data used in av_find_stream_info() */
231
    int64_t codec_info_duration;     
232
    int codec_info_nb_frames;
233
    /* encoding: PTS generation when outputing stream */
234
    AVFrac pts;
235
    AVRational time_base;
236
    int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
237
    /* ffmpeg.c private use */
238
    int stream_copy; /* if TRUE, just copy stream */
239
    enum AVDiscard discard; ///< selects which packets can be discarded at will and dont need to be demuxed
240
    //FIXME move stuff to a flags field?
241
    /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame
242
     * MN:dunno if thats the right place, for it */
243
    float quality; 
244
    /* decoding: position of the first frame of the component, in
245
       AV_TIME_BASE fractional seconds. */
246
    int64_t start_time; 
247
    /* decoding: duration of the stream, in AV_TIME_BASE fractional
248
       seconds. */
249
    int64_t duration;
250

    
251
    /* av_read_frame() support */
252
    int need_parsing;
253
    struct AVCodecParserContext *parser;
254

    
255
    int64_t cur_dts;
256
    int last_IP_duration;
257
    int64_t last_IP_pts;
258
    /* av_seek_frame() support */
259
    AVIndexEntry *index_entries; /* only used if the format does not
260
                                    support seeking natively */
261
    int nb_index_entries;
262
    int index_entries_allocated_size;
263
} AVStream;
264

    
265
#define AVFMTCTX_NOHEADER      0x0001 /* signal that no header is present
266
                                         (streams are added dynamically) */
267

    
268
#define MAX_STREAMS 20
269

    
270
/* format I/O context */
271
typedef struct AVFormatContext {
272
    const AVClass *av_class; /* set by av_alloc_format_context */
273
    /* can only be iformat or oformat, not both at the same time */
274
    struct AVInputFormat *iformat;
275
    struct AVOutputFormat *oformat;
276
    void *priv_data;
277
    ByteIOContext pb;
278
    int nb_streams;
279
    AVStream *streams[MAX_STREAMS];
280
    char filename[1024]; /* input or output filename */
281
    /* stream info */
282
    int64_t timestamp;
283
    char title[512];
284
    char author[512];
285
    char copyright[512];
286
    char comment[512];
287
    char album[512];
288
    int year;  /* ID3 year, 0 if none */
289
    int track; /* track number, 0 if none */
290
    char genre[32]; /* ID3 genre */
291

    
292
    int ctx_flags; /* format specific flags, see AVFMTCTX_xx */
293
    /* private data for pts handling (do not modify directly) */
294
    /* This buffer is only needed when packets were already buffered but
295
       not decoded, for example to get the codec parameters in mpeg
296
       streams */
297
    struct AVPacketList *packet_buffer;
298

    
299
    /* decoding: position of the first frame of the component, in
300
       AV_TIME_BASE fractional seconds. NEVER set this value directly:
301
       it is deduced from the AVStream values.  */
302
    int64_t start_time; 
303
    /* decoding: duration of the stream, in AV_TIME_BASE fractional
304
       seconds. NEVER set this value directly: it is deduced from the
305
       AVStream values.  */
306
    int64_t duration;
307
    /* decoding: total file size. 0 if unknown */
308
    int64_t file_size;
309
    /* decoding: total stream bitrate in bit/s, 0 if not
310
       available. Never set it directly if the file_size and the
311
       duration are known as ffmpeg can compute it automatically. */
312
    int bit_rate;
313

    
314
    /* av_read_frame() support */
315
    AVStream *cur_st;
316
    const uint8_t *cur_ptr;
317
    int cur_len;
318
    AVPacket cur_pkt;
319

    
320
    /* av_seek_frame() support */
321
    int64_t data_offset; /* offset of the first packet */
322
    int index_built;
323
    
324
    int mux_rate;
325
    int packet_size;
326
    int preload;
327
    int max_delay;
328
} AVFormatContext;
329

    
330
typedef struct AVPacketList {
331
    AVPacket pkt;
332
    struct AVPacketList *next;
333
} AVPacketList;
334

    
335
extern AVInputFormat *first_iformat;
336
extern AVOutputFormat *first_oformat;
337

    
338
/* still image support */
339
struct AVInputImageContext;
340
typedef struct AVInputImageContext AVInputImageContext;
341

    
342
typedef struct AVImageInfo {
343
    enum PixelFormat pix_fmt; /* requested pixel format */
344
    int width; /* requested width */
345
    int height; /* requested height */
346
    int interleaved; /* image is interleaved (e.g. interleaved GIF) */
347
    AVPicture pict; /* returned allocated image */
348
} AVImageInfo;
349

    
350
/* AVImageFormat.flags field constants */
351
#define AVIMAGE_INTERLEAVED 0x0001 /* image format support interleaved output */
352

    
353
typedef struct AVImageFormat {
354
    const char *name;
355
    const char *extensions;
356
    /* tell if a given file has a chance of being parsing by this format */
357
    int (*img_probe)(AVProbeData *);
358
    /* read a whole image. 'alloc_cb' is called when the image size is
359
       known so that the caller can allocate the image. If 'allo_cb'
360
       returns non zero, then the parsing is aborted. Return '0' if
361
       OK. */
362
    int (*img_read)(ByteIOContext *, 
363
                    int (*alloc_cb)(void *, AVImageInfo *info), void *);
364
    /* write the image */
365
    int supported_pixel_formats; /* mask of supported formats for output */
366
    int (*img_write)(ByteIOContext *, AVImageInfo *);
367
    int flags;
368
    struct AVImageFormat *next;
369
} AVImageFormat;
370

    
371
void av_register_image_format(AVImageFormat *img_fmt);
372
AVImageFormat *av_probe_image_format(AVProbeData *pd);
373
AVImageFormat *guess_image_format(const char *filename);
374
enum CodecID av_guess_image2_codec(const char *filename);
375
int av_read_image(ByteIOContext *pb, const char *filename,
376
                  AVImageFormat *fmt,
377
                  int (*alloc_cb)(void *, AVImageInfo *info), void *opaque);
378
int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img);
379

    
380
extern AVImageFormat *first_image_format;
381

    
382
extern AVImageFormat pnm_image_format;
383
extern AVImageFormat pbm_image_format;
384
extern AVImageFormat pgm_image_format;
385
extern AVImageFormat ppm_image_format;
386
extern AVImageFormat pam_image_format;
387
extern AVImageFormat pgmyuv_image_format;
388
extern AVImageFormat yuv_image_format;
389
#ifdef CONFIG_ZLIB
390
extern AVImageFormat png_image_format;
391
#endif
392
extern AVImageFormat jpeg_image_format;
393
extern AVImageFormat gif_image_format;
394
extern AVImageFormat sgi_image_format;
395

    
396
/* XXX: use automatic init with either ELF sections or C file parser */
397
/* modules */
398

    
399
/* mpeg.c */
400
extern AVInputFormat mpegps_demux;
401
int mpegps_init(void);
402

    
403
/* mpegts.c */
404
extern AVInputFormat mpegts_demux;
405
int mpegts_init(void);
406

    
407
/* rm.c */
408
int rm_init(void);
409

    
410
/* crc.c */
411
int crc_init(void);
412

    
413
/* img.c */
414
int img_init(void);
415

    
416
/* img2.c */
417
int img2_init(void);
418

    
419
/* asf.c */
420
int asf_init(void);
421

    
422
/* avienc.c */
423
int avienc_init(void);
424

    
425
/* avidec.c */
426
int avidec_init(void);
427

    
428
/* swf.c */
429
int swf_init(void);
430

    
431
/* mov.c */
432
int mov_init(void);
433

    
434
/* movenc.c */
435
int movenc_init(void);
436

    
437
/* flvenc.c */
438
int flvenc_init(void);
439

    
440
/* flvdec.c */
441
int flvdec_init(void);
442

    
443
/* jpeg.c */
444
int jpeg_init(void);
445

    
446
/* gif.c */
447
int gif_init(void);
448

    
449
/* au.c */
450
int au_init(void);
451

    
452
/* amr.c */
453
int amr_init(void);
454

    
455
/* wav.c */
456
int ff_wav_init(void);
457

    
458
/* raw.c */
459
int pcm_read_seek(AVFormatContext *s, 
460
                  int stream_index, int64_t timestamp, int flags);
461
int raw_init(void);
462

    
463
/* mp3.c */
464
int mp3_init(void);
465

    
466
/* yuv4mpeg.c */
467
int yuv4mpeg_init(void);
468

    
469
/* ogg.c */
470
int ogg_init(void);
471

    
472
/* dv.c */
473
int ff_dv_init(void);
474

    
475
/* ffm.c */
476
int ffm_init(void);
477

    
478
/* rtsp.c */
479
extern AVInputFormat redir_demux;
480
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f);
481

    
482
/* 4xm.c */
483
int fourxm_init(void);
484

    
485
/* psxstr.c */
486
int str_init(void);
487

    
488
/* idroq.c */
489
int roq_init(void);
490

    
491
/* ipmovie.c */
492
int ipmovie_init(void);
493

    
494
/* nut.c */
495
int nut_init(void);
496

    
497
/* wc3movie.c */
498
int wc3_init(void);
499

    
500
/* westwood.c */
501
int westwood_init(void);
502

    
503
/* segafilm.c */
504
int film_init(void);
505

    
506
/* idcin.c */
507
int idcin_init(void);
508

    
509
/* flic.c */
510
int flic_init(void);
511

    
512
/* sierravmd.c */
513
int vmd_init(void);
514

    
515
/* matroska.c */
516
int matroska_init(void);
517

    
518
/* sol.c */
519
int sol_init(void);
520

    
521
/* electronicarts.c */
522
int ea_init(void);
523

    
524
/* nsvdec.c */
525
int nsvdec_init(void);
526

    
527
#include "rtp.h"
528

    
529
#include "rtsp.h"
530

    
531
/* yuv4mpeg.c */
532
extern AVOutputFormat yuv4mpegpipe_oformat;
533

    
534
/* utils.c */
535
void av_register_input_format(AVInputFormat *format);
536
void av_register_output_format(AVOutputFormat *format);
537
AVOutputFormat *guess_stream_format(const char *short_name, 
538
                                    const char *filename, const char *mime_type);
539
AVOutputFormat *guess_format(const char *short_name, 
540
                             const char *filename, const char *mime_type);
541
enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, 
542
                            const char *filename, const char *mime_type, enum CodecType type);
543

    
544
void av_hex_dump(FILE *f, uint8_t *buf, int size);
545
void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
546

    
547
void av_register_all(void);
548

    
549
typedef struct FifoBuffer {
550
    uint8_t *buffer;
551
    uint8_t *rptr, *wptr, *end;
552
} FifoBuffer;
553

    
554
int fifo_init(FifoBuffer *f, int size);
555
void fifo_free(FifoBuffer *f);
556
int fifo_size(FifoBuffer *f, uint8_t *rptr);
557
int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
558
void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);
559
int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);
560
void fifo_realloc(FifoBuffer *f, unsigned int size);
561

    
562
/* media file input */
563
AVInputFormat *av_find_input_format(const char *short_name);
564
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
565
int av_open_input_stream(AVFormatContext **ic_ptr, 
566
                         ByteIOContext *pb, const char *filename, 
567
                         AVInputFormat *fmt, AVFormatParameters *ap);
568
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, 
569
                       AVInputFormat *fmt,
570
                       int buf_size,
571
                       AVFormatParameters *ap);
572
/* no av_open for output, so applications will need this: */
573
AVFormatContext *av_alloc_format_context(void);
574

    
575
#define AVERROR_UNKNOWN     (-1)  /* unknown error */
576
#define AVERROR_IO          (-2)  /* i/o error */
577
#define AVERROR_NUMEXPECTED (-3)  /* number syntax expected in filename */
578
#define AVERROR_INVALIDDATA (-4)  /* invalid data found */
579
#define AVERROR_NOMEM       (-5)  /* not enough memory */
580
#define AVERROR_NOFMT       (-6)  /* unknown format */
581
#define AVERROR_NOTSUPP     (-7)  /* operation not supported */
582
 
583
int av_find_stream_info(AVFormatContext *ic);
584
int av_read_packet(AVFormatContext *s, AVPacket *pkt);
585
int av_read_frame(AVFormatContext *s, AVPacket *pkt);
586
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags);
587
int av_read_play(AVFormatContext *s);
588
int av_read_pause(AVFormatContext *s);
589
void av_close_input_file(AVFormatContext *s);
590
AVStream *av_new_stream(AVFormatContext *s, int id);
591
void av_set_pts_info(AVStream *s, int pts_wrap_bits,
592
                     int pts_num, int pts_den);
593

    
594
#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
595
#define AVSEEK_FLAG_BYTE     2 ///< seeking based on position in bytes
596
#define AVSEEK_FLAG_ANY      4 ///< seek to any frame, even non keyframes
597

    
598
int av_find_default_stream_index(AVFormatContext *s);
599
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
600
int av_add_index_entry(AVStream *st,
601
                       int64_t pos, int64_t timestamp, int distance, int flags);
602
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags);
603

    
604
/* media file output */
605
int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
606
int av_write_header(AVFormatContext *s);
607
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
608
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
609

    
610
int av_write_trailer(AVFormatContext *s);
611

    
612
void dump_format(AVFormatContext *ic,
613
                 int index, 
614
                 const char *url,
615
                 int is_output);
616
int parse_image_size(int *width_ptr, int *height_ptr, const char *str);
617
int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg);
618
int64_t parse_date(const char *datestr, int duration);
619

    
620
int64_t av_gettime(void);
621

    
622
/* ffm specific for ffserver */
623
#define FFM_PACKET_SIZE 4096
624
offset_t ffm_read_write_index(int fd);
625
void ffm_write_write_index(int fd, offset_t pos);
626
void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size);
627

    
628
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
629

    
630
int get_frame_filename(char *buf, int buf_size,
631
                       const char *path, int number);
632
int filename_number_test(const char *filename);
633

    
634
/* grab specific */
635
int video_grab_init(void);
636
int audio_init(void);
637

    
638
/* DV1394 */
639
int dv1394_init(void);
640
int dc1394_init(void);
641

    
642
#ifdef HAVE_AV_CONFIG_H
643

    
644
#include "os_support.h"
645

    
646
int strstart(const char *str, const char *val, const char **ptr);
647
int stristart(const char *str, const char *val, const char **ptr);
648
void pstrcpy(char *buf, int buf_size, const char *str);
649
char *pstrcat(char *buf, int buf_size, const char *s);
650

    
651
void __dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem);
652

    
653
#ifdef __GNUC__
654
#define dynarray_add(tab, nb_ptr, elem)\
655
do {\
656
    typeof(tab) _tab = (tab);\
657
    typeof(elem) _elem = (elem);\
658
    (void)sizeof(**_tab == _elem); /* check that types are compatible */\
659
    __dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\
660
} while(0)
661
#else
662
#define dynarray_add(tab, nb_ptr, elem)\
663
do {\
664
    __dynarray_add((unsigned long **)(tab), nb_ptr, (unsigned long)(elem));\
665
} while(0)
666
#endif
667

    
668
time_t mktimegm(struct tm *tm);
669
struct tm *brktimegm(time_t secs, struct tm *tm);
670
const char *small_strptime(const char *p, const char *fmt, 
671
                           struct tm *dt);
672

    
673
struct in_addr;
674
int resolve_host(struct in_addr *sin_addr, const char *hostname);
675

    
676
void url_split(char *proto, int proto_size,
677
               char *authorization, int authorization_size,
678
               char *hostname, int hostname_size,
679
               int *port_ptr,
680
               char *path, int path_size,
681
               const char *url);
682

    
683
int match_ext(const char *filename, const char *extensions);
684

    
685
#endif /* HAVE_AV_CONFIG_H */
686

    
687
#ifdef __cplusplus
688
}
689
#endif
690

    
691
#endif /* AVFORMAT_H */
692