~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libavformat/avformat.h

  • Committer: William Grant
  • Date: 2007-02-03 03:16:07 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: william.grant@ubuntu.org.au-20070203031607-08gc2ompbz6spt9i
Update to 1.0rc1.

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_VERSION_INT ((50<<16)+(4<<8)+0)
9
 
#define LIBAVFORMAT_VERSION     50.4.0
 
28
#define LIBAVFORMAT_VERSION_INT ((50<<16)+(6<<8)+0)
 
29
#define LIBAVFORMAT_VERSION     50.6.0
10
30
#define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
11
31
 
12
32
#define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
79
99
   is assumed to be such as 0 <= num < den */
80
100
typedef struct AVFrac {
81
101
    int64_t val, num, den;
82
 
} AVFrac;
83
 
 
84
 
void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den);
85
 
void av_frac_add(AVFrac *f, int64_t incr);
86
 
void av_frac_set(AVFrac *f, int64_t val);
 
102
} AVFrac attribute_deprecated;
87
103
 
88
104
/*************************************************/
89
105
/* input/output formats */
97
113
    int buf_size;
98
114
} AVProbeData;
99
115
 
100
 
#define AVPROBE_SCORE_MAX 100
 
116
#define AVPROBE_SCORE_MAX 100               ///< max score, half of that is used for file extension based detection
101
117
 
102
118
typedef struct AVFormatParameters {
103
119
    AVRational time_base;
116
132
                                  mpeg2ts_raw is TRUE */
117
133
    int initial_pause:1;       /* do not begin to play the stream
118
134
                                  immediately (RTSP only) */
 
135
    int prealloced_context:1;
119
136
    enum CodecID video_codec_id;
120
137
    enum CodecID audio_codec_id;
121
138
} AVFormatParameters;
126
143
#define AVFMT_RAWPICTURE    0x0020 /* format wants AVPicture structure for
127
144
                                      raw picture data */
128
145
#define AVFMT_GLOBALHEADER  0x0040 /* format wants global header */
 
146
#define AVFMT_NOTIMESTAMPS  0x0080 /* format doesnt need / has any timestamps */
129
147
 
130
148
typedef struct AVOutputFormat {
131
149
    const char *name;
265
283
    AVIndexEntry *index_entries; /* only used if the format does not
266
284
                                    support seeking natively */
267
285
    int nb_index_entries;
268
 
    int index_entries_allocated_size;
 
286
    unsigned int index_entries_allocated_size;
269
287
 
270
288
    int64_t nb_frames;                 ///< number of frames in this stream if known or 0
 
289
 
 
290
#define MAX_REORDER_DELAY 4
 
291
    int64_t pts_buffer[MAX_REORDER_DELAY+1];
271
292
} AVStream;
272
293
 
273
294
#define AVFMTCTX_NOHEADER      0x0001 /* signal that no header is present
341
362
 
342
363
    int flags;
343
364
#define AVFMT_FLAG_GENPTS       0x0001 ///< generate pts if missing even if it requires parsing future frames
 
365
#define AVFMT_FLAG_IGNIDX       0x0002 ///< ignore index
 
366
 
 
367
    int loop_input;
 
368
    /* decoding: size of data to probe; encoding unused */
 
369
    unsigned int probesize;
344
370
} AVFormatContext;
345
371
 
346
372
typedef struct AVPacketList {
352
378
extern AVOutputFormat *first_oformat;
353
379
 
354
380
/* still image support */
355
 
struct AVInputImageContext;
356
 
typedef struct AVInputImageContext AVInputImageContext;
 
381
struct AVInputImageContext attribute_deprecated;
 
382
typedef struct AVInputImageContext AVInputImageContext attribute_deprecated;
357
383
 
358
384
typedef struct AVImageInfo {
359
385
    enum PixelFormat pix_fmt; /* requested pixel format */
361
387
    int height; /* requested height */
362
388
    int interleaved; /* image is interleaved (e.g. interleaved GIF) */
363
389
    AVPicture pict; /* returned allocated image */
364
 
} AVImageInfo;
 
390
} AVImageInfo attribute_deprecated;
365
391
 
366
392
/* AVImageFormat.flags field constants */
367
393
#define AVIMAGE_INTERLEAVED 0x0001 /* image format support interleaved output */
382
408
    int (*img_write)(ByteIOContext *, AVImageInfo *);
383
409
    int flags;
384
410
    struct AVImageFormat *next;
385
 
} AVImageFormat;
 
411
} AVImageFormat attribute_deprecated;
386
412
 
387
 
void av_register_image_format(AVImageFormat *img_fmt);
388
 
AVImageFormat *av_probe_image_format(AVProbeData *pd);
389
 
AVImageFormat *guess_image_format(const char *filename);
 
413
void av_register_image_format(AVImageFormat *img_fmt) attribute_deprecated;
 
414
AVImageFormat *av_probe_image_format(AVProbeData *pd) attribute_deprecated;
 
415
AVImageFormat *guess_image_format(const char *filename) attribute_deprecated;
390
416
enum CodecID av_guess_image2_codec(const char *filename);
391
417
int av_read_image(ByteIOContext *pb, const char *filename,
392
418
                  AVImageFormat *fmt,
393
 
                  int (*alloc_cb)(void *, AVImageInfo *info), void *opaque);
394
 
int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img);
395
 
 
396
 
extern AVImageFormat *first_image_format;
397
 
 
398
 
extern AVImageFormat pnm_image_format;
399
 
extern AVImageFormat pbm_image_format;
400
 
extern AVImageFormat pgm_image_format;
401
 
extern AVImageFormat ppm_image_format;
402
 
extern AVImageFormat pam_image_format;
403
 
extern AVImageFormat pgmyuv_image_format;
404
 
extern AVImageFormat yuv_image_format;
405
 
#ifdef CONFIG_ZLIB
406
 
extern AVImageFormat png_image_format;
407
 
#endif
408
 
extern AVImageFormat jpeg_image_format;
409
 
extern AVImageFormat gif_image_format;
410
 
extern AVImageFormat sgi_image_format;
 
419
                  int (*alloc_cb)(void *, AVImageInfo *info), void *opaque) attribute_deprecated;
 
420
int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img) attribute_deprecated;
 
421
 
 
422
extern AVImageFormat *first_image_format attribute_deprecated;
411
423
 
412
424
/* XXX: use automatic init with either ELF sections or C file parser */
413
425
/* modules */
414
426
 
415
 
/* mpeg.c */
416
 
extern AVInputFormat mpegps_demux;
417
 
int mpegps_init(void);
418
 
 
419
 
/* mpegts.c */
420
 
extern AVInputFormat mpegts_demux;
421
 
int mpegts_init(void);
422
 
 
423
 
/* rm.c */
424
 
int rm_init(void);
425
 
 
426
 
/* crc.c */
427
 
int crc_init(void);
428
 
 
429
 
/* img.c */
430
 
int img_init(void);
431
 
 
432
 
/* img2.c */
433
 
int img2_init(void);
434
 
 
435
 
/* asf.c */
436
 
int asf_init(void);
437
 
 
438
 
/* avienc.c */
439
 
int avienc_init(void);
440
 
 
441
 
/* avidec.c */
442
 
int avidec_init(void);
443
 
 
444
 
/* swf.c */
445
 
int swf_init(void);
446
 
 
447
 
/* mov.c */
448
 
int mov_init(void);
449
 
 
450
 
/* movenc.c */
451
 
int movenc_init(void);
452
 
 
453
 
/* flvenc.c */
454
 
int flvenc_init(void);
455
 
 
456
 
/* flvdec.c */
457
 
int flvdec_init(void);
458
 
 
459
 
/* jpeg.c */
460
 
int jpeg_init(void);
461
 
 
462
 
/* gif.c */
463
 
int gif_init(void);
464
 
 
465
 
/* au.c */
466
 
int au_init(void);
467
 
 
468
 
/* amr.c */
469
 
int amr_init(void);
470
 
 
471
 
/* wav.c */
472
 
int ff_wav_init(void);
473
 
 
474
 
/* mmf.c */
475
 
int ff_mmf_init(void);
476
 
 
477
 
/* raw.c */
478
 
int pcm_read_seek(AVFormatContext *s,
479
 
                  int stream_index, int64_t timestamp, int flags);
480
 
int raw_init(void);
481
 
 
482
 
/* mp3.c */
483
 
int mp3_init(void);
484
 
 
485
 
/* yuv4mpeg.c */
486
 
int yuv4mpeg_init(void);
487
 
 
488
 
/* ogg2.c */
489
 
int ogg_init(void);
490
 
 
491
 
/* ogg.c */
492
 
int libogg_init(void);
493
 
 
494
 
/* dv.c */
495
 
int ff_dv_init(void);
496
 
 
497
 
/* ffm.c */
498
 
int ffm_init(void);
499
 
 
500
 
/* rtsp.c */
501
 
extern AVInputFormat redir_demux;
502
 
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f);
503
 
 
504
 
/* 4xm.c */
505
 
int fourxm_init(void);
506
 
 
507
 
/* psxstr.c */
508
 
int str_init(void);
509
 
 
510
 
/* idroq.c */
511
 
int roq_init(void);
512
 
 
513
 
/* ipmovie.c */
514
 
int ipmovie_init(void);
515
 
 
516
 
/* nut.c */
517
 
int nut_init(void);
518
 
 
519
 
/* wc3movie.c */
520
 
int wc3_init(void);
521
 
 
522
 
/* westwood.c */
523
 
int westwood_init(void);
524
 
 
525
 
/* segafilm.c */
526
 
int film_init(void);
527
 
 
528
 
/* idcin.c */
529
 
int idcin_init(void);
530
 
 
531
 
/* flic.c */
532
 
int flic_init(void);
533
 
 
534
 
/* sierravmd.c */
535
 
int vmd_init(void);
536
 
 
537
 
/* matroska.c */
538
 
int matroska_init(void);
539
 
 
540
 
/* sol.c */
541
 
int sol_init(void);
542
 
 
543
 
/* electronicarts.c */
544
 
int ea_init(void);
545
 
 
546
 
/* nsvdec.c */
547
 
int nsvdec_init(void);
548
 
 
549
 
/* daud.c */
550
 
int daud_init(void);
551
 
 
552
 
/* nuv.c */
553
 
int nuv_init(void);
554
 
 
555
 
/* aiff.c */
556
 
int ff_aiff_init(void);
557
 
 
558
 
/* voc.c */
559
 
int voc_init(void);
560
 
 
561
 
/* tta.c */
562
 
int tta_init(void);
563
 
 
564
 
/* adts.c */
565
 
int ff_adts_init(void);
566
 
 
567
 
/* mm.c */
568
 
int mm_init(void);
569
 
 
570
 
/* avs.c */
571
 
int avs_init(void);
572
 
 
573
 
/* smacker.c */
574
 
int smacker_init(void);
575
 
 
576
427
#include "rtp.h"
577
428
 
578
429
#include "rtsp.h"
579
430
 
580
 
/* yuv4mpeg.c */
581
 
extern AVOutputFormat yuv4mpegpipe_oformat;
582
 
 
583
431
/* utils.c */
584
432
void av_register_input_format(AVInputFormat *format);
585
433
void av_register_output_format(AVOutputFormat *format);
595
443
 
596
444
void av_register_all(void);
597
445
 
598
 
typedef struct FifoBuffer {
599
 
    uint8_t *buffer;
600
 
    uint8_t *rptr, *wptr, *end;
601
 
} FifoBuffer;
602
 
 
603
 
int fifo_init(FifoBuffer *f, int size);
604
 
void fifo_free(FifoBuffer *f);
605
 
int fifo_size(FifoBuffer *f, uint8_t *rptr);
606
 
int fifo_read(FifoBuffer *f, uint8_t *buf, int buf_size, uint8_t **rptr_ptr);
607
 
void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr);
608
 
int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr);
609
 
void fifo_realloc(FifoBuffer *f, unsigned int size);
610
 
 
611
446
/* media file input */
612
447
AVInputFormat *av_find_input_format(const char *short_name);
613
448
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
649
484
int av_add_index_entry(AVStream *st,
650
485
                       int64_t pos, int64_t timestamp, int size, int distance, int flags);
651
486
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags);
 
487
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
652
488
 
653
489
/* media file output */
654
490
int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
655
491
int av_write_header(AVFormatContext *s);
656
492
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
657
493
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
 
494
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush);
658
495
 
659
496
int av_write_trailer(AVFormatContext *s);
660
497
 
676
513
 
677
514
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
678
515
 
679
 
int get_frame_filename(char *buf, int buf_size,
680
 
                       const char *path, int number);
681
 
int filename_number_test(const char *filename);
 
516
int av_get_frame_filename(char *buf, int buf_size,
 
517
                          const char *path, int number);
 
518
int av_filename_number_test(const char *filename);
682
519
 
683
520
/* grab specific */
684
521
int video_grab_init(void);