~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

Viewing changes to src/gfxoutputdrv/ffmpeg/avformat.h

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2006-07-30 19:15:59 UTC
  • mto: (9.1.1 lenny) (1.1.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20060730191559-g31ymd2mk102kzff
Tags: upstream-1.19
ImportĀ upstreamĀ versionĀ 1.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
extern "C" {
6
6
#endif
7
7
 
8
 
#define LIBAVFORMAT_BUILD       4608
 
8
#define LIBAVFORMAT_BUILD       4616
9
9
 
10
10
#define LIBAVFORMAT_VERSION_INT FFMPEG_VERSION_INT
11
11
#define LIBAVFORMAT_VERSION     FFMPEG_VERSION
12
12
#define LIBAVFORMAT_IDENT       "FFmpeg" FFMPEG_VERSION "b" AV_STRINGIFY(LIBAVFORMAT_BUILD)
13
13
 
14
14
#include <time.h>
15
 
 
 
15
#include <stdio.h>  /* FILE */
16
16
#include "avcodec.h"
17
17
 
18
18
#include "avio.h"
27
27
#define MININT64 int64_t_C(0x8000000000000000)
28
28
#endif
29
29
 
30
 
#define AV_NOPTS_VALUE MININT64
31
 
#define AV_TIME_BASE 1000000
32
 
 
33
30
typedef struct AVPacket {
34
 
    int64_t pts; /* presentation time stamp in stream units (set av_set_pts_info) */
 
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
35
    uint8_t *data;
36
36
    int   size;
37
37
    int   stream_index;
38
38
    int   flags;
39
 
    int   duration;
 
39
    int   duration; /* presentation duration (0 if not available) */
40
40
    void  (*destruct)(struct AVPacket *);
41
41
    void  *priv;
42
42
} AVPacket; 
43
43
#define PKT_FLAG_KEY   0x0001
44
44
 
 
45
/* initialize optional fields of a packet */
45
46
static inline void av_init_packet(AVPacket *pkt)
46
47
{
47
48
    pkt->pts   = AV_NOPTS_VALUE;
 
49
    pkt->dts   = AV_NOPTS_VALUE;
 
50
    pkt->duration = 0;
48
51
    pkt->flags = 0;
49
52
    pkt->stream_index = 0;
50
53
}
51
54
 
52
55
int av_new_packet(AVPacket *pkt, int size);
 
56
int av_dup_packet(AVPacket *pkt);
53
57
 
54
58
/**
55
59
 * Free a packet
102
106
    int channel; /* used to select dv channel */
103
107
    const char *device; /* video4linux, audio or DV device */
104
108
    const char *standard; /* tv standard, NTSC, PAL, SECAM */
 
109
    int mpeg2ts_raw:1;  /* force raw MPEG2 transport stream output, if possible */
 
110
    int mpeg2ts_compute_pcr:1; /* compute exact PCR for each transport
 
111
                                  stream packet (only meaningful if
 
112
                                  mpeg2ts_raw is TRUE */
 
113
    int initial_pause:1;       /* do not begin to play the stream
 
114
                                  immediately (RTSP only) */
105
115
} AVFormatParameters;
106
116
 
107
117
#define AVFMT_NOFILE        0x0001 /* no file should be opened */
108
118
#define AVFMT_NEEDNUMBER    0x0002 /* needs '%d' in filename */ 
109
 
#define AVFMT_NOHEADER      0x0004 /* signal that no header is present
110
 
                                      (streams are added dynamically) */
111
119
#define AVFMT_SHOW_IDS      0x0008 /* show format stream IDs numbers */
112
120
#define AVFMT_RAWPICTURE    0x0020 /* format wants AVPicture structure for
113
121
                                      raw picture data */
123
131
    enum CodecID audio_codec; /* default audio codec */
124
132
    enum CodecID video_codec; /* default video codec */
125
133
    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);
 
134
    int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
129
135
    int (*write_trailer)(struct AVFormatContext *);
130
136
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */
131
137
    int flags;
150
156
                       AVFormatParameters *ap);
151
157
    /* read one packet and put it in 'pkt'. pts and flags are also
152
158
       set. 'av_new_stream' can be called only if the flag
153
 
       AVFMT_NOHEADER is used. */
 
159
       AVFMTCTX_NOHEADER is used. */
154
160
    int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
155
161
    /* close the stream. The AVFormatContext and AVStreams are not
156
162
       freed by this function */
157
163
    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 */
 
164
    /* seek at or before a given timestamp (given in AV_TIME_BASE
 
165
       units) relative to the frames in stream component stream_index */
 
166
    int (*read_seek)(struct AVFormatContext *, 
 
167
                     int stream_index, int64_t timestamp);
 
168
    /**
 
169
     * gets the next timestamp in AV_TIME_BASE units.
 
170
     */
 
171
    int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
 
172
                              int64_t *pos, int64_t pos_limit);
 
173
    /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */
162
174
    int flags;
163
175
    /* if extensions are defined, then no probe is done. You should
164
176
       usually not use extension format guessing because it is not
166
178
    const char *extensions;
167
179
    /* general purpose read only value that the format can use */
168
180
    int value;
 
181
 
 
182
    /* start/resume playing - only meaningful if using a network based format
 
183
       (RTSP) */
 
184
    int (*read_play)(struct AVFormatContext *);
 
185
 
 
186
    /* pause playing - only meaningful if using a network based format
 
187
       (RTSP) */
 
188
    int (*read_pause)(struct AVFormatContext *);
 
189
 
169
190
    /* private fields */
170
191
    struct AVInputFormat *next;
171
192
} AVInputFormat;
172
193
 
 
194
typedef struct AVIndexEntry {
 
195
    int64_t pos;
 
196
    int64_t timestamp;
 
197
#define AVINDEX_KEYFRAME 0x0001
 
198
/* the following 2 flags indicate that the next/prev keyframe is known, and scaning for it isnt needed */
 
199
    int flags;
 
200
    int min_distance;         /* min distance between this and the previous keyframe, used to avoid unneeded searching */
 
201
} AVIndexEntry;
 
202
 
173
203
typedef struct AVStream {
174
204
    int index;    /* stream index in AVFormatContext */
175
205
    int id;       /* format specific stream id */
178
208
    int r_frame_rate_base;/* real frame rate base of the stream */
179
209
    void *priv_data;
180
210
    /* 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 */
 
211
    int64_t codec_info_duration;     
 
212
    int codec_info_nb_frames;
 
213
    /* encoding: PTS generation when outputing stream */
185
214
    AVFrac pts;
 
215
    AVRational time_base;
 
216
    int pts_wrap_bits; /* number of bits in pts (used for wrapping control) */
186
217
    /* ffmpeg.c private use */
187
218
    int stream_copy; /* if TRUE, just copy stream */
188
219
    /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame
194
225
    /* decoding: duration of the stream, in AV_TIME_BASE fractional
195
226
       seconds. */
196
227
    int64_t duration;
 
228
 
 
229
    /* av_read_frame() support */
 
230
    int need_parsing;
 
231
    struct AVCodecParserContext *parser;
 
232
 
 
233
    int64_t cur_dts;
 
234
    int last_IP_duration;
 
235
    int64_t last_IP_pts;
 
236
    /* av_seek_frame() support */
 
237
    AVIndexEntry *index_entries; /* only used if the format does not
 
238
                                    support seeking natively */
 
239
    int nb_index_entries;
 
240
    int index_entries_allocated_size;
197
241
} AVStream;
198
242
 
 
243
#define AVFMTCTX_NOHEADER      0x0001 /* signal that no header is present
 
244
                                         (streams are added dynamically) */
 
245
 
199
246
#define MAX_STREAMS 20
200
247
 
201
248
/* format I/O context */
202
249
typedef struct AVFormatContext {
 
250
    AVClass *av_class; /* set by av_alloc_format_context */
203
251
    /* can only be iformat or oformat, not both at the same time */
204
252
    struct AVInputFormat *iformat;
205
253
    struct AVOutputFormat *oformat;
209
257
    AVStream *streams[MAX_STREAMS];
210
258
    char filename[1024]; /* input or output filename */
211
259
    /* stream info */
 
260
    int64_t timestamp;
212
261
    char title[512];
213
262
    char author[512];
214
263
    char copyright[512];
218
267
    int track; /* track number, 0 if none */
219
268
    char genre[32]; /* ID3 genre */
220
269
 
221
 
    int flags; /* format specific flags */
 
270
    int ctx_flags; /* format specific flags, see AVFMTCTX_xx */
222
271
    /* 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
272
    /* This buffer is only needed when packets were already buffered but
226
273
       not decoded, for example to get the codec parameters in mpeg
227
274
       streams */
241
288
       available. Never set it directly if the file_size and the
242
289
       duration are known as ffmpeg can compute it automatically. */
243
290
    int bit_rate;
 
291
 
 
292
    /* av_read_frame() support */
 
293
    AVStream *cur_st;
 
294
    const uint8_t *cur_ptr;
 
295
    int cur_len;
 
296
    AVPacket cur_pkt;
 
297
 
 
298
    /* av_seek_frame() support */
 
299
    int64_t data_offset; /* offset of the first packet */
 
300
    int index_built;
244
301
} AVFormatContext;
245
302
 
246
303
typedef struct AVPacketList {
306
363
#endif
307
364
extern AVImageFormat jpeg_image_format;
308
365
extern AVImageFormat gif_image_format;
 
366
extern AVImageFormat sgi_image_format;
309
367
 
310
368
/* XXX: use automatic init with either ELF sections or C file parser */
311
369
/* modules */
364
422
int amr_init(void);
365
423
 
366
424
/* wav.c */
367
 
int wav_init(void);
 
425
int ff_wav_init(void);
368
426
 
369
427
/* raw.c */
 
428
int pcm_read_seek(AVFormatContext *s, 
 
429
                  int stream_index, int64_t timestamp);
370
430
int raw_init(void);
371
431
 
372
432
/* mp3.c */
379
439
int ogg_init(void);
380
440
 
381
441
/* dv.c */
382
 
int dv_init(void);
 
442
int ff_dv_init(void);
383
443
 
384
444
/* ffm.c */
385
445
int ffm_init(void);
406
466
/* wc3movie.c */
407
467
int wc3_init(void);
408
468
 
 
469
/* westwood.c */
 
470
int westwood_init(void);
 
471
 
 
472
/* segafilm.c */
 
473
int film_init(void);
 
474
 
 
475
/* idcin.c */
 
476
int idcin_init(void);
 
477
 
 
478
/* flic.c */
 
479
int flic_init(void);
 
480
 
 
481
/* sierravmd.c */
 
482
int vmd_init(void);
 
483
 
 
484
/* matroska.c */
 
485
int matroska_init(void);
 
486
 
409
487
#include "rtp.h"
410
488
 
411
489
#include "rtsp.h"
421
499
AVOutputFormat *guess_format(const char *short_name, 
422
500
                             const char *filename, const char *mime_type);
423
501
 
424
 
void av_hex_dump(uint8_t *buf, int size);
 
502
void av_hex_dump(FILE *f, uint8_t *buf, int size);
 
503
void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
425
504
 
426
505
void av_register_all(void);
427
506
 
439
518
/* media file input */
440
519
AVInputFormat *av_find_input_format(const char *short_name);
441
520
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
 
521
int av_open_input_stream(AVFormatContext **ic_ptr, 
 
522
                         ByteIOContext *pb, const char *filename, 
 
523
                         AVInputFormat *fmt, AVFormatParameters *ap);
442
524
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, 
443
525
                       AVInputFormat *fmt,
444
526
                       int buf_size,
445
527
                       AVFormatParameters *ap);
 
528
/* no av_open for output, so applications will need this: */
 
529
AVFormatContext *av_alloc_format_context(void);
446
530
 
447
531
#define AVERROR_UNKNOWN     (-1)  /* unknown error */
448
532
#define AVERROR_IO          (-2)  /* i/o error */
450
534
#define AVERROR_INVALIDDATA (-4)  /* invalid data found */
451
535
#define AVERROR_NOMEM       (-5)  /* not enough memory */
452
536
#define AVERROR_NOFMT       (-6)  /* unknown format */
453
 
 
 
537
#define AVERROR_NOTSUPP     (-7)  /* operation not supported */
 
538
 
454
539
int av_find_stream_info(AVFormatContext *ic);
455
540
int av_read_packet(AVFormatContext *s, AVPacket *pkt);
 
541
int av_read_frame(AVFormatContext *s, AVPacket *pkt);
 
542
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp);
 
543
int av_read_play(AVFormatContext *s);
 
544
int av_read_pause(AVFormatContext *s);
456
545
void av_close_input_file(AVFormatContext *s);
457
546
AVStream *av_new_stream(AVFormatContext *s, int id);
458
 
void av_set_pts_info(AVFormatContext *s, int pts_wrap_bits,
 
547
void av_set_pts_info(AVStream *s, int pts_wrap_bits,
459
548
                     int pts_num, int pts_den);
460
549
 
 
550
int av_find_default_stream_index(AVFormatContext *s);
 
551
int av_index_search_timestamp(AVStream *st, int timestamp);
 
552
int av_add_index_entry(AVStream *st,
 
553
                       int64_t pos, int64_t timestamp, int distance, int flags);
 
554
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts);
 
555
 
461
556
/* media file output */
462
557
int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
463
558
int av_write_header(AVFormatContext *s);
464
 
int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf, 
465
 
                   int size);
 
559
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
 
560
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
 
561
 
466
562
int av_write_trailer(AVFormatContext *s);
467
563
 
468
564
void dump_format(AVFormatContext *ic,