~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/avformat.h

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-25 15:47:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080225154712-qvr11ekcea4c9ry8
Tags: 1.1.6-0.1ubuntu1
* Merge from debian-multimedia (LP: #120003), Ubuntu Changes:
 - For ffmpeg-related build-deps, remove cvs from package names.
 - Standards-Version 3.7.3
 - Maintainer Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * copyright (c) 2001 Fabrice Bellard
 
3
 *
 
4
 * This file is part of FFmpeg.
 
5
 *
 
6
 * FFmpeg is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2.1 of the License, or (at your option) any later version.
 
10
 *
 
11
 * FFmpeg is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with FFmpeg; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
19
 */
 
20
 
1
21
#ifndef AVFORMAT_H
2
22
#define AVFORMAT_H
3
23
 
5
25
extern "C" {
6
26
#endif
7
27
 
8
 
#define LIBAVFORMAT_BUILD       4608
 
28
#define LIBAVFORMAT_VERSION_INT ((51<<16)+(10<<8)+0)
 
29
#define LIBAVFORMAT_VERSION     51.10.0
 
30
#define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
9
31
 
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)
 
32
#define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
13
33
 
14
34
#include <time.h>
15
 
 
 
35
#include <stdio.h>  /* FILE */
16
36
#include "avcodec.h"
17
37
 
18
38
#include "avio.h"
19
39
 
20
40
/* packet functions */
21
41
 
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
 
#define AV_NOPTS_VALUE MININT64
31
 
#define AV_TIME_BASE 1000000
32
 
 
33
42
typedef struct AVPacket {
34
 
    int64_t pts; /* presentation time stamp in stream units (set av_set_pts_info) */
 
43
    int64_t pts;                            ///< presentation time stamp in time_base units
 
44
    int64_t dts;                            ///< decompression time stamp in time_base units
35
45
    uint8_t *data;
36
46
    int   size;
37
47
    int   stream_index;
38
48
    int   flags;
39
 
    int   duration;
 
49
    int   duration;                         ///< presentation duration in time_base units (0 if not available)
40
50
    void  (*destruct)(struct AVPacket *);
41
51
    void  *priv;
42
 
} AVPacket; 
 
52
    int64_t pos;                            ///< byte position in stream, -1 if unknown
 
53
} AVPacket;
43
54
#define PKT_FLAG_KEY   0x0001
44
55
 
 
56
void av_destruct_packet_nofree(AVPacket *pkt);
 
57
void av_destruct_packet(AVPacket *pkt);
 
58
 
 
59
/* initialize optional fields of a packet */
45
60
static inline void av_init_packet(AVPacket *pkt)
46
61
{
47
62
    pkt->pts   = AV_NOPTS_VALUE;
 
63
    pkt->dts   = AV_NOPTS_VALUE;
 
64
    pkt->pos   = -1;
 
65
    pkt->duration = 0;
48
66
    pkt->flags = 0;
49
67
    pkt->stream_index = 0;
 
68
    pkt->destruct= av_destruct_packet_nofree;
50
69
}
51
70
 
52
71
int av_new_packet(AVPacket *pkt, int size);
 
72
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
 
73
int av_dup_packet(AVPacket *pkt);
53
74
 
54
75
/**
55
76
 * Free a packet
59
80
static inline void av_free_packet(AVPacket *pkt)
60
81
{
61
82
    if (pkt && pkt->destruct) {
62
 
        pkt->destruct(pkt);
 
83
        pkt->destruct(pkt);
63
84
    }
64
85
}
65
86
 
69
90
/* the exact value of the fractional number is: 'val + num / den'. num
70
91
   is assumed to be such as 0 <= num < den */
71
92
typedef struct AVFrac {
72
 
    int64_t val, num, den; 
73
 
} AVFrac;
74
 
 
75
 
void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den);
76
 
void av_frac_add(AVFrac *f, int64_t incr);
77
 
void av_frac_set(AVFrac *f, int64_t val);
 
93
    int64_t val, num, den;
 
94
} AVFrac attribute_deprecated;
78
95
 
79
96
/*************************************************/
80
97
/* input/output formats */
81
98
 
 
99
struct AVCodecTag;
 
100
 
82
101
struct AVFormatContext;
83
102
 
84
103
/* this structure contains the data a format has to probe a file */
88
107
    int buf_size;
89
108
} AVProbeData;
90
109
 
91
 
#define AVPROBE_SCORE_MAX 100
 
110
#define AVPROBE_SCORE_MAX 100               ///< max score, half of that is used for file extension based detection
92
111
 
93
112
typedef struct AVFormatParameters {
94
 
    int frame_rate;
95
 
    int frame_rate_base;
 
113
    AVRational time_base;
96
114
    int sample_rate;
97
115
    int channels;
98
116
    int width;
99
117
    int height;
100
118
    enum PixelFormat pix_fmt;
101
 
    struct AVImageFormat *image_format;
102
119
    int channel; /* used to select dv channel */
103
 
    const char *device; /* video4linux, audio or DV device */
 
120
#if LIBAVFORMAT_VERSION_INT < (52<<16)
 
121
    const char *device; /* video, audio or DV device */
 
122
#endif
104
123
    const char *standard; /* tv standard, NTSC, PAL, SECAM */
 
124
    int mpeg2ts_raw:1;  /* force raw MPEG2 transport stream output, if possible */
 
125
    int mpeg2ts_compute_pcr:1; /* compute exact PCR for each transport
 
126
                                  stream packet (only meaningful if
 
127
                                  mpeg2ts_raw is TRUE */
 
128
    int initial_pause:1;       /* do not begin to play the stream
 
129
                                  immediately (RTSP only) */
 
130
    int prealloced_context:1;
 
131
    enum CodecID video_codec_id;
 
132
    enum CodecID audio_codec_id;
105
133
} AVFormatParameters;
106
134
 
107
 
#define AVFMT_NOFILE        0x0001 /* no file should be opened */
108
 
#define AVFMT_NEEDNUMBER    0x0002 /* needs '%d' in filename */ 
109
 
#define AVFMT_NOHEADER      0x0004 /* signal that no header is present
110
 
                                      (streams are added dynamically) */
 
135
//! demuxer will use url_fopen, no opened file should be provided by the caller
 
136
#define AVFMT_NOFILE        0x0001
 
137
#define AVFMT_NEEDNUMBER    0x0002 /* needs '%d' in filename */
111
138
#define AVFMT_SHOW_IDS      0x0008 /* show format stream IDs numbers */
112
139
#define AVFMT_RAWPICTURE    0x0020 /* format wants AVPicture structure for
113
140
                                      raw picture data */
 
141
#define AVFMT_GLOBALHEADER  0x0040 /* format wants global header */
 
142
#define AVFMT_NOTIMESTAMPS  0x0080 /* format doesnt need / has any timestamps */
 
143
#define AVFMT_GENERIC_INDEX 0x0100 /* use generic index building code */
114
144
 
115
145
typedef struct AVOutputFormat {
116
146
    const char *name;
123
153
    enum CodecID audio_codec; /* default audio codec */
124
154
    enum CodecID video_codec; /* default video codec */
125
155
    int (*write_header)(struct AVFormatContext *);
126
 
    int (*write_packet)(struct AVFormatContext *, 
127
 
                        int stream_index,
128
 
                        const uint8_t *buf, int size, int64_t pts);
 
156
    int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
129
157
    int (*write_trailer)(struct AVFormatContext *);
130
 
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */
 
158
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */
131
159
    int flags;
132
160
    /* currently only used to set pixel format if not YUV420P */
133
161
    int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *);
 
162
    int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush);
 
163
 
 
164
    /**
 
165
     * list of supported codec_id-codec_tag pairs, ordered by "better choice first"
 
166
     * the arrays are all CODEC_ID_NONE terminated
 
167
     */
 
168
    const struct AVCodecTag **codec_tag;
 
169
 
134
170
    /* private fields */
135
171
    struct AVOutputFormat *next;
136
172
} AVOutputFormat;
150
186
                       AVFormatParameters *ap);
151
187
    /* read one packet and put it in 'pkt'. pts and flags are also
152
188
       set. 'av_new_stream' can be called only if the flag
153
 
       AVFMT_NOHEADER is used. */
 
189
       AVFMTCTX_NOHEADER is used. */
154
190
    int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
155
191
    /* close the stream. The AVFormatContext and AVStreams are not
156
192
       freed by this function */
157
193
    int (*read_close)(struct AVFormatContext *);
158
 
    /* seek at or before a given pts (given in microsecond). The pts
159
 
       origin is defined by the stream */
160
 
    int (*read_seek)(struct AVFormatContext *, int64_t pts);
161
 
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_NOHEADER */
 
194
    /**
 
195
     * seek to a given timestamp relative to the frames in
 
196
     * stream component stream_index
 
197
     * @param stream_index must not be -1
 
198
     * @param flags selects which direction should be preferred if no exact
 
199
     *              match is available
 
200
     */
 
201
    int (*read_seek)(struct AVFormatContext *,
 
202
                     int stream_index, int64_t timestamp, int flags);
 
203
    /**
 
204
     * gets the next timestamp in AV_TIME_BASE units.
 
205
     */
 
206
    int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
 
207
                              int64_t *pos, int64_t pos_limit);
 
208
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */
162
209
    int flags;
163
210
    /* if extensions are defined, then no probe is done. You should
164
211
       usually not use extension format guessing because it is not
166
213
    const char *extensions;
167
214
    /* general purpose read only value that the format can use */
168
215
    int value;
 
216
 
 
217
    /* start/resume playing - only meaningful if using a network based format
 
218
       (RTSP) */
 
219
    int (*read_play)(struct AVFormatContext *);
 
220
 
 
221
    /* pause playing - only meaningful if using a network based format
 
222
       (RTSP) */
 
223
    int (*read_pause)(struct AVFormatContext *);
 
224
 
 
225
    const struct AVCodecTag **codec_tag;
 
226
 
169
227
    /* private fields */
170
228
    struct AVInputFormat *next;
171
229
} AVInputFormat;
172
230
 
 
231
typedef struct AVIndexEntry {
 
232
    int64_t pos;
 
233
    int64_t timestamp;
 
234
#define AVINDEX_KEYFRAME 0x0001
 
235
    int flags:2;
 
236
    int size:30; //yeah trying to keep the size of this small to reduce memory requirements (its 24 vs 32 byte due to possible 8byte align)
 
237
    int min_distance;         /* min distance between this and the previous keyframe, used to avoid unneeded searching */
 
238
} AVIndexEntry;
 
239
 
173
240
typedef struct AVStream {
174
241
    int index;    /* stream index in AVFormatContext */
175
242
    int id;       /* format specific stream id */
176
 
    AVCodecContext codec; /* codec context */
177
 
    int r_frame_rate;     /* real frame rate of the stream */
178
 
    int r_frame_rate_base;/* real frame rate base of the stream */
 
243
    AVCodecContext *codec; /* codec context */
 
244
    /**
 
245
     * real base frame rate of the stream.
 
246
     * this is the lowest framerate with which all timestamps can be
 
247
     * represented accurately (its the least common multiple of all
 
248
     * framerates in the stream), Note, this value is just a guess!
 
249
     * for example if the timebase is 1/90000 and all frames have either
 
250
     * approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1
 
251
     */
 
252
    AVRational r_frame_rate;
179
253
    void *priv_data;
180
254
    /* internal data used in av_find_stream_info() */
181
 
    int codec_info_state;     
182
 
    int codec_info_nb_repeat_frames;
183
 
    int codec_info_nb_real_frames;
184
 
    /* PTS generation when outputing stream */
 
255
    int64_t codec_info_duration;
 
256
    int codec_info_nb_frames;
 
257
    /* encoding: PTS generation when outputing stream */
185
258
    AVFrac pts;
 
259
 
 
260
    /**
 
261
     * this is the fundamental unit of time (in seconds) in terms
 
262
     * of which frame timestamps are represented. for fixed-fps content,
 
263
     * timebase should be 1/framerate and timestamp increments should be
 
264
     * identically 1.
 
265
     */
 
266
    AVRational time_base;
 
267
    int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
186
268
    /* ffmpeg.c private use */
187
269
    int stream_copy; /* if TRUE, just copy stream */
 
270
    enum AVDiscard discard; ///< selects which packets can be discarded at will and dont need to be demuxed
 
271
    //FIXME move stuff to a flags field?
188
272
    /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame
189
273
     * MN:dunno if thats the right place, for it */
190
 
    float quality; 
 
274
    float quality;
191
275
    /* decoding: position of the first frame of the component, in
192
276
       AV_TIME_BASE fractional seconds. */
193
 
    int64_t start_time; 
 
277
    int64_t start_time;
194
278
    /* decoding: duration of the stream, in AV_TIME_BASE fractional
195
279
       seconds. */
196
280
    int64_t duration;
 
281
 
 
282
    char language[4]; /* ISO 639 3-letter language code (empty string if undefined) */
 
283
 
 
284
    /* av_read_frame() support */
 
285
    int need_parsing;                  ///< 1->full parsing needed, 2->only parse headers dont repack
 
286
    struct AVCodecParserContext *parser;
 
287
 
 
288
    int64_t cur_dts;
 
289
    int last_IP_duration;
 
290
    int64_t last_IP_pts;
 
291
    /* av_seek_frame() support */
 
292
    AVIndexEntry *index_entries; /* only used if the format does not
 
293
                                    support seeking natively */
 
294
    int nb_index_entries;
 
295
    unsigned int index_entries_allocated_size;
 
296
 
 
297
    int64_t nb_frames;                 ///< number of frames in this stream if known or 0
 
298
 
 
299
#define MAX_REORDER_DELAY 4
 
300
    int64_t pts_buffer[MAX_REORDER_DELAY+1];
197
301
} AVStream;
198
302
 
 
303
#define AVFMTCTX_NOHEADER      0x0001 /* signal that no header is present
 
304
                                         (streams are added dynamically) */
 
305
 
199
306
#define MAX_STREAMS 20
200
307
 
201
308
/* format I/O context */
202
309
typedef struct AVFormatContext {
 
310
    const AVClass *av_class; /* set by av_alloc_format_context */
203
311
    /* can only be iformat or oformat, not both at the same time */
204
312
    struct AVInputFormat *iformat;
205
313
    struct AVOutputFormat *oformat;
206
314
    void *priv_data;
207
315
    ByteIOContext pb;
208
 
    int nb_streams;
 
316
    unsigned int nb_streams;
209
317
    AVStream *streams[MAX_STREAMS];
210
318
    char filename[1024]; /* input or output filename */
211
319
    /* stream info */
 
320
    int64_t timestamp;
212
321
    char title[512];
213
322
    char author[512];
214
323
    char copyright[512];
218
327
    int track; /* track number, 0 if none */
219
328
    char genre[32]; /* ID3 genre */
220
329
 
221
 
    int flags; /* format specific flags */
 
330
    int ctx_flags; /* format specific flags, see AVFMTCTX_xx */
222
331
    /* private data for pts handling (do not modify directly) */
223
 
    int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
224
 
    int pts_num, pts_den; /* value to convert to seconds */
225
332
    /* This buffer is only needed when packets were already buffered but
226
333
       not decoded, for example to get the codec parameters in mpeg
227
334
       streams */
230
337
    /* decoding: position of the first frame of the component, in
231
338
       AV_TIME_BASE fractional seconds. NEVER set this value directly:
232
339
       it is deduced from the AVStream values.  */
233
 
    int64_t start_time; 
 
340
    int64_t start_time;
234
341
    /* decoding: duration of the stream, in AV_TIME_BASE fractional
235
342
       seconds. NEVER set this value directly: it is deduced from the
236
343
       AVStream values.  */
241
348
       available. Never set it directly if the file_size and the
242
349
       duration are known as ffmpeg can compute it automatically. */
243
350
    int bit_rate;
 
351
 
 
352
    /* av_read_frame() support */
 
353
    AVStream *cur_st;
 
354
    const uint8_t *cur_ptr;
 
355
    int cur_len;
 
356
    AVPacket cur_pkt;
 
357
 
 
358
    /* av_seek_frame() support */
 
359
    int64_t data_offset; /* offset of the first packet */
 
360
    int index_built;
 
361
 
 
362
    int mux_rate;
 
363
    int packet_size;
 
364
    int preload;
 
365
    int max_delay;
 
366
 
 
367
#define AVFMT_NOOUTPUTLOOP -1
 
368
#define AVFMT_INFINITEOUTPUTLOOP 0
 
369
    /* number of times to loop output in formats that support it */
 
370
    int loop_output;
 
371
 
 
372
    int flags;
 
373
#define AVFMT_FLAG_GENPTS       0x0001 ///< generate pts if missing even if it requires parsing future frames
 
374
#define AVFMT_FLAG_IGNIDX       0x0002 ///< ignore index
 
375
 
 
376
    int loop_input;
 
377
    /* decoding: size of data to probe; encoding unused */
 
378
    unsigned int probesize;
 
379
 
 
380
    /**
 
381
     * maximum duration in AV_TIME_BASE units over which the input should be analyzed in av_find_stream_info()
 
382
     */
 
383
    int max_analyze_duration;
 
384
 
 
385
    const uint8_t *key;
 
386
    int keylen;
244
387
} AVFormatContext;
245
388
 
246
389
typedef struct AVPacketList {
251
394
extern AVInputFormat *first_iformat;
252
395
extern AVOutputFormat *first_oformat;
253
396
 
254
 
/* still image support */
255
 
struct AVInputImageContext;
256
 
typedef struct AVInputImageContext AVInputImageContext;
257
 
 
258
 
typedef struct AVImageInfo {
259
 
    enum PixelFormat pix_fmt; /* requested pixel format */
260
 
    int width; /* requested width */
261
 
    int height; /* requested height */
262
 
    int interleaved; /* image is interleaved (e.g. interleaved GIF) */
263
 
    AVPicture pict; /* returned allocated image */
264
 
} AVImageInfo;
265
 
 
266
 
/* AVImageFormat.flags field constants */
267
 
#define AVIMAGE_INTERLEAVED 0x0001 /* image format support interleaved output */
268
 
 
269
 
typedef struct AVImageFormat {
270
 
    const char *name;
271
 
    const char *extensions;
272
 
    /* tell if a given file has a chance of being parsing by this format */
273
 
    int (*img_probe)(AVProbeData *);
274
 
    /* read a whole image. 'alloc_cb' is called when the image size is
275
 
       known so that the caller can allocate the image. If 'allo_cb'
276
 
       returns non zero, then the parsing is aborted. Return '0' if
277
 
       OK. */
278
 
    int (*img_read)(ByteIOContext *, 
279
 
                    int (*alloc_cb)(void *, AVImageInfo *info), void *);
280
 
    /* write the image */
281
 
    int supported_pixel_formats; /* mask of supported formats for output */
282
 
    int (*img_write)(ByteIOContext *, AVImageInfo *);
283
 
    int flags;
284
 
    struct AVImageFormat *next;
285
 
} AVImageFormat;
286
 
 
287
 
void av_register_image_format(AVImageFormat *img_fmt);
288
 
AVImageFormat *av_probe_image_format(AVProbeData *pd);
289
 
AVImageFormat *guess_image_format(const char *filename);
290
 
int av_read_image(ByteIOContext *pb, const char *filename,
291
 
                  AVImageFormat *fmt,
292
 
                  int (*alloc_cb)(void *, AVImageInfo *info), void *opaque);
293
 
int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img);
294
 
 
295
 
extern AVImageFormat *first_image_format;
296
 
 
297
 
extern AVImageFormat pnm_image_format;
298
 
extern AVImageFormat pbm_image_format;
299
 
extern AVImageFormat pgm_image_format;
300
 
extern AVImageFormat ppm_image_format;
301
 
extern AVImageFormat pam_image_format;
302
 
extern AVImageFormat pgmyuv_image_format;
303
 
extern AVImageFormat yuv_image_format;
304
 
#ifdef CONFIG_ZLIB
305
 
extern AVImageFormat png_image_format;
306
 
#endif
307
 
extern AVImageFormat jpeg_image_format;
308
 
extern AVImageFormat gif_image_format;
 
397
enum CodecID av_guess_image2_codec(const char *filename);
309
398
 
310
399
/* XXX: use automatic init with either ELF sections or C file parser */
311
400
/* modules */
312
401
 
313
 
/* mpeg.c */
314
 
extern AVInputFormat mpegps_demux;
315
 
int mpegps_init(void);
316
 
 
317
 
/* mpegts.c */
318
 
extern AVInputFormat mpegts_demux;
319
 
int mpegts_init(void);
320
 
 
321
 
/* rm.c */
322
 
int rm_init(void);
323
 
 
324
 
/* crc.c */
325
 
int crc_init(void);
326
 
 
327
 
/* img.c */
328
 
int img_init(void);
329
 
 
330
 
/* asf.c */
331
 
int asf_init(void);
332
 
 
333
 
/* avienc.c */
334
 
int avienc_init(void);
335
 
 
336
 
/* avidec.c */
337
 
int avidec_init(void);
338
 
 
339
 
/* swf.c */
340
 
int swf_init(void);
341
 
 
342
 
/* mov.c */
343
 
int mov_init(void);
344
 
 
345
 
/* movenc.c */
346
 
int movenc_init(void);
347
 
 
348
 
/* flvenc.c */
349
 
int flvenc_init(void);
350
 
 
351
 
/* flvdec.c */
352
 
int flvdec_init(void);
353
 
 
354
 
/* jpeg.c */
355
 
int jpeg_init(void);
356
 
 
357
 
/* gif.c */
358
 
int gif_init(void);
359
 
 
360
 
/* au.c */
361
 
int au_init(void);
362
 
 
363
 
/* amr.c */
364
 
int amr_init(void);
365
 
 
366
 
/* wav.c */
367
 
int wav_init(void);
368
 
 
369
 
/* raw.c */
370
 
int raw_init(void);
371
 
 
372
 
/* mp3.c */
373
 
int mp3_init(void);
374
 
 
375
 
/* yuv4mpeg.c */
376
 
int yuv4mpeg_init(void);
377
 
 
378
 
/* ogg.c */
379
 
int ogg_init(void);
380
 
 
381
 
/* dv.c */
382
 
int dv_init(void);
383
 
 
384
 
/* ffm.c */
385
 
int ffm_init(void);
386
 
 
387
 
/* rtsp.c */
388
 
extern AVInputFormat redir_demux;
389
 
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f);
390
 
 
391
 
/* 4xm.c */
392
 
int fourxm_init(void);
393
 
 
394
 
/* psxstr.c */
395
 
int str_init(void);
396
 
 
397
 
/* idroq.c */
398
 
int roq_init(void);
399
 
 
400
 
/* ipmovie.c */
401
 
int ipmovie_init(void);
402
 
 
403
 
/* nut.c */
404
 
int nut_init(void);
405
 
 
406
 
/* wc3movie.c */
407
 
int wc3_init(void);
408
 
 
409
402
#include "rtp.h"
410
403
 
411
404
#include "rtsp.h"
412
405
 
413
 
/* yuv4mpeg.c */
414
 
extern AVOutputFormat yuv4mpegpipe_oformat;
415
 
 
416
406
/* utils.c */
417
407
void av_register_input_format(AVInputFormat *format);
418
408
void av_register_output_format(AVOutputFormat *format);
419
 
AVOutputFormat *guess_stream_format(const char *short_name, 
 
409
AVOutputFormat *guess_stream_format(const char *short_name,
420
410
                                    const char *filename, const char *mime_type);
421
 
AVOutputFormat *guess_format(const char *short_name, 
 
411
AVOutputFormat *guess_format(const char *short_name,
422
412
                             const char *filename, const char *mime_type);
 
413
enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
 
414
                            const char *filename, const char *mime_type, enum CodecType type);
423
415
 
424
 
void av_hex_dump(uint8_t *buf, int size);
 
416
void av_hex_dump(FILE *f, uint8_t *buf, int size);
 
417
void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
425
418
 
426
419
void av_register_all(void);
427
420
 
428
 
typedef struct FifoBuffer {
429
 
    uint8_t *buffer;
430
 
    uint8_t *rptr, *wptr, *end;
431
 
} FifoBuffer;
432
 
 
433
 
int fifo_init(FifoBuffer *f, int size);
434
 
void fifo_free(FifoBuffer *f);
435
 
int fifo_size(FifoBuffer *f, uint8_t *rptr);
436
 
int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
437
 
void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);
 
421
/* codec tag <-> codec id */
 
422
enum CodecID av_codec_get_id(const struct AVCodecTag **tags, unsigned int tag);
 
423
unsigned int av_codec_get_tag(const struct AVCodecTag **tags, enum CodecID id);
438
424
 
439
425
/* media file input */
440
426
AVInputFormat *av_find_input_format(const char *short_name);
441
427
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
442
 
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, 
 
428
int av_open_input_stream(AVFormatContext **ic_ptr,
 
429
                         ByteIOContext *pb, const char *filename,
 
430
                         AVInputFormat *fmt, AVFormatParameters *ap);
 
431
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
443
432
                       AVInputFormat *fmt,
444
433
                       int buf_size,
445
434
                       AVFormatParameters *ap);
446
 
 
447
 
#define AVERROR_UNKNOWN     (-1)  /* unknown error */
448
 
#define AVERROR_IO          (-2)  /* i/o error */
449
 
#define AVERROR_NUMEXPECTED (-3)  /* number syntax expected in filename */
450
 
#define AVERROR_INVALIDDATA (-4)  /* invalid data found */
451
 
#define AVERROR_NOMEM       (-5)  /* not enough memory */
452
 
#define AVERROR_NOFMT       (-6)  /* unknown format */
 
435
/* no av_open for output, so applications will need this: */
 
436
AVFormatContext *av_alloc_format_context(void);
453
437
 
454
438
int av_find_stream_info(AVFormatContext *ic);
455
439
int av_read_packet(AVFormatContext *s, AVPacket *pkt);
 
440
int av_read_frame(AVFormatContext *s, AVPacket *pkt);
 
441
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags);
 
442
int av_read_play(AVFormatContext *s);
 
443
int av_read_pause(AVFormatContext *s);
456
444
void av_close_input_file(AVFormatContext *s);
457
445
AVStream *av_new_stream(AVFormatContext *s, int id);
458
 
void av_set_pts_info(AVFormatContext *s, int pts_wrap_bits,
 
446
void av_set_pts_info(AVStream *s, int pts_wrap_bits,
459
447
                     int pts_num, int pts_den);
460
448
 
 
449
#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
 
450
#define AVSEEK_FLAG_BYTE     2 ///< seeking based on position in bytes
 
451
#define AVSEEK_FLAG_ANY      4 ///< seek to any frame, even non keyframes
 
452
 
 
453
int av_find_default_stream_index(AVFormatContext *s);
 
454
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
 
455
int av_add_index_entry(AVStream *st,
 
456
                       int64_t pos, int64_t timestamp, int size, int distance, int flags);
 
457
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags);
 
458
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
 
459
int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
 
460
 
461
461
/* media file output */
462
462
int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
463
463
int av_write_header(AVFormatContext *s);
464
 
int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf, 
465
 
                   int size);
 
464
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
 
465
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
 
466
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush);
 
467
 
466
468
int av_write_trailer(AVFormatContext *s);
467
469
 
468
470
void dump_format(AVFormatContext *ic,
469
 
                 int index, 
 
471
                 int index,
470
472
                 const char *url,
471
473
                 int is_output);
472
474
int parse_image_size(int *width_ptr, int *height_ptr, const char *str);
483
485
 
484
486
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
485
487
 
486
 
int get_frame_filename(char *buf, int buf_size,
487
 
                       const char *path, int number);
488
 
int filename_number_test(const char *filename);
 
488
int av_get_frame_filename(char *buf, int buf_size,
 
489
                          const char *path, int number);
 
490
int av_filename_number_test(const char *filename);
489
491
 
490
492
/* grab specific */
491
493
int video_grab_init(void);
493
495
 
494
496
/* DV1394 */
495
497
int dv1394_init(void);
 
498
int dc1394_init(void);
496
499
 
497
500
#ifdef HAVE_AV_CONFIG_H
498
501
 
521
524
#endif
522
525
 
523
526
time_t mktimegm(struct tm *tm);
524
 
const char *small_strptime(const char *p, const char *fmt, 
 
527
struct tm *brktimegm(time_t secs, struct tm *tm);
 
528
const char *small_strptime(const char *p, const char *fmt,
525
529
                           struct tm *dt);
526
530
 
527
531
struct in_addr;
528
532
int resolve_host(struct in_addr *sin_addr, const char *hostname);
529
533
 
530
534
void url_split(char *proto, int proto_size,
 
535
               char *authorization, int authorization_size,
531
536
               char *hostname, int hostname_size,
532
537
               int *port_ptr,
533
538
               char *path, int path_size,
542
547
#endif
543
548
 
544
549
#endif /* AVFORMAT_H */
 
550