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

« back to all changes in this revision

Viewing changes to src/gfxoutputdrv/ffmpeg/avcodec.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:
12
12
#endif
13
13
 
14
14
#include "common.h"
 
15
#include "rational.h"
 
16
#include <sys/types.h> /* size_t */
15
17
 
16
 
#define FFMPEG_VERSION_INT     0x000408
17
 
#define FFMPEG_VERSION         "0.4.8"
18
 
#define LIBAVCODEC_BUILD       4680
 
18
#define FFMPEG_VERSION_INT     0x000409
 
19
#define FFMPEG_VERSION         "0.4.9-pre1"
 
20
#define LIBAVCODEC_BUILD       4718
19
21
 
20
22
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
21
23
#define LIBAVCODEC_VERSION     FFMPEG_VERSION
24
26
#define AV_TOSTRING(s) #s
25
27
#define LIBAVCODEC_IDENT        "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
26
28
 
 
29
#define AV_NOPTS_VALUE int64_t_C(0x8000000000000000)
 
30
#define AV_TIME_BASE 1000000
 
31
 
27
32
enum CodecID {
28
33
    CODEC_ID_NONE, 
29
34
    CODEC_ID_MPEG1VIDEO,
30
35
    CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */
31
36
    CODEC_ID_MPEG2VIDEO_XVMC,
 
37
    CODEC_ID_H261,
32
38
    CODEC_ID_H263,
33
39
    CODEC_ID_RV10,
 
40
    CODEC_ID_RV20,
34
41
    CODEC_ID_MP2,
35
42
    CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */
36
43
    CODEC_ID_VORBIS,
38
45
    CODEC_ID_MJPEG,
39
46
    CODEC_ID_MJPEGB,
40
47
    CODEC_ID_LJPEG,
 
48
    CODEC_ID_SP5X,
41
49
    CODEC_ID_MPEG4,
42
50
    CODEC_ID_RAWVIDEO,
43
51
    CODEC_ID_MSMPEG4V1,
61
69
    CODEC_ID_H264,
62
70
    CODEC_ID_INDEO3,
63
71
    CODEC_ID_VP3,
 
72
    CODEC_ID_THEORA,
64
73
    CODEC_ID_AAC,
65
74
    CODEC_ID_MPEG4AAC,
66
75
    CODEC_ID_ASV1,
74
83
    CODEC_ID_INTERPLAY_VIDEO,
75
84
    CODEC_ID_XAN_WC3,
76
85
    CODEC_ID_XAN_WC4,
 
86
    CODEC_ID_RPZA,
 
87
    CODEC_ID_CINEPAK,
 
88
    CODEC_ID_WS_VQA,
 
89
    CODEC_ID_MSRLE,
 
90
    CODEC_ID_MSVIDEO1,
 
91
    CODEC_ID_IDCIN,
 
92
    CODEC_ID_8BPS,
 
93
    CODEC_ID_SMC,
 
94
    CODEC_ID_FLIC,
 
95
    CODEC_ID_TRUEMOTION1,
 
96
    CODEC_ID_VMDVIDEO,
 
97
    CODEC_ID_VMDAUDIO,
 
98
    CODEC_ID_MSZH,
 
99
    CODEC_ID_ZLIB,
 
100
    CODEC_ID_QTRLE,
77
101
 
78
102
    /* various pcm "codecs" */
79
103
    CODEC_ID_PCM_S16LE,
90
114
    CODEC_ID_ADPCM_IMA_WAV,
91
115
    CODEC_ID_ADPCM_IMA_DK3,
92
116
    CODEC_ID_ADPCM_IMA_DK4,
 
117
    CODEC_ID_ADPCM_IMA_WS,
 
118
    CODEC_ID_ADPCM_IMA_SMJPEG,
93
119
    CODEC_ID_ADPCM_MS,
94
120
    CODEC_ID_ADPCM_4XM,
 
121
    CODEC_ID_ADPCM_XA,
 
122
    CODEC_ID_ADPCM_ADX,
 
123
    CODEC_ID_ADPCM_EA,
 
124
    CODEC_ID_ADPCM_G726,
95
125
 
96
126
        /* AMR */
97
127
    CODEC_ID_AMR_NB,
 
128
    CODEC_ID_AMR_WB,
 
129
 
98
130
    /* RealAudio codecs*/
99
131
    CODEC_ID_RA_144,
100
132
    CODEC_ID_RA_288,
103
135
    CODEC_ID_ROQ_DPCM,
104
136
    CODEC_ID_INTERPLAY_DPCM,
105
137
    CODEC_ID_XAN_DPCM,
 
138
    
 
139
    CODEC_ID_FLAC,
 
140
    
 
141
    CODEC_ID_MPEG2TS, /* _FAKE_ codec to indicate a raw MPEG2 transport
 
142
                         stream (only used by libavformat) */
106
143
};
107
144
 
108
145
/* CODEC_ID_MP3LAME is absolete */
112
149
    CODEC_TYPE_UNKNOWN = -1,
113
150
    CODEC_TYPE_VIDEO,
114
151
    CODEC_TYPE_AUDIO,
 
152
    CODEC_TYPE_DATA,
115
153
};
116
154
 
117
155
/**
127
165
 * image data is stored in AVFrame.data[0]. The palette is transported in
128
166
 * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
129
167
 * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
130
 
 * also endian-specific).
 
168
 * also endian-specific). Note also that the individual RGB palette
 
169
 * components stored in AVFrame.data[1] should be in the range 0..255.
 
170
 * This is important as many custom PAL8 video codecs that were designed
 
171
 * to run on the IBM VGA graphics adapter use 6-bit palette components.
131
172
 */
132
173
enum PixelFormat {
133
174
    PIX_FMT_YUV420P,   ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
190
231
/* only for ME compatiblity with old apps */
191
232
extern int motion_estimation_method;
192
233
 
193
 
/* ME algos sorted by quality */
194
 
static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG, 
195
 
                                       ME_X1, ME_EPZS, ME_FULL };
196
 
 
197
 
 
198
234
#define FF_MAX_B_FRAMES 8
199
235
 
200
236
/* encoding support
203
239
*/
204
240
 
205
241
#define CODEC_FLAG_QSCALE 0x0002  ///< use fixed qscale 
206
 
#define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed 
 
242
#define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed / Advanced prediction for H263
207
243
#define CODEC_FLAG_QPEL   0x0010  ///< use qpel MC 
208
244
#define CODEC_FLAG_GMC    0x0020  ///< use GMC 
 
245
#define CODEC_FLAG_MV0    0x0040  ///< always try a MB with MV=<0,0> 
209
246
#define CODEC_FLAG_PART   0x0080  ///< use data partitioning 
210
247
/* parent program gurantees that the input for b-frame containing streams is not written to 
211
248
   for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
226
263
#define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< place global headers in extradata instead of every keyframe 
227
264
#define CODEC_FLAG_BITEXACT       0x00800000 ///< use only bitexact stuff (except (i)dct) 
228
265
/* Fx : Flag for h263+ extra options */
229
 
#define CODEC_FLAG_H263P_AIC      0x01000000 ///< Advanced intra coding 
 
266
#define CODEC_FLAG_H263P_AIC      0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this)
 
267
#define CODEC_FLAG_AC_PRED        0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction
230
268
#define CODEC_FLAG_H263P_UMV      0x02000000 ///< Unlimited motion vector  
231
 
/* For advanced prediction mode, we reuse the 4MV flag */
 
269
#define CODEC_FLAG_CBP_RD         0x04000000 ///< use rate distortion optimization for cbp
 
270
#define CODEC_FLAG_QP_RD          0x08000000 ///< use rate distortion optimization for qp selectioon
 
271
#define CODEC_FLAG_H263P_AIV      0x00000008 ///< H263 Alternative inter vlc
 
272
#define CODEC_FLAG_OBMC           0x00000001 ///< OBMC
 
273
#define CODEC_FLAG_LOOP_FILTER    0x00000800 ///< loop filter
 
274
#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
 
275
#define CODEC_FLAG_INTERLACED_ME  0x20000000 ///< interlaced motion estimation
 
276
#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< will reserve space for SVCD scan offset user data
 
277
#define CODEC_FLAG_CLOSED_GOP     0x80000000
232
278
/* Unsupported options :
233
279
 *              Syntax Arithmetic coding (SAC)
234
 
 *              Deblocking filter internal loop
235
 
 *              Slice structured
236
280
 *              Reference Picture Selection
237
 
 *              Independant Segment Decoding
238
 
 *              Alternative Inter *             VLC
239
 
 *              Modified Quantization */
 
281
 *              Independant Segment Decoding */
240
282
/* /Fx */
241
283
/* codec capabilities */
242
284
 
250
292
   used */
251
293
#define CODEC_CAP_PARSE_ONLY      0x0004
252
294
#define CODEC_CAP_TRUNCATED       0x0008
 
295
/* codec can export data for HW decoding (XvMC) */
 
296
#define CODEC_CAP_HWACCEL         0x0010
 
297
/** codec has a non zero delay and needs to be feeded with NULL at the end to get the delayed data */
 
298
#define CODEC_CAP_DELAY           0x0020
 
299
 
 
300
//the following defines might change, so dont expect compatibility if u use them
 
301
#define MB_TYPE_INTRA4x4   0x0001
 
302
#define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific
 
303
#define MB_TYPE_INTRA_PCM  0x0004 //FIXME h264 specific
 
304
#define MB_TYPE_16x16      0x0008
 
305
#define MB_TYPE_16x8       0x0010
 
306
#define MB_TYPE_8x16       0x0020
 
307
#define MB_TYPE_8x8        0x0040
 
308
#define MB_TYPE_INTERLACED 0x0080
 
309
#define MB_TYPE_DIRECT2     0x0100 //FIXME
 
310
#define MB_TYPE_ACPRED     0x0200
 
311
#define MB_TYPE_GMC        0x0400
 
312
#define MB_TYPE_SKIP       0x0800
 
313
#define MB_TYPE_P0L0       0x1000
 
314
#define MB_TYPE_P1L0       0x2000
 
315
#define MB_TYPE_P0L1       0x4000
 
316
#define MB_TYPE_P1L1       0x8000
 
317
#define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)
 
318
#define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)
 
319
#define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)
 
320
#define MB_TYPE_QUANT      0x00010000
 
321
#define MB_TYPE_CBP        0x00020000
 
322
//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
 
323
 
 
324
/**
 
325
 * Pan Scan area.
 
326
 * this specifies the area which should be displayed. Note there may be multiple such areas for one frame
 
327
 */
 
328
typedef struct AVPanScan{
 
329
    /**
 
330
     * id.
 
331
     * - encoding: set by user.
 
332
     * - decoding: set by lavc
 
333
     */
 
334
    int id;
 
335
 
 
336
    /**
 
337
     * width and height in 1/16 pel
 
338
     * - encoding: set by user.
 
339
     * - decoding: set by lavc
 
340
     */
 
341
    int width;
 
342
    int height;
 
343
 
 
344
    /**
 
345
     * position of the top left corner in 1/16 pel for up to 3 fields/frames.
 
346
     * - encoding: set by user.
 
347
     * - decoding: set by lavc
 
348
     */
 
349
    int16_t position[3][2];
 
350
}AVPanScan;
253
351
 
254
352
#define FF_COMMON_FRAME \
255
353
    /**\
282
380
    int pict_type;\
283
381
\
284
382
    /**\
285
 
     * presentation timestamp in micro seconds (time when frame should be shown to user)\
286
 
     * if 0 then the frame_rate will be used as reference\
 
383
     * presentation timestamp in AV_TIME_BASE (=micro seconds currently) (time when frame should be shown to user)\
 
384
     * if AV_NOPTS_VALUE then the frame_rate will be used as reference\
287
385
     * - encoding: MUST be set by user\
288
386
     * - decoding: set by lavc\
289
387
     */\
303
401
    int display_picture_number;\
304
402
\
305
403
    /**\
306
 
     * quality (between 1 (good) and 31 (bad)) \
 
404
     * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
307
405
     * - encoding: set by lavc for coded_picture (and set by user for input)\
308
406
     * - decoding: set by lavc\
309
407
     */\
310
 
    float quality; \
 
408
    int quality; \
311
409
\
312
410
    /**\
313
411
     * buffer age (1->was last buffer and dint change, 2->..., ...).\
314
 
     * set to something large if the buffer has not been used yet \
 
412
     * set to INT_MAX if the buffer has not been used yet \
315
413
     * - encoding: unused\
316
414
     * - decoding: MUST be set by get_buffer()\
317
415
     */\
346
444
    uint8_t *mbskip_table;\
347
445
\
348
446
    /**\
 
447
     * Motion vector table\
 
448
     * - encoding: set by user\
 
449
     * - decoding: set by lavc\
 
450
     */\
 
451
    int16_t (*motion_val[2])[2];\
 
452
\
 
453
    /**\
 
454
     * Macroblock type table\
 
455
     * mb_type_base + mb_width + 2\
 
456
     * - encoding: set by user\
 
457
     * - decoding: set by lavc\
 
458
     */\
 
459
    uint32_t *mb_type;\
 
460
\
 
461
    /**\
 
462
     * Macroblock size: (0->16x16, 1->8x8, 2-> 4x4, 3-> 2x2)\
 
463
     * - encoding: unused\
 
464
     * - decoding: set by lavc\
 
465
     */\
 
466
    uint8_t motion_subsample_log2;\
 
467
\
 
468
    /**\
349
469
     * for some private data of the user\
350
470
     * - encoding: unused\
351
471
     * - decoding: set by user\
379
499
     * \
380
500
     */\
381
501
    int qscale_type;\
 
502
    \
 
503
    /**\
 
504
     * The content of the picture is interlaced.\
 
505
     * - encoding: set by user\
 
506
     * - decoding: set by lavc (default 0)\
 
507
     */\
 
508
    int interlaced_frame;\
 
509
    \
 
510
    /**\
 
511
     * if the content is interlaced, is top field displayed first.\
 
512
     * - encoding: set by user\
 
513
     * - decoding: set by lavc\
 
514
     */\
 
515
    int top_field_first;\
 
516
    \
 
517
    /**\
 
518
     * Pan scan.\
 
519
     * - encoding: set by user\
 
520
     * - decoding: set by lavc\
 
521
     */\
 
522
    AVPanScan *pan_scan;\
 
523
    \
 
524
    /**\
 
525
     * tell user application that palette has changed from previous frame.\
 
526
     * - encoding: ??? (no palette-enabled encoder yet)\
 
527
     * - decoding: set by lavc (default 0)\
 
528
     */\
 
529
    int palette_has_changed;\
 
530
    \
 
531
    /**\
 
532
     * Codec suggestion on buffer type if != 0\
 
533
     * - encoding: unused\
 
534
     * - decoding: set by lavc (before get_buffer() call))\
 
535
     */\
 
536
    int buffer_hints;\
 
537
\
 
538
    /**\
 
539
     * DCT coeffitients\
 
540
     * - encoding: unused\
 
541
     * - decoding: set by lavc\
 
542
     */\
 
543
    short *dct_coeff;\
 
544
\
 
545
    /**\
 
546
     * Motion referece frame index\
 
547
     * - encoding: set by user\
 
548
     * - decoding: set by lavc\
 
549
     */\
 
550
    int8_t *ref_index[2];
382
551
 
383
552
#define FF_QSCALE_TYPE_MPEG1    0
384
553
#define FF_QSCALE_TYPE_MPEG2    1
385
554
 
386
555
#define FF_BUFFER_TYPE_INTERNAL 1
387
556
#define FF_BUFFER_TYPE_USER     2 ///< Direct rendering buffers (image is (de)allocated by user)
388
 
#define FF_BUFFER_TYPE_SHARED   4 ///< buffer from somewher else, dont dealloc image (data/base)
 
557
#define FF_BUFFER_TYPE_SHARED   4 ///< buffer from somewher else, dont dealloc image (data/base), all other tables are not shared
389
558
#define FF_BUFFER_TYPE_COPY     8 ///< just a (modified) copy of some other buffer, dont dealloc anything
390
559
 
391
560
 
396
565
#define FF_SI_TYPE 5
397
566
#define FF_SP_TYPE 6
398
567
 
 
568
#define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore)
 
569
#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer
 
570
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content
 
571
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update)
 
572
 
399
573
/**
400
574
 * Audio Video Frame.
401
575
 */
406
580
#define DEFAULT_FRAME_RATE_BASE 1001000
407
581
 
408
582
/**
 
583
 * Used by av_log
 
584
 */
 
585
typedef struct AVCLASS AVClass;
 
586
struct AVCLASS {
 
587
    const char* class_name;
 
588
    const char* (*item_name)(void*); /* actually passing a pointer to an AVCodecContext
 
589
                                        or AVFormatContext, which begin with an AVClass.
 
590
                                        Needed because av_log is in libavcodec and has no visibility
 
591
                                        of AVIn/OutputFormat */
 
592
};
 
593
 
 
594
/**
409
595
 * main external api structure.
410
596
 */
411
597
typedef struct AVCodecContext {
412
598
    /**
 
599
     * Info on struct for av_log
 
600
     * - set by avcodec_alloc_context
 
601
     */
 
602
    AVClass *av_class;
 
603
    /**
413
604
     * the average bitrate.
414
605
     * - encoding: set by user. unused for constant quantizer encoding
415
606
     * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream 
469
660
    /**
470
661
     * width / height.
471
662
     * - encoding: MUST be set by user. 
472
 
     * - decoding: set by user, some codecs might override / change it during playback
 
663
     * - decoding: set by user if known, codec should override / dynamically change if needed
473
664
     */
474
665
    int width, height;
475
666
    
476
 
#define FF_ASPECT_SQUARE 1
477
 
#define FF_ASPECT_4_3_625 2
478
 
#define FF_ASPECT_4_3_525 3
479
 
#define FF_ASPECT_16_9_625 4
480
 
#define FF_ASPECT_16_9_525 5
481
667
#define FF_ASPECT_EXTENDED 15
482
668
 
483
669
    /**
518
704
     * @param offset offset into the AVFrame.data from which the slice should be read
519
705
     */
520
706
    void (*draw_horiz_band)(struct AVCodecContext *s,
521
 
                            AVFrame *src, int offset[4],
 
707
                            const AVFrame *src, int offset[4],
522
708
                            int y, int type, int height);
523
709
 
524
710
    /* audio only */
594
780
    
595
781
    void *priv_data;
596
782
 
597
 
    /* The following data is for RTP friendly coding */
598
 
    /* By now only H.263/H.263+/MPEG4 coder honours this   */
599
 
    int rtp_mode;   /* 1 for activate RTP friendly-mode           */
600
 
                    /* highers numbers represent more error-prone */
601
 
                    /* enviroments, by now just "1" exist         */
 
783
    /* unused, FIXME remove*/
 
784
    int rtp_mode;
602
785
    
603
786
    int rtp_payload_size;   /* The size of the RTP payload, the coder will  */
604
787
                            /* do it's best to deliver a chunk with size    */
612
795
    /* every time the encoder as a packet to send */
613
796
    /* Depends on the encoder if the data starts  */
614
797
    /* with a Start Code (it should) H.263 does   */
615
 
    void (*rtp_callback)(void *data, int size, int packet_number); 
 
798
    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int packet_number); 
616
799
 
617
800
    /* statistics, used for 2-pass encoding */
618
801
    int mv_bits;
661
844
#define FF_BUG_XVID_ILACE       4
662
845
#define FF_BUG_UMP4             8
663
846
#define FF_BUG_NO_PADDING       16
664
 
#define FF_BUG_AC_VLC           32
 
847
#define FF_BUG_AMV              32
 
848
#define FF_BUG_AC_VLC           0  ///< will be removed, libavcodec can now handle these non compliant files by default
665
849
#define FF_BUG_QPEL_CHROMA      64
666
850
#define FF_BUG_STD_QPEL         128
667
851
#define FF_BUG_QPEL_CHROMA2     256
668
852
#define FF_BUG_DIRECT_BLOCKSIZE 512
669
853
#define FF_BUG_EDGE             1024
 
854
#define FF_BUG_HPEL_CHROMA      2048
 
855
#define FF_BUG_DC_CLIP          4096
670
856
//#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
671
857
        
672
858
    /**
714
900
    /**
715
901
     * called at the beginning of each frame to get a buffer for it.
716
902
     * if pic.reference is set then the frame will be read later by lavc
717
 
     * width and height should be rounded up to the next multiple of 16
 
903
     * avcodec_align_dimensions() should be used to find the required width and
 
904
     * height, as they normally need to be rounded up to the next multiple of 16
718
905
     * - encoding: unused
719
906
     * - decoding: set by lavc, user can override
720
907
     */
730
917
    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
731
918
 
732
919
    /**
733
 
     * is 1 if the decoded stream contains b frames, 0 otherwise.
734
 
     * - encoding: unused
 
920
     * if 1 the stream has a 1 frame delay during decoding.
 
921
     * - encoding: set by lavc
735
922
     * - decoding: set by lavc
736
923
     */
737
924
    int has_b_frames;
814
1001
 
815
1002
    /**
816
1003
     * qscale factor between p and i frames.
 
1004
     * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
 
1005
     * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
817
1006
     * - encoding: set by user.
818
1007
     * - decoding: unused
819
1008
     */
821
1010
    
822
1011
    /**
823
1012
     * qscale offset between p and i frames.
824
 
     * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
825
 
     * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
826
1013
     * - encoding: set by user.
827
1014
     * - decoding: unused
828
1015
     */
847
1034
#define FF_DCT_MMX     3
848
1035
#define FF_DCT_MLIB    4
849
1036
#define FF_DCT_ALTIVEC 5
 
1037
#define FF_DCT_FAAN    6
850
1038
    
851
1039
    /**
852
1040
     * luminance masking (0-> disabled).
964
1152
#define FF_PRED_MEDIAN 2
965
1153
    
966
1154
    /**
967
 
     * aspect ratio (0 if unknown).
 
1155
     * sample aspect ratio (0 if unknown).
 
1156
     * numerator and denominator must be relative prime and smaller then 256 for some video standards
968
1157
     * - encoding: set by user.
969
1158
     * - decoding: set by lavc.
970
1159
     */
971
 
    float aspect_ratio;
 
1160
    AVRational sample_aspect_ratio;
972
1161
 
973
1162
    /**
974
1163
     * the picture in the bitstream.
989
1178
#define FF_DEBUG_MB_TYPE   8
990
1179
#define FF_DEBUG_QP        16
991
1180
#define FF_DEBUG_MV        32
992
 
#define FF_DEBUG_VIS_MV    0x00000040
 
1181
#define FF_DEBUG_DCT_COEFF 0x00000040
993
1182
#define FF_DEBUG_SKIP      0x00000080
994
1183
#define FF_DEBUG_STARTCODE 0x00000100
995
1184
#define FF_DEBUG_PTS       0x00000200
996
1185
#define FF_DEBUG_ER        0x00000400
997
1186
#define FF_DEBUG_MMCO      0x00000800
998
1187
#define FF_DEBUG_BUGS      0x00001000
 
1188
#define FF_DEBUG_VIS_QP    0x00002000
 
1189
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
999
1190
    
1000
1191
    /**
 
1192
     * debug.
 
1193
     * - encoding: set by user.
 
1194
     * - decoding: set by user.
 
1195
     */
 
1196
    int debug_mv;
 
1197
#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
 
1198
#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
 
1199
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
 
1200
 
 
1201
    /**
1001
1202
     * error.
1002
1203
     * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
1003
1204
     * - decoding: unused
1036
1237
     * - decoding: unused
1037
1238
     */
1038
1239
    int mb_cmp;
 
1240
    /**
 
1241
     * interlaced dct compare function
 
1242
     * - encoding: set by user.
 
1243
     * - decoding: unused
 
1244
     */
 
1245
    int ildct_cmp;
1039
1246
#define FF_CMP_SAD  0
1040
1247
#define FF_CMP_SSE  1
1041
1248
#define FF_CMP_SATD 2
1044
1251
#define FF_CMP_BIT  5
1045
1252
#define FF_CMP_RD   6
1046
1253
#define FF_CMP_ZERO 7
 
1254
#define FF_CMP_VSAD 8
 
1255
#define FF_CMP_VSSE 9
 
1256
#define FF_CMP_NSSE 10
1047
1257
#define FF_CMP_CHROMA 256
1048
1258
    
1049
1259
    /**
1097
1307
     * - encoding: unused
1098
1308
     * - decoding: set by user, if not set then the native format will always be choosen
1099
1309
     */
1100
 
    enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
 
1310
    enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
1101
1311
 
1102
1312
    /**
1103
1313
     * DTG active format information (additionnal aspect ratio
1168
1378
     * Dont touch, used by lavc default_get_buffer()
1169
1379
     */
1170
1380
    void *internal_buffer;
1171
 
    
1172
 
#define FF_QUALITY_SCALE 256
 
1381
 
 
1382
#define FF_LAMBDA_SHIFT 7
 
1383
#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
 
1384
#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
 
1385
#define FF_LAMBDA_MAX (256*128-1)
 
1386
 
 
1387
#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
1173
1388
    /**
1174
1389
     * global quality for codecs which cannot change it per frame.
1175
1390
     * this should be proportional to MPEG1/2/4 qscale.
1250
1465
     * - decoding: unused
1251
1466
     */
1252
1467
    int scenechange_threshold;
 
1468
 
 
1469
    /**
 
1470
     * minimum lagrange multipler
 
1471
     * - encoding: set by user.
 
1472
     * - decoding: unused
 
1473
     */
 
1474
    int lmin;
 
1475
 
 
1476
    /**
 
1477
     * maximum lagrange multipler
 
1478
     * - encoding: set by user.
 
1479
     * - decoding: unused
 
1480
     */
 
1481
    int lmax;
 
1482
 
 
1483
    /**
 
1484
     * Palette control structure
 
1485
     * - encoding: ??? (no palette-enabled encoder yet)
 
1486
     * - decoding: set by user.
 
1487
     */
 
1488
    struct AVPaletteControl *palctrl;
 
1489
 
 
1490
    /**
 
1491
     * noise reduction strength
 
1492
     * - encoding: set by user.
 
1493
     * - decoding: unused
 
1494
     */
 
1495
    int noise_reduction;
 
1496
    
 
1497
    /**
 
1498
     * called at the beginning of a frame to get cr buffer for it.
 
1499
     * buffer type (size, hints) must be the same. lavc won't check it.
 
1500
     * lavc will pass previous buffer in pic, function should return
 
1501
     * same buffer or new buffer with old frame "painted" into it.
 
1502
     * if pic.data[0] == NULL must behave like get_buffer().
 
1503
     * - encoding: unused
 
1504
     * - decoding: set by lavc, user can override
 
1505
     */
 
1506
    int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
 
1507
 
 
1508
    /**
 
1509
     * number of bits which should be loaded into the rc buffer before decoding starts
 
1510
     * - encoding: set by user.
 
1511
     * - decoding: unused
 
1512
     */
 
1513
    int rc_initial_buffer_occupancy;
 
1514
 
 
1515
    /**
 
1516
     *
 
1517
     * - encoding: set by user.
 
1518
     * - decoding: unused
 
1519
     */
 
1520
    int inter_threshold;
 
1521
 
 
1522
    /**
 
1523
     * CODEC_FLAG2_*.
 
1524
     * - encoding: set by user.
 
1525
     * - decoding: set by user.
 
1526
     */
 
1527
    int flags2;
 
1528
 
 
1529
    /**
 
1530
     * simulates errors in the bitstream to test error concealment.
 
1531
     * - encoding: set by user.
 
1532
     * - decoding: unused.
 
1533
     */
 
1534
    int error_rate;
 
1535
    
 
1536
    /**
 
1537
     * MP3 antialias algorithm, see FF_AA_* below.
 
1538
     * - encoding: unused
 
1539
     * - decoding: set by user
 
1540
     */
 
1541
    int antialias_algo;
 
1542
#define FF_AA_AUTO    0
 
1543
#define FF_AA_FASTINT 1 //not implemented yet
 
1544
#define FF_AA_INT     2
 
1545
#define FF_AA_FLOAT   3
 
1546
    /**
 
1547
     * Quantizer noise shaping.
 
1548
     * - encoding: set by user
 
1549
     * - decoding: unused
 
1550
     */
 
1551
    int quantizer_noise_shaping;
 
1552
 
 
1553
    /**
 
1554
     * Thread count.
 
1555
     * is used to decide how many independant tasks should be passed to execute()
 
1556
     * - encoding: set by user
 
1557
     * - decoding: set by user
 
1558
     */
 
1559
    int thread_count;
 
1560
    
 
1561
    /**
 
1562
     * the codec may call this to execute several independant things. it will return only after
 
1563
     * finishing all tasks, the user may replace this with some multithreaded implementation, the
 
1564
     * default implementation will execute the parts serially
 
1565
     * @param count the number of things to execute
 
1566
     * - encoding: set by lavc, user can override
 
1567
     * - decoding: set by lavc, user can override
 
1568
     */
 
1569
    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count);
 
1570
    
 
1571
    /**
 
1572
     * Thread opaque.
 
1573
     * can be used by execute() to store some per AVCodecContext stuff.
 
1574
     * - encoding: set by execute()
 
1575
     * - decoding: set by execute()
 
1576
     */
 
1577
    void *thread_opaque;
 
1578
 
 
1579
    /**
 
1580
     * Motion estimation threshold. under which no motion estimation is 
 
1581
     * performed, but instead the user specified motion vectors are used
 
1582
     * 
 
1583
     * - encoding: set by user
 
1584
     * - decoding: unused
 
1585
     */
 
1586
     int me_threshold;
 
1587
 
 
1588
    /**
 
1589
     * Macroblock threshold. under which the user specified macroblock types will be used
 
1590
     * - encoding: set by user
 
1591
     * - decoding: unused
 
1592
     */
 
1593
     int mb_threshold;
 
1594
 
 
1595
    /**
 
1596
     * precision of the intra dc coefficient - 8.
 
1597
     * - encoding: set by user
 
1598
     * - decoding: unused
 
1599
     */
 
1600
     int intra_dc_precision;
 
1601
 
 
1602
    /**
 
1603
     * noise vs. sse weight for the nsse comparsion function.
 
1604
     * - encoding: set by user
 
1605
     * - decoding: unused
 
1606
     */
 
1607
     int nsse_weight;
 
1608
 
 
1609
    /**
 
1610
     * number of macroblock rows at the top which are skiped.
 
1611
     * - encoding: unused
 
1612
     * - decoding: set by user
 
1613
     */
 
1614
     int skip_top;
 
1615
 
 
1616
    /**
 
1617
     * number of macroblock rows at the bottom which are skiped.
 
1618
     * - encoding: unused
 
1619
     * - decoding: set by user
 
1620
     */
 
1621
     int skip_bottom;
1253
1622
} AVCodecContext;
1254
1623
 
1255
1624
 
1314
1683
    const AVOption *options;
1315
1684
    struct AVCodec *next;
1316
1685
    void (*flush)(AVCodecContext *);
 
1686
    const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0}
 
1687
    const enum PixelFormat *pix_fmts;       ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1
1317
1688
} AVCodec;
1318
1689
 
1319
1690
/**
1330
1701
 * This structure defines a method for communicating palette changes
1331
1702
 * between and demuxer and a decoder.
1332
1703
 */
 
1704
#define AVPALETTE_SIZE 1024
 
1705
#define AVPALETTE_COUNT 256
1333
1706
typedef struct AVPaletteControl {
1334
1707
 
1335
1708
    /* demuxer sets this to 1 to indicate the palette has changed;
1336
1709
     * decoder resets to 0 */
1337
1710
    int palette_changed;
1338
1711
 
1339
 
    /* 256 3-byte RGB palette entries; the components should be
1340
 
     * formatted in the buffer as "RGBRGB..." and should be scaled to
1341
 
     * 8 bits if they originally represented 6-bit VGA palette
1342
 
     * components */
1343
 
    unsigned char palette[256 * 3];
 
1712
    /* 4-byte ARGB palette entries, stored in native byte order; note that
 
1713
     * the individual palette components should be on a 8-bit scale; if
 
1714
     * the palette data comes from a IBM VGA native format, the component
 
1715
     * data is probably 6 bits in size and needs to be scaled */
 
1716
    unsigned int palette[AVPALETTE_COUNT];
1344
1717
 
1345
1718
} AVPaletteControl;
1346
1719
 
1348
1721
extern AVCodec mp2_encoder;
1349
1722
extern AVCodec mp3lame_encoder;
1350
1723
extern AVCodec oggvorbis_encoder;
 
1724
extern AVCodec faac_encoder;
1351
1725
extern AVCodec mpeg1video_encoder;
1352
1726
extern AVCodec mpeg2video_encoder;
1353
1727
extern AVCodec h263_encoder;
1354
1728
extern AVCodec h263p_encoder;
1355
1729
extern AVCodec flv_encoder;
1356
1730
extern AVCodec rv10_encoder;
 
1731
extern AVCodec rv20_encoder;
 
1732
extern AVCodec dvvideo_encoder;
1357
1733
extern AVCodec mjpeg_encoder;
1358
1734
extern AVCodec ljpeg_encoder;
1359
1735
extern AVCodec mpeg4_encoder;
1369
1745
extern AVCodec vcr1_encoder;
1370
1746
extern AVCodec ffv1_encoder;
1371
1747
extern AVCodec mdec_encoder;
 
1748
extern AVCodec zlib_encoder;
 
1749
extern AVCodec svq1_encoder;
1372
1750
 
1373
1751
extern AVCodec h263_decoder;
 
1752
extern AVCodec h261_decoder;
1374
1753
extern AVCodec mpeg4_decoder;
1375
1754
extern AVCodec msmpeg4v1_decoder;
1376
1755
extern AVCodec msmpeg4v2_decoder;
1379
1758
extern AVCodec wmv2_decoder;
1380
1759
extern AVCodec mpeg1video_decoder;
1381
1760
extern AVCodec mpeg2video_decoder;
 
1761
extern AVCodec mpegvideo_decoder;
1382
1762
extern AVCodec mpeg_xvmc_decoder;
1383
1763
extern AVCodec h263i_decoder;
1384
1764
extern AVCodec flv_decoder;
1385
1765
extern AVCodec rv10_decoder;
 
1766
extern AVCodec rv20_decoder;
1386
1767
extern AVCodec svq1_decoder;
1387
1768
extern AVCodec svq3_decoder;
1388
1769
extern AVCodec dvvideo_decoder;
1389
 
extern AVCodec dvaudio_decoder;
1390
1770
extern AVCodec wmav1_decoder;
1391
1771
extern AVCodec wmav2_decoder;
1392
1772
extern AVCodec mjpeg_decoder;
1393
1773
extern AVCodec mjpegb_decoder;
 
1774
extern AVCodec sp5x_decoder;
1394
1775
extern AVCodec mp2_decoder;
1395
1776
extern AVCodec mp3_decoder;
1396
1777
extern AVCodec mace3_decoder;
1401
1782
extern AVCodec h264_decoder;
1402
1783
extern AVCodec indeo3_decoder;
1403
1784
extern AVCodec vp3_decoder;
 
1785
extern AVCodec theora_decoder;
1404
1786
extern AVCodec amr_nb_decoder;
1405
1787
extern AVCodec amr_nb_encoder;
 
1788
extern AVCodec amr_wb_encoder;
 
1789
extern AVCodec amr_wb_decoder;
1406
1790
extern AVCodec aac_decoder;
1407
1791
extern AVCodec mpeg4aac_decoder;
1408
1792
extern AVCodec asv1_decoder;
1415
1799
extern AVCodec roq_decoder;
1416
1800
extern AVCodec interplay_video_decoder;
1417
1801
extern AVCodec xan_wc3_decoder;
 
1802
extern AVCodec rpza_decoder;
 
1803
extern AVCodec cinepak_decoder;
 
1804
extern AVCodec msrle_decoder;
 
1805
extern AVCodec msvideo1_decoder;
 
1806
extern AVCodec vqa_decoder;
 
1807
extern AVCodec idcin_decoder;
 
1808
extern AVCodec eightbps_decoder;
 
1809
extern AVCodec smc_decoder;
 
1810
extern AVCodec flic_decoder;
 
1811
extern AVCodec vmdvideo_decoder;
 
1812
extern AVCodec vmdaudio_decoder;
 
1813
extern AVCodec truemotion1_decoder;
 
1814
extern AVCodec mszh_decoder;
 
1815
extern AVCodec zlib_decoder;
1418
1816
extern AVCodec ra_144_decoder;
1419
1817
extern AVCodec ra_288_decoder;
1420
1818
extern AVCodec roq_dpcm_decoder;
1421
1819
extern AVCodec interplay_dpcm_decoder;
1422
1820
extern AVCodec xan_dpcm_decoder;
 
1821
extern AVCodec qtrle_decoder;
 
1822
extern AVCodec flac_decoder;
1423
1823
 
1424
1824
/* pcm codecs */
1425
1825
#define PCM_CODEC(id, name) \
1441
1841
PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
1442
1842
PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
1443
1843
PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
 
1844
PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
 
1845
PCM_CODEC(CODEC_ID_ADPCM_SMJPEG, adpcm_ima_smjpeg);
1444
1846
PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
1445
1847
PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm);
 
1848
PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa);
 
1849
PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
 
1850
PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea);
 
1851
PCM_CODEC(CODEC_ID_ADPCM_G726, adpcm_g726);
1446
1852
 
1447
1853
#undef PCM_CODEC
1448
1854
 
1456
1862
/* resample.c */
1457
1863
 
1458
1864
struct ReSampleContext;
 
1865
struct AVResampleContext;
1459
1866
 
1460
1867
typedef struct ReSampleContext ReSampleContext;
1461
1868
 
1464
1871
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
1465
1872
void audio_resample_close(ReSampleContext *s);
1466
1873
 
 
1874
struct AVResampleContext *av_resample_init(int out_rate, int in_rate);
 
1875
int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
 
1876
void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
 
1877
void av_resample_close(struct AVResampleContext *c);
 
1878
 
1467
1879
/* YUV420 format is assumed ! */
1468
1880
 
1469
1881
struct ImgReSampleContext;
1476
1888
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
1477
1889
                                      int iwidth, int iheight,
1478
1890
                                      int topBand, int bottomBand,
1479
 
                                      int leftBand, int rightBand);
 
1891
                                      int leftBand, int rightBand,
 
1892
                                      int padtop, int padbottom,
 
1893
                                      int padleft, int padright);
 
1894
 
1480
1895
 
1481
1896
void img_resample(ImgReSampleContext *s, 
1482
 
                  AVPicture *output, AVPicture *input);
 
1897
                  AVPicture *output, const AVPicture *input);
1483
1898
 
1484
1899
void img_resample_close(ImgReSampleContext *s);
1485
1900
 
 
1901
/**
 
1902
 * Allocate memory for a picture.  Call avpicture_free to free it.
 
1903
 *
 
1904
 * @param picture the picture to be filled in.
 
1905
 * @param pix_fmt the format of the picture.
 
1906
 * @param width the width of the picture.
 
1907
 * @param height the height of the picture.
 
1908
 * @return 0 if successful, -1 if not.
 
1909
 */
 
1910
int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
 
1911
 
 
1912
/* Free a picture previously allocated by avpicture_alloc. */
 
1913
void avpicture_free(AVPicture *picture);
 
1914
 
1486
1915
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
1487
1916
                   int pix_fmt, int width, int height);
1488
 
int avpicture_layout(AVPicture* src, int pix_fmt, int width, int height,
 
1917
int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
1489
1918
                     unsigned char *dest, int dest_size);
1490
1919
int avpicture_get_size(int pix_fmt, int width, int height);
1491
1920
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
1506
1935
 
1507
1936
#define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
1508
1937
#define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
1509
 
int img_get_alpha_info(AVPicture *src, int pix_fmt, int width, int height);
 
1938
int img_get_alpha_info(const AVPicture *src,
 
1939
                       int pix_fmt, int width, int height);
1510
1940
 
1511
1941
/* convert among pixel formats */
1512
1942
int img_convert(AVPicture *dst, int dst_pix_fmt,
1513
 
                AVPicture *src, int pix_fmt, 
 
1943
                const AVPicture *src, int pix_fmt, 
1514
1944
                int width, int height);
1515
1945
 
1516
1946
/* deinterlace a picture */
1517
 
int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
 
1947
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
1518
1948
                          int pix_fmt, int width, int height);
1519
1949
 
1520
1950
/* external high level API */
1536
1966
 
1537
1967
void avcodec_get_context_defaults(AVCodecContext *s);
1538
1968
AVCodecContext *avcodec_alloc_context(void);
 
1969
void avcodec_get_frame_defaults(AVFrame *pic);
1539
1970
AVFrame *avcodec_alloc_frame(void);
1540
1971
 
1541
1972
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
1542
1973
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
1543
 
void avcodec_default_free_buffers(AVCodecContext *s);
 
1974
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
 
1975
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
 
1976
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
 
1977
 
 
1978
int avcodec_thread_init(AVCodecContext *s, int thread_count);
 
1979
void avcodec_thread_free(AVCodecContext *s);
 
1980
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
 
1981
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
 
1982
//FIXME func typedef
1544
1983
 
1545
1984
/**
1546
1985
 * opens / inits the AVCodecContext.
1587
2026
 * rescale a 64bit integer.
1588
2027
 * a simple a*b/c isnt possible as it can overflow
1589
2028
 */
1590
 
int64_t av_rescale(int64_t a, int b, int c);
 
2029
int64_t av_rescale(int64_t a, int64_t b, int64_t c);
1591
2030
 
1592
2031
 
1593
2032
/**
1666
2105
 */
1667
2106
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
1668
2107
 
 
2108
/* frame parsing */
 
2109
typedef struct AVCodecParserContext {
 
2110
    void *priv_data;
 
2111
    struct AVCodecParser *parser;
 
2112
    int64_t frame_offset; /* offset of the current frame */
 
2113
    int64_t cur_offset; /* current offset 
 
2114
                           (incremented by each av_parser_parse()) */
 
2115
    int64_t last_frame_offset; /* offset of the last frame */
 
2116
    /* video info */
 
2117
    int pict_type; /* XXX: put it back in AVCodecContext */
 
2118
    int repeat_pict; /* XXX: put it back in AVCodecContext */
 
2119
    int64_t pts;     /* pts of the current frame */
 
2120
    int64_t dts;     /* dts of the current frame */
 
2121
 
 
2122
    /* private data */
 
2123
    int64_t last_pts;
 
2124
    int64_t last_dts;
 
2125
    int fetch_timestamp;
 
2126
 
 
2127
#define AV_PARSER_PTS_NB 4
 
2128
    int cur_frame_start_index;
 
2129
    int64_t cur_frame_offset[AV_PARSER_PTS_NB];
 
2130
    int64_t cur_frame_pts[AV_PARSER_PTS_NB];
 
2131
    int64_t cur_frame_dts[AV_PARSER_PTS_NB];
 
2132
} AVCodecParserContext;
 
2133
 
 
2134
typedef struct AVCodecParser {
 
2135
    int codec_ids[3]; /* several codec IDs are permitted */
 
2136
    int priv_data_size;
 
2137
    int (*parser_init)(AVCodecParserContext *s);
 
2138
    int (*parser_parse)(AVCodecParserContext *s, 
 
2139
                        AVCodecContext *avctx,
 
2140
                        uint8_t **poutbuf, int *poutbuf_size, 
 
2141
                        const uint8_t *buf, int buf_size);
 
2142
    void (*parser_close)(AVCodecParserContext *s);
 
2143
    struct AVCodecParser *next;
 
2144
} AVCodecParser;
 
2145
 
 
2146
extern AVCodecParser *av_first_parser;
 
2147
 
 
2148
void av_register_codec_parser(AVCodecParser *parser);
 
2149
AVCodecParserContext *av_parser_init(int codec_id);
 
2150
int av_parser_parse(AVCodecParserContext *s, 
 
2151
                    AVCodecContext *avctx,
 
2152
                    uint8_t **poutbuf, int *poutbuf_size, 
 
2153
                    const uint8_t *buf, int buf_size,
 
2154
                    int64_t pts, int64_t dts);
 
2155
void av_parser_close(AVCodecParserContext *s);
 
2156
 
 
2157
extern AVCodecParser mpegvideo_parser;
 
2158
extern AVCodecParser mpeg4video_parser;
 
2159
extern AVCodecParser h261_parser;
 
2160
extern AVCodecParser h263_parser;
 
2161
extern AVCodecParser h264_parser;
 
2162
extern AVCodecParser mpegaudio_parser;
 
2163
extern AVCodecParser ac3_parser;
 
2164
 
1669
2165
/* memory */
1670
2166
void *av_malloc(unsigned int size);
1671
2167
void *av_mallocz(unsigned int size);
1672
2168
void *av_realloc(void *ptr, unsigned int size);
1673
2169
void av_free(void *ptr);
1674
2170
char *av_strdup(const char *s);
1675
 
void __av_freep(void **ptr);
1676
 
#define av_freep(p) __av_freep((void **)(p))
 
2171
void av_freep(void *ptr);
1677
2172
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
1678
2173
/* for static data only */
1679
2174
/* call av_free_static to release all staticaly allocated tables */
1680
2175
void av_free_static(void);
1681
 
void *__av_mallocz_static(void** location, unsigned int size);
1682
 
#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
 
2176
void *av_mallocz_static(unsigned int size);
 
2177
 
 
2178
/* add by bero : in adx.c */
 
2179
int is_adx(const unsigned char *buf,size_t bufsize);
 
2180
 
 
2181
void img_copy(AVPicture *dst, const AVPicture *src,
 
2182
              int pix_fmt, int width, int height);
 
2183
 
 
2184
/* av_log API */
 
2185
 
 
2186
#include <stdarg.h>
 
2187
 
 
2188
#define AV_LOG_QUIET -1
 
2189
#define AV_LOG_ERROR 0
 
2190
#define AV_LOG_INFO 1
 
2191
#define AV_LOG_DEBUG 2
 
2192
 
 
2193
#ifdef __GNUC__
 
2194
extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
 
2195
#else
 
2196
extern void av_log(void*, int level, const char *fmt, ...);
 
2197
#endif
 
2198
 
 
2199
extern void av_vlog(void*, int level, const char *fmt, va_list);
 
2200
extern int av_log_get_level(void);
 
2201
extern void av_log_set_level(int);
 
2202
extern void av_log_set_callback(void (*)(void*, int, const char*, va_list));
 
2203
 
 
2204
/* endian macros */
 
2205
#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32)
 
2206
#define BE_16(x)  ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
 
2207
#define BE_32(x)  ((((uint8_t*)(x))[0] << 24) | \
 
2208
                   (((uint8_t*)(x))[1] << 16) | \
 
2209
                   (((uint8_t*)(x))[2] << 8) | \
 
2210
                    ((uint8_t*)(x))[3])
 
2211
#define LE_16(x)  ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
 
2212
#define LE_32(x)  ((((uint8_t*)(x))[3] << 24) | \
 
2213
                   (((uint8_t*)(x))[2] << 16) | \
 
2214
                   (((uint8_t*)(x))[1] << 8) | \
 
2215
                    ((uint8_t*)(x))[0])
 
2216
#endif
1683
2217
 
1684
2218
#ifdef __cplusplus
1685
2219
}