avcodec.h
Go to the documentation of this file.
1 /*
2  * copyright (c) 2001 Fabrice Bellard
3  *
4  * This file is part of Libav.
5  *
6  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVCODEC_AVCODEC_H
22 #define AVCODEC_AVCODEC_H
23 
29 #include <errno.h>
30 #include "libavutil/samplefmt.h"
31 #include "libavutil/avutil.h"
32 #include "libavutil/cpu.h"
33 #include "libavutil/dict.h"
34 #include "libavutil/log.h"
35 #include "libavutil/pixfmt.h"
36 #include "libavutil/rational.h"
37 
38 #include "libavcodec/version.h"
83 enum CodecID {
85 
86  /* video codecs */
186 #if LIBAVCODEC_VERSION_MAJOR == 53
187  CODEC_ID_FFH264,
188 #endif
206 #if LIBAVCODEC_VERSION_MAJOR == 53
207  CODEC_ID_8SVX_EXP,
208  CODEC_ID_8SVX_FIB,
209 #endif
248 #if LIBAVCODEC_VERSION_MAJOR == 53
249  CODEC_ID_G723_1,
250  CODEC_ID_G729,
251 #endif
257 
258  /* various PCM "codecs" */
288 
289  /* various ADPCM codecs */
319 
320  /* AMR */
321  CODEC_ID_AMR_NB = 0x12000,
323 
324  /* RealAudio codecs*/
325  CODEC_ID_RA_144 = 0x13000,
327 
328  /* various DPCM codecs */
329  CODEC_ID_ROQ_DPCM = 0x14000,
333 
334  /* audio codecs */
335  CODEC_ID_MP2 = 0x15000,
347 #if LIBAVCODEC_VERSION_MAJOR == 53
348  CODEC_ID_SONIC,
349  CODEC_ID_SONIC_LS,
350 #endif
369  CODEC_ID_GSM_MS, /* as found in WAV */
392 #if LIBAVCODEC_VERSION_MAJOR > 53
393  CODEC_ID_G723_1,
394  CODEC_ID_G729,
395  CODEC_ID_8SVX_EXP,
396  CODEC_ID_8SVX_FIB,
397 #endif
399 
400  /* subtitle codecs */
411 
412  /* other specific kind of codecs (generally used for attachments) */
414  CODEC_ID_TTF = 0x18000,
415 
416  CODEC_ID_PROBE = 0x19000,
417 
418  CODEC_ID_MPEG2TS = 0x20000,
423 };
424 
425 #if FF_API_OLD_SAMPLE_FMT
426 #define SampleFormat AVSampleFormat
427 
428 #define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE
429 #define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8
430 #define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16
431 #define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32
432 #define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT
433 #define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL
434 #define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB
435 #endif
436 
437 #if FF_API_OLD_AUDIOCONVERT
438 #include "libavutil/audioconvert.h"
439 
440 /* Audio channel masks */
441 #define CH_FRONT_LEFT AV_CH_FRONT_LEFT
442 #define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT
443 #define CH_FRONT_CENTER AV_CH_FRONT_CENTER
444 #define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY
445 #define CH_BACK_LEFT AV_CH_BACK_LEFT
446 #define CH_BACK_RIGHT AV_CH_BACK_RIGHT
447 #define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER
448 #define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER
449 #define CH_BACK_CENTER AV_CH_BACK_CENTER
450 #define CH_SIDE_LEFT AV_CH_SIDE_LEFT
451 #define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT
452 #define CH_TOP_CENTER AV_CH_TOP_CENTER
453 #define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT
454 #define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER
455 #define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT
456 #define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT
457 #define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER
458 #define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT
459 #define CH_STEREO_LEFT AV_CH_STEREO_LEFT
460 #define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT
461 
465 #define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE
466 
467 /* Audio channel convenience macros */
468 #define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO
469 #define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO
470 #define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1
471 #define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND
472 #define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0
473 #define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2
474 #define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD
475 #define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0
476 #define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1
477 #define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK
478 #define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK
479 #define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0
480 #define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1
481 #define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE
482 #define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX
483 #endif
484 
485 #if FF_API_OLD_DECODE_AUDIO
486 /* in bytes */
487 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
488 #endif
489 
497 #define FF_INPUT_BUFFER_PADDING_SIZE 8
498 
503 #define FF_MIN_BUFFER_SIZE 16384
504 
505 
510  ME_ZERO = 1,
520 };
521 
523  /* We leave some space between them for extensions (drop some
524  * keyframes for intra-only or drop just some bidir frames). */
531 };
532 
542 };
543 
550 };
551 
561 };
562 
568 };
569 
584 };
585 
586 #if FF_API_FLAC_GLOBAL_OPTS
587 
590 enum AVLPCType {
591  AV_LPC_TYPE_DEFAULT = -1,
592  AV_LPC_TYPE_NONE = 0,
593  AV_LPC_TYPE_FIXED = 1,
594  AV_LPC_TYPE_LEVINSON = 2,
595  AV_LPC_TYPE_CHOLESKY = 3,
596  AV_LPC_TYPE_NB ,
597 };
598 #endif
599 
611 };
612 
613 typedef struct RcOverride{
616  int qscale; // If this is 0 then quality_factor will be used instead.
618 } RcOverride;
619 
620 #define FF_MAX_B_FRAMES 16
621 
622 /* encoding support
623  These flags can be passed in AVCodecContext.flags before initialization.
624  Note: Not everything is supported yet.
625 */
626 
627 #define CODEC_FLAG_QSCALE 0x0002
628 #define CODEC_FLAG_4MV 0x0004
629 #define CODEC_FLAG_QPEL 0x0010
630 #define CODEC_FLAG_GMC 0x0020
631 #define CODEC_FLAG_MV0 0x0040
632 
637 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
638 #define CODEC_FLAG_PASS1 0x0200
639 #define CODEC_FLAG_PASS2 0x0400
640 #define CODEC_FLAG_GRAY 0x2000
641 #define CODEC_FLAG_EMU_EDGE 0x4000
642 #define CODEC_FLAG_PSNR 0x8000
643 #define CODEC_FLAG_TRUNCATED 0x00010000
645 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000
646 #define CODEC_FLAG_INTERLACED_DCT 0x00040000
647 #define CODEC_FLAG_LOW_DELAY 0x00080000
648 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000
649 #define CODEC_FLAG_BITEXACT 0x00800000
650 /* Fx : Flag for h263+ extra options */
651 #define CODEC_FLAG_AC_PRED 0x01000000
652 #define CODEC_FLAG_CBP_RD 0x04000000
653 #define CODEC_FLAG_QP_RD 0x08000000
654 #define CODEC_FLAG_LOOP_FILTER 0x00000800
655 #define CODEC_FLAG_INTERLACED_ME 0x20000000
656 #define CODEC_FLAG_CLOSED_GOP 0x80000000
657 #define CODEC_FLAG2_FAST 0x00000001
658 #define CODEC_FLAG2_STRICT_GOP 0x00000002
659 #define CODEC_FLAG2_NO_OUTPUT 0x00000004
660 #define CODEC_FLAG2_LOCAL_HEADER 0x00000008
661 #define CODEC_FLAG2_SKIP_RD 0x00004000
662 #define CODEC_FLAG2_CHUNKS 0x00008000
663 
668 #if FF_API_MPEGVIDEO_GLOBAL_OPTS
669 #define CODEC_FLAG_OBMC 0x00000001
670 #define CODEC_FLAG_H263P_AIV 0x00000008
671 #define CODEC_FLAG_PART 0x0080
672 #define CODEC_FLAG_ALT_SCAN 0x00100000
673 #define CODEC_FLAG_H263P_UMV 0x02000000
674 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
675 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000
676 #define CODEC_FLAG2_INTRA_VLC 0x00000800
677 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000
678 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000
679 #endif
680 #if FF_API_MJPEG_GLOBAL_OPTS
681 #define CODEC_FLAG_EXTERN_HUFF 0x1000
682 #endif
683 #if FF_API_X264_GLOBAL_OPTS
684 #define CODEC_FLAG2_BPYRAMID 0x00000010
685 #define CODEC_FLAG2_WPRED 0x00000020
686 #define CODEC_FLAG2_MIXED_REFS 0x00000040
687 #define CODEC_FLAG2_8X8DCT 0x00000080
688 #define CODEC_FLAG2_FASTPSKIP 0x00000100
689 #define CODEC_FLAG2_AUD 0x00000200
690 #define CODEC_FLAG2_BRDO 0x00000400
691 #define CODEC_FLAG2_MBTREE 0x00040000
692 #define CODEC_FLAG2_PSY 0x00080000
693 #define CODEC_FLAG2_SSIM 0x00100000
694 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000
695 #endif
696 #if FF_API_SNOW_GLOBAL_OPTS
697 #define CODEC_FLAG2_MEMC_ONLY 0x00001000
698 #endif
699 #if FF_API_LAME_GLOBAL_OPTS
700 #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000
701 #endif
702 
706 /* Unsupported options :
707  * Syntax Arithmetic coding (SAC)
708  * Reference Picture Selection
709  * Independent Segment Decoding */
710 /* /Fx */
711 /* codec capabilities */
713 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001
714 
719 #define CODEC_CAP_DR1 0x0002
720 #if FF_API_PARSE_FRAME
721 /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
722 #define CODEC_CAP_PARSE_ONLY 0x0004
723 #endif
724 #define CODEC_CAP_TRUNCATED 0x0008
725 /* Codec can export data for HW decoding (XvMC). */
726 #define CODEC_CAP_HWACCEL 0x0010
727 
750 #define CODEC_CAP_DELAY 0x0020
751 
755 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
756 
759 #define CODEC_CAP_HWACCEL_VDPAU 0x0080
760 
771 #define CODEC_CAP_SUBFRAMES 0x0100
772 
776 #define CODEC_CAP_EXPERIMENTAL 0x0200
777 
780 #define CODEC_CAP_CHANNEL_CONF 0x0400
781 
784 #define CODEC_CAP_NEG_LINESIZES 0x0800
785 
788 #define CODEC_CAP_FRAME_THREADS 0x1000
789 
792 #define CODEC_CAP_SLICE_THREADS 0x2000
793 
796 #define CODEC_CAP_PARAM_CHANGE 0x4000
797 
800 #define CODEC_CAP_AUTO_THREADS 0x8000
801 
804 #define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000
805 
806 //The following defines may change, don't expect compatibility if you use them.
807 #define MB_TYPE_INTRA4x4 0x0001
808 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
809 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
810 #define MB_TYPE_16x16 0x0008
811 #define MB_TYPE_16x8 0x0010
812 #define MB_TYPE_8x16 0x0020
813 #define MB_TYPE_8x8 0x0040
814 #define MB_TYPE_INTERLACED 0x0080
815 #define MB_TYPE_DIRECT2 0x0100 //FIXME
816 #define MB_TYPE_ACPRED 0x0200
817 #define MB_TYPE_GMC 0x0400
818 #define MB_TYPE_SKIP 0x0800
819 #define MB_TYPE_P0L0 0x1000
820 #define MB_TYPE_P1L0 0x2000
821 #define MB_TYPE_P0L1 0x4000
822 #define MB_TYPE_P1L1 0x8000
823 #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
824 #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
825 #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
826 #define MB_TYPE_QUANT 0x00010000
827 #define MB_TYPE_CBP 0x00020000
828 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
829 
835 typedef struct AVPanScan{
841  int id;
842 
848  int width;
849  int height;
850 
856  int16_t position[3][2];
857 }AVPanScan;
859 #define FF_QSCALE_TYPE_MPEG1 0
860 #define FF_QSCALE_TYPE_MPEG2 1
861 #define FF_QSCALE_TYPE_H264 2
862 #define FF_QSCALE_TYPE_VP56 3
864 #define FF_BUFFER_TYPE_INTERNAL 1
865 #define FF_BUFFER_TYPE_USER 2
866 #define FF_BUFFER_TYPE_SHARED 4
867 #define FF_BUFFER_TYPE_COPY 8
868 
869 #if FF_API_OLD_FF_PICT_TYPES
870 /* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
871 #define FF_I_TYPE AV_PICTURE_TYPE_I
872 #define FF_P_TYPE AV_PICTURE_TYPE_P
873 #define FF_B_TYPE AV_PICTURE_TYPE_B
874 #define FF_S_TYPE AV_PICTURE_TYPE_S
875 #define FF_SI_TYPE AV_PICTURE_TYPE_SI
876 #define FF_SP_TYPE AV_PICTURE_TYPE_SP
877 #define FF_BI_TYPE AV_PICTURE_TYPE_BI
878 #endif
880 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
881 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
882 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
883 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
889 };
891 typedef struct AVPacket {
901  int64_t pts;
907  int64_t dts;
908  uint8_t *data;
909  int size;
910  int stream_index;
914  int flags;
919  struct {
920  uint8_t *data;
921  int size;
924  int side_data_elems;
925 
930  int duration;
931  void (*destruct)(struct AVPacket *);
932  void *priv;
933  int64_t pos;
934 
952  int64_t convergence_duration;
954 #define AV_PKT_FLAG_KEY 0x0001
955 #define AV_PKT_FLAG_CORRUPT 0x0002
956 
957 
976 };
977 
985 typedef struct AVFrame {
986 #if FF_API_DATA_POINTERS
987 #define AV_NUM_DATA_POINTERS 4
988 #else
989 #define AV_NUM_DATA_POINTERS 8
990 #endif
991 
997  uint8_t *data[AV_NUM_DATA_POINTERS];
998 
1009 
1016  uint8_t *base[AV_NUM_DATA_POINTERS];
1022  int key_frame;
1023 
1029  enum AVPictureType pict_type;
1030 
1037  int64_t pts;
1038 
1051 
1057  int quality;
1058 
1059 #if FF_API_AVFRAME_AGE
1060 
1063  attribute_deprecated int age;
1064 #endif
1065 
1074  int reference;
1075 
1081  int8_t *qscale_table;
1087  int qstride;
1088 
1095  uint8_t *mbskip_table;
1096 
1109  int16_t (*motion_val[2])[2];
1110 
1117  uint32_t *mb_type;
1118 
1125  uint8_t motion_subsample_log2;
1126 
1132  void *opaque;
1133 
1139  uint64_t error[AV_NUM_DATA_POINTERS];
1140 
1147  int type;
1148 
1155  int repeat_pict;
1156 
1160  int qscale_type;
1161 
1167  int interlaced_frame;
1168 
1174  int top_field_first;
1175 
1182 
1188  int palette_has_changed;
1189 
1195  int buffer_hints;
1196 
1202  short *dct_coeff;
1203 
1210  int8_t *ref_index[2];
1211 
1223  int64_t reordered_opaque;
1224 
1231 
1237  int64_t pkt_pts;
1238 
1244  int64_t pkt_dts;
1245 
1251  struct AVCodecContext *owner;
1252 
1258  void *thread_opaque;
1259 
1265  int nb_samples;
1266 
1285  uint8_t **extended_data;
1286 
1293 
1299  int width, height;
1300 
1308  int format;
1309 } AVFrame;
1310 
1311 struct AVCodecInternal;
1316  AV_FIELD_TT, //< Top coded_first, top displayed first
1317  AV_FIELD_BB, //< Bottom coded first, bottom displayed first
1318  AV_FIELD_TB, //< Top coded first, bottom displayed first
1319  AV_FIELD_BT, //< Bottom coded first, top displayed first
1320 };
1321 
1329 typedef struct AVCodecContext {
1334  const AVClass *av_class;
1340  int bit_rate;
1341 
1348  int bit_rate_tolerance;
1349 
1355  int flags;
1356 
1365  int sub_id;
1366 
1374  int me_method;
1375 
1387  uint8_t *extradata;
1388  int extradata_size;
1389 
1399 
1400  /* video only */
1408  int width, height;
1410 #define FF_ASPECT_EXTENDED 15
1411 
1417  int gop_size;
1418 
1426  enum PixelFormat pix_fmt;
1427 
1451  void (*draw_horiz_band)(struct AVCodecContext *s,
1452  const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
1453  int y, int type, int height);
1454 
1455  /* audio only */
1457  int channels;
1458 
1464  enum AVSampleFormat sample_fmt;
1465 
1466  /* The following data should not be initialized. */
1471  int frame_number;
1472 
1479  int delay;
1480 
1481  /* - encoding parameters */
1482  float qcompress;
1483  float qblur;
1484 
1490  int qmin;
1491 
1497  int qmax;
1498 
1504  int max_qdiff;
1505 
1512  int max_b_frames;
1513 
1521  float b_quant_factor;
1522 
1525 #define FF_RC_STRATEGY_XVID 1
1527  int b_frame_strategy;
1529  struct AVCodec *codec;
1531  void *priv_data;
1533  int rtp_payload_size; /* The size of the RTP payload: the coder will */
1534  /* do its best to deliver a chunk with size */
1535  /* below rtp_payload_size, the chunk will start */
1536  /* with a start code on some codecs like H.263. */
1537  /* This doesn't take account of any particular */
1538  /* headers inside the transmitted RTP payload. */
1539 
1540 
1541  /* The RTP callback: This function is called */
1542  /* every time the encoder has a packet to send. */
1543  /* It depends on the encoder if the data starts */
1544  /* with a Start Code (it should). H.263 does. */
1545  /* mb_nb contains the number of macroblocks */
1546  /* encoded in the RTP payload. */
1547  void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
1548 
1549  /* statistics, used for 2-pass encoding */
1550  int mv_bits;
1554  int i_count;
1555  int p_count;
1557  int misc_bits;
1558 
1564  int frame_bits;
1565 
1571  void *opaque;
1573  char codec_name[32];
1574  enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
1575  enum CodecID codec_id; /* see CODEC_ID_xxx */
1576 
1590  unsigned int codec_tag;
1591 
1598 #define FF_BUG_AUTODETECT 1
1599 #define FF_BUG_OLD_MSMPEG4 2
1600 #define FF_BUG_XVID_ILACE 4
1601 #define FF_BUG_UMP4 8
1602 #define FF_BUG_NO_PADDING 16
1603 #define FF_BUG_AMV 32
1604 #define FF_BUG_AC_VLC 0
1605 #define FF_BUG_QPEL_CHROMA 64
1606 #define FF_BUG_STD_QPEL 128
1607 #define FF_BUG_QPEL_CHROMA2 256
1608 #define FF_BUG_DIRECT_BLOCKSIZE 512
1609 #define FF_BUG_EDGE 1024
1610 #define FF_BUG_HPEL_CHROMA 2048
1611 #define FF_BUG_DC_CLIP 4096
1612 #define FF_BUG_MS 8192
1613 #define FF_BUG_TRUNCATED 16384
1614 //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
1615 
1621  int luma_elim_threshold;
1622 
1629 
1643 #define FF_COMPLIANCE_VERY_STRICT 2
1644 #define FF_COMPLIANCE_STRICT 1
1645 #define FF_COMPLIANCE_NORMAL 0
1646 #define FF_COMPLIANCE_UNOFFICIAL -1
1647 #define FF_COMPLIANCE_EXPERIMENTAL -2
1648 
1649 
1654  float b_quant_offset;
1655 
1656 #if FF_API_ER
1657 
1664 #define FF_ER_CAREFUL 1
1665 #define FF_ER_COMPLIANT 2
1666 #define FF_ER_AGGRESSIVE 3
1667 #define FF_ER_VERY_AGGRESSIVE 4
1668 #define FF_ER_EXPLODE 5
1669 #endif /* FF_API_ER */
1670 
1726  int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
1727 
1737  void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
1738 
1745  int has_b_frames;
1746 
1751  int block_align;
1752 
1753 #if FF_API_PARSE_FRAME
1754 
1760  attribute_deprecated int parse_only;
1761 #endif
1762 
1768  int mpeg_quant;
1769 
1775  char *stats_out;
1776 
1783  char *stats_in;
1784 
1791  float rc_qsquish;
1794  int rc_qmod_freq;
1795 
1802  int rc_override_count;
1803 
1809  const char *rc_eq;
1810 
1816  int rc_max_rate;
1817 
1823  int rc_min_rate;
1824 
1831  float rc_buffer_aggressivity;
1832 
1840  float i_quant_factor;
1841 
1847  float i_quant_offset;
1848 
1854  float rc_initial_cplx;
1855 
1862 #define FF_DCT_AUTO 0
1863 #define FF_DCT_FASTINT 1
1864 #define FF_DCT_INT 2
1865 #define FF_DCT_MMX 3
1866 #define FF_DCT_MLIB 4
1867 #define FF_DCT_ALTIVEC 5
1868 #define FF_DCT_FAAN 6
1869 
1875  float lumi_masking;
1876 
1882  float temporal_cplx_masking;
1883 
1889  float spatial_cplx_masking;
1890 
1896  float p_masking;
1897 
1903  float dark_masking;
1904 
1911 #define FF_IDCT_AUTO 0
1912 #define FF_IDCT_INT 1
1913 #define FF_IDCT_SIMPLE 2
1914 #define FF_IDCT_SIMPLEMMX 3
1915 #define FF_IDCT_LIBMPEG2MMX 4
1916 #define FF_IDCT_PS2 5
1917 #define FF_IDCT_MLIB 6
1918 #define FF_IDCT_ARM 7
1919 #define FF_IDCT_ALTIVEC 8
1920 #define FF_IDCT_SH4 9
1921 #define FF_IDCT_SIMPLEARM 10
1922 #define FF_IDCT_H264 11
1923 #define FF_IDCT_VP3 12
1924 #define FF_IDCT_IPP 13
1925 #define FF_IDCT_XVIDMMX 14
1926 #define FF_IDCT_CAVS 15
1927 #define FF_IDCT_SIMPLEARMV5TE 16
1928 #define FF_IDCT_SIMPLEARMV6 17
1929 #define FF_IDCT_SIMPLEVIS 18
1930 #define FF_IDCT_WMV2 19
1931 #define FF_IDCT_FAAN 20
1932 #define FF_IDCT_EA 21
1933 #define FF_IDCT_SIMPLENEON 22
1934 #define FF_IDCT_SIMPLEALPHA 23
1935 #define FF_IDCT_BINK 24
1936 
1942  int slice_count;
1948  int *slice_offset;
1949 
1956 #define FF_EC_GUESS_MVS 1
1957 #define FF_EC_DEBLOCK 2
1958 
1967  unsigned dsp_mask;
1968 
1975 
1982 #define FF_PRED_LEFT 0
1983 #define FF_PRED_PLANE 1
1984 #define FF_PRED_MEDIAN 2
1985 
1994 
2001 
2007  int debug;
2008 #define FF_DEBUG_PICT_INFO 1
2009 #define FF_DEBUG_RC 2
2010 #define FF_DEBUG_BITSTREAM 4
2011 #define FF_DEBUG_MB_TYPE 8
2012 #define FF_DEBUG_QP 16
2013 #define FF_DEBUG_MV 32
2014 #define FF_DEBUG_DCT_COEFF 0x00000040
2015 #define FF_DEBUG_SKIP 0x00000080
2016 #define FF_DEBUG_STARTCODE 0x00000100
2017 #define FF_DEBUG_PTS 0x00000200
2018 #define FF_DEBUG_ER 0x00000400
2019 #define FF_DEBUG_MMCO 0x00000800
2020 #define FF_DEBUG_BUGS 0x00001000
2021 #define FF_DEBUG_VIS_QP 0x00002000
2022 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
2023 #define FF_DEBUG_BUFFERS 0x00008000
2024 #define FF_DEBUG_THREADS 0x00010000
2025 
2032 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
2033 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
2034 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
2035 
2041  uint64_t error[AV_NUM_DATA_POINTERS];
2042 
2048  int me_cmp;
2054  int me_sub_cmp;
2060  int mb_cmp;
2067 #define FF_CMP_SAD 0
2068 #define FF_CMP_SSE 1
2069 #define FF_CMP_SATD 2
2070 #define FF_CMP_DCT 3
2071 #define FF_CMP_PSNR 4
2072 #define FF_CMP_BIT 5
2073 #define FF_CMP_RD 6
2074 #define FF_CMP_ZERO 7
2075 #define FF_CMP_VSAD 8
2076 #define FF_CMP_VSSE 9
2077 #define FF_CMP_NSSE 10
2078 #define FF_CMP_W53 11
2079 #define FF_CMP_W97 12
2080 #define FF_CMP_DCTMAX 13
2081 #define FF_CMP_DCT264 14
2082 #define FF_CMP_CHROMA 256
2083 
2089  int dia_size;
2090 
2097 
2103  int pre_me;
2104 
2110  int me_pre_cmp;
2111 
2117  int pre_dia_size;
2118 
2124  int me_subpel_quality;
2125 
2135  enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
2136 
2146 #define FF_DTG_AFD_SAME 8
2147 #define FF_DTG_AFD_4_3 9
2148 #define FF_DTG_AFD_16_9 10
2149 #define FF_DTG_AFD_14_9 11
2150 #define FF_DTG_AFD_4_3_SP_14_9 13
2151 #define FF_DTG_AFD_16_9_SP_14_9 14
2152 #define FF_DTG_AFD_SP_4_3 15
2153 
2161  int me_range;
2162 
2169 #define FF_DEFAULT_QUANT_BIAS 999999
2170 
2176  int inter_quant_bias;
2177 
2184  int color_table_id;
2185 
2186 #if FF_API_INTERNAL_CONTEXT
2187 
2192  attribute_deprecated int internal_buffer_count;
2193 
2199  attribute_deprecated void *internal_buffer;
2200 #endif
2201 
2208  int global_quality;
2210 #define FF_CODER_TYPE_VLC 0
2211 #define FF_CODER_TYPE_AC 1
2212 #define FF_CODER_TYPE_RAW 2
2213 #define FF_CODER_TYPE_RLE 3
2214 #define FF_CODER_TYPE_DEFLATE 4
2215 
2220  int coder_type;
2221 
2227  int context_model;
2228 #if 0
2229 
2234  uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
2235 #endif
2236 
2243 #define SLICE_FLAG_CODED_ORDER 0x0001
2244 #define SLICE_FLAG_ALLOW_FIELD 0x0002
2245 #define SLICE_FLAG_ALLOW_PLANE 0x0004
2246 
2247 
2252  int xvmc_acceleration;
2253 
2260 #define FF_MB_DECISION_SIMPLE 0
2261 #define FF_MB_DECISION_BITS 1
2262 #define FF_MB_DECISION_RD 2
2263 
2264 
2269  uint16_t *intra_matrix;
2270 
2276  uint16_t *inter_matrix;
2277 
2284  unsigned int stream_codec_tag;
2285 
2293 
2299  int lmin;
2300 
2306  int lmax;
2307 
2308 #if FF_API_PALETTE_CONTROL
2309 
2314  struct AVPaletteControl *palctrl;
2315 #endif
2316 
2322  int noise_reduction;
2323 
2336  int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
2337 
2344 
2350  int inter_threshold;
2351 
2357  int flags2;
2358 
2364  int error_rate;
2365 
2366 #if FF_API_ANTIALIAS_ALGO
2367 
2372  attribute_deprecated int antialias_algo;
2373 #define FF_AA_AUTO 0
2374 #define FF_AA_FASTINT 1 //not implemented yet
2375 #define FF_AA_INT 2
2376 #define FF_AA_FLOAT 3
2377 #endif
2378 
2385 
2392  int thread_count;
2393 
2403  int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
2404 
2411  void *thread_opaque;
2412 
2420  int me_threshold;
2421 
2427  int mb_threshold;
2428 
2434  int intra_dc_precision;
2435 
2441  int nsse_weight;
2442 
2448  int skip_top;
2449 
2455  int skip_bottom;
2456 
2462  int profile;
2463 #define FF_PROFILE_UNKNOWN -99
2464 #define FF_PROFILE_RESERVED -100
2466 #define FF_PROFILE_AAC_MAIN 0
2467 #define FF_PROFILE_AAC_LOW 1
2468 #define FF_PROFILE_AAC_SSR 2
2469 #define FF_PROFILE_AAC_LTP 3
2471 #define FF_PROFILE_DTS 20
2472 #define FF_PROFILE_DTS_ES 30
2473 #define FF_PROFILE_DTS_96_24 40
2474 #define FF_PROFILE_DTS_HD_HRA 50
2475 #define FF_PROFILE_DTS_HD_MA 60
2477 #define FF_PROFILE_MPEG2_422 0
2478 #define FF_PROFILE_MPEG2_HIGH 1
2479 #define FF_PROFILE_MPEG2_SS 2
2480 #define FF_PROFILE_MPEG2_SNR_SCALABLE 3
2481 #define FF_PROFILE_MPEG2_MAIN 4
2482 #define FF_PROFILE_MPEG2_SIMPLE 5
2484 #define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
2485 #define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
2487 #define FF_PROFILE_H264_BASELINE 66
2488 #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
2489 #define FF_PROFILE_H264_MAIN 77
2490 #define FF_PROFILE_H264_EXTENDED 88
2491 #define FF_PROFILE_H264_HIGH 100
2492 #define FF_PROFILE_H264_HIGH_10 110
2493 #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
2494 #define FF_PROFILE_H264_HIGH_422 122
2495 #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
2496 #define FF_PROFILE_H264_HIGH_444 144
2497 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
2498 #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
2499 #define FF_PROFILE_H264_CAVLC_444 44
2501 #define FF_PROFILE_VC1_SIMPLE 0
2502 #define FF_PROFILE_VC1_MAIN 1
2503 #define FF_PROFILE_VC1_COMPLEX 2
2504 #define FF_PROFILE_VC1_ADVANCED 3
2506 #define FF_PROFILE_MPEG4_SIMPLE 0
2507 #define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
2508 #define FF_PROFILE_MPEG4_CORE 2
2509 #define FF_PROFILE_MPEG4_MAIN 3
2510 #define FF_PROFILE_MPEG4_N_BIT 4
2511 #define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
2512 #define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
2513 #define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
2514 #define FF_PROFILE_MPEG4_HYBRID 8
2515 #define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
2516 #define FF_PROFILE_MPEG4_CORE_SCALABLE 10
2517 #define FF_PROFILE_MPEG4_ADVANCED_CODING 11
2518 #define FF_PROFILE_MPEG4_ADVANCED_CORE 12
2519 #define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
2520 #define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
2521 #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
2522 
2528  int level;
2529 #define FF_LEVEL_UNKNOWN -99
2530 
2536  int lowres;
2537 
2544 
2551 
2557  int frame_skip_factor;
2558 
2564  int frame_skip_exp;
2565 
2571  int frame_skip_cmp;
2572 
2579  float border_masking;
2580 
2586  int mb_lmin;
2587 
2593  int mb_lmax;
2594 
2601 
2608 
2614  enum AVDiscard skip_idct;
2615 
2621  enum AVDiscard skip_frame;
2622 
2628  int bidir_refine;
2629 
2635  int brd_scale;
2636 
2637 #if FF_API_X264_GLOBAL_OPTS
2638 
2644  attribute_deprecated float crf;
2645 
2652  attribute_deprecated int cqp;
2653 #endif
2654 
2660  int keyint_min;
2661 
2667  int refs;
2668 
2674  int chromaoffset;
2675 
2676 #if FF_API_X264_GLOBAL_OPTS
2677 
2682  attribute_deprecated int bframebias;
2683 #endif
2684 
2690  int trellis;
2691 
2692 #if FF_API_X264_GLOBAL_OPTS
2693 
2698  attribute_deprecated float complexityblur;
2699 
2706  attribute_deprecated int deblockalpha;
2707 
2714  attribute_deprecated int deblockbeta;
2715 
2721  attribute_deprecated int partitions;
2722 #define X264_PART_I4X4 0x001 /* Analyze i4x4 */
2723 #define X264_PART_I8X8 0x002 /* Analyze i8x8 (requires 8x8 transform) */
2724 #define X264_PART_P8X8 0x010 /* Analyze p16x8, p8x16 and p8x8 */
2725 #define X264_PART_P4X4 0x020 /* Analyze p8x4, p4x8, p4x4 */
2726 #define X264_PART_B8X8 0x100 /* Analyze b16x8, b8x16 and b8x8 */
2727 
2733  attribute_deprecated int directpred;
2734 #endif
2735 
2741  int cutoff;
2742 
2748  int scenechange_factor;
2749 
2756  int mv0_threshold;
2757 
2763  int b_sensitivity;
2764 
2770 #define FF_COMPRESSION_DEFAULT -1
2771 
2777 
2783 
2784 #if FF_API_FLAC_GLOBAL_OPTS
2785 
2796  attribute_deprecated int lpc_coeff_precision;
2797 
2803  attribute_deprecated int prediction_order_method;
2804 
2809  attribute_deprecated int min_partition_order;
2810 
2815  attribute_deprecated int max_partition_order;
2819 #endif
2820 
2826  int64_t timecode_frame_start;
2827 
2828 #if FF_API_REQUEST_CHANNELS
2829 
2835  int request_channels;
2836 #endif
2837 
2838 #if FF_API_DRC_SCALE
2839 
2846  attribute_deprecated float drc_scale;
2847 #endif
2848 
2856  int64_t reordered_opaque;
2857 
2863  int bits_per_raw_sample;
2864 
2870  uint64_t channel_layout;
2871 
2877  uint64_t request_channel_layout;
2878 
2885 
2892 
2898  struct AVHWAccel *hwaccel;
2899 
2907  int ticks_per_frame;
2908 
2919  void *hwaccel_context;
2920 
2927 
2934 
2940  enum AVColorSpace colorspace;
2941 
2948 
2955 
2974  int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
2975 
2976 #if FF_API_X264_GLOBAL_OPTS
2977 
2985  attribute_deprecated int weighted_p_pred;
2986 
2995  attribute_deprecated int aq_mode;
2996 
3003  attribute_deprecated float aq_strength;
3004 
3011  attribute_deprecated float psy_rd;
3012 
3019  attribute_deprecated float psy_trellis;
3020 
3027  attribute_deprecated int rc_lookahead;
3028 
3036  attribute_deprecated float crf_max;
3037 #endif
3039  int log_level_offset;
3040 
3041 #if FF_API_FLAC_GLOBAL_OPTS
3042 
3047  attribute_deprecated enum AVLPCType lpc_type;
3048 
3054  attribute_deprecated int lpc_passes;
3055 #endif
3056 
3064  int slices;
3065 
3076 
3084  AVPacket *pkt;
3085 
3086 #if FF_API_INTERNAL_CONTEXT
3087 
3096  attribute_deprecated int is_copy;
3097 #endif
3098 
3108 #define FF_THREAD_FRAME 1
3109 #define FF_THREAD_SLICE 2
3110 
3111 
3116  int active_thread_type;
3117 
3127 
3134  uint64_t vbv_delay;
3135 
3142 
3149 
3156 #define AV_EF_CRCCHECK (1<<0)
3157 #define AV_EF_BITSTREAM (1<<1)
3158 #define AV_EF_BUFFER (1<<2)
3159 #define AV_EF_EXPLODE (1<<3)
3160 
3167  struct AVCodecInternal *internal;
3168 
3174 } AVCodecContext;
3175 
3179 typedef struct AVProfile {
3180  int profile;
3181  const char *name;
3182 } AVProfile;
3184 typedef struct AVCodecDefault AVCodecDefault;
3185 
3189 typedef struct AVCodec {
3196  const char *name;
3198  enum CodecID id;
3201  int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
3203  int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
3209  struct AVCodec *next;
3216  const enum PixelFormat *pix_fmts;
3217 
3221  const char *long_name;
3224  const uint64_t *channel_layouts;
3225  uint8_t max_lowres;
3227  const AVProfile *profiles;
3228 
3238  int (*init_thread_copy)(AVCodecContext *);
3246  int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
3252  const AVCodecDefault *defaults;
3253 
3257  void (*init_static_data)(struct AVCodec *codec);
3258 
3269  int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
3270  int *got_packet_ptr);
3271 } AVCodec;
3272 
3276 typedef struct AVHWAccel {
3282  const char *name;
3283 
3289  enum AVMediaType type;
3290 
3296  enum CodecID id;
3297 
3303  enum PixelFormat pix_fmt;
3304 
3309  int capabilities;
3311  struct AVHWAccel *next;
3312 
3327  int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3328 
3340  int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
3341 
3351  int (*end_frame)(AVCodecContext *avctx);
3352 
3360  int priv_data_size;
3361 } AVHWAccel;
3362 
3367 typedef struct AVPicture {
3370 } AVPicture;
3372 #define AVPALETTE_SIZE 1024
3373 #define AVPALETTE_COUNT 256
3374 #if FF_API_PALETTE_CONTROL
3375 
3383 typedef struct AVPaletteControl {
3384 
3385  /* Demuxer sets this to 1 to indicate the palette has changed;
3386  * decoder resets to 0. */
3387  int palette_changed;
3388 
3389  /* 4-byte ARGB palette entries, stored in native byte order; note that
3390  * the individual palette components should be on a 8-bit scale; if
3391  * the palette data comes from an IBM VGA native format, the component
3392  * data is probably 6 bits in size and needs to be scaled. */
3393  unsigned int palette[AVPALETTE_COUNT];
3394 
3395 } AVPaletteControl attribute_deprecated;
3396 #endif
3399  SUBTITLE_NONE,
3401  SUBTITLE_BITMAP,
3402 
3407  SUBTITLE_TEXT,
3408 
3413  SUBTITLE_ASS,
3414 };
3416 typedef struct AVSubtitleRect {
3417  int x;
3418  int y;
3419  int w;
3420  int h;
3421  int nb_colors;
3422 
3428  enum AVSubtitleType type;
3430  char *text;
3431 
3437  char *ass;
3438 } AVSubtitleRect;
3440 typedef struct AVSubtitle {
3441  uint16_t format; /* 0 = graphics */
3442  uint32_t start_display_time; /* relative to packet pts, in ms */
3443  uint32_t end_display_time; /* relative to packet pts, in ms */
3444  unsigned num_rects;
3446  int64_t pts;
3447 } AVSubtitle;
3448 
3449 /* packet functions */
3450 
3454 attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
3455 
3459 void av_destruct_packet(AVPacket *pkt);
3460 
3466 void av_init_packet(AVPacket *pkt);
3467 
3476 int av_new_packet(AVPacket *pkt, int size);
3477 
3484 void av_shrink_packet(AVPacket *pkt, int size);
3485 
3492 int av_grow_packet(AVPacket *pkt, int grow_by);
3493 
3498 int av_dup_packet(AVPacket *pkt);
3499 
3505 void av_free_packet(AVPacket *pkt);
3506 
3515 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3516  int size);
3517 
3526 uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
3527  int *size);
3528 
3529 /* resample.c */
3530 
3531 struct ReSampleContext;
3532 struct AVResampleContext;
3534 typedef struct ReSampleContext ReSampleContext;
3535 
3553  int output_rate, int input_rate,
3554  enum AVSampleFormat sample_fmt_out,
3555  enum AVSampleFormat sample_fmt_in,
3556  int filter_length, int log2_phase_count,
3557  int linear, double cutoff);
3558 
3559 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
3560 
3568 
3569 
3579 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
3580 
3590 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
3591 
3592 
3605 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
3606 void av_resample_close(struct AVResampleContext *c);
3607 
3620 
3629 
3650 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
3651  enum PixelFormat pix_fmt, int width, int height);
3652 
3668 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
3669  unsigned char *dest, int dest_size);
3670 
3683 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
3684 void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
3685 
3686 #if FF_API_GET_PIX_FMT_NAME
3687 
3690 attribute_deprecated
3691 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
3692 #endif
3693 
3695 
3702 
3710 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
3712 #define FF_LOSS_RESOLUTION 0x0001
3713 #define FF_LOSS_DEPTH 0x0002
3714 #define FF_LOSS_COLORSPACE 0x0004
3715 #define FF_LOSS_ALPHA 0x0008
3716 #define FF_LOSS_COLORQUANT 0x0010
3717 #define FF_LOSS_CHROMA 0x0020
3736 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
3737  int has_alpha);
3738 
3761 enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
3762  int has_alpha, int *loss_ptr);
3763 
3764 #if FF_API_GET_ALPHA_INFO
3765 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
3766 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
3767 
3772 attribute_deprecated
3773 int img_get_alpha_info(const AVPicture *src,
3774  enum PixelFormat pix_fmt, int width, int height);
3775 #endif
3776 
3777 /* deinterlace a picture */
3778 /* deinterlace - if not supported return -1 */
3779 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
3780  enum PixelFormat pix_fmt, int width, int height);
3781 
3782 /* external high level API */
3783 
3790 
3794 unsigned avcodec_version(void);
3795 
3799 const char *avcodec_configuration(void);
3800 
3804 const char *avcodec_license(void);
3805 
3806 #if FF_API_AVCODEC_INIT
3807 
3811 attribute_deprecated
3812 void avcodec_init(void);
3813 #endif
3814 
3823 void avcodec_register(AVCodec *codec);
3824 
3832 
3840 
3848 
3856 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
3857 
3865 const char *av_get_profile_name(const AVCodec *codec, int profile);
3866 
3867 #if FF_API_ALLOC_CONTEXT
3868 
3874 attribute_deprecated
3875 void avcodec_get_context_defaults(AVCodecContext *s);
3876 
3879 attribute_deprecated
3880 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
3881 #endif
3882 
3893 
3894 #if FF_API_ALLOC_CONTEXT
3895 
3904 attribute_deprecated
3905 AVCodecContext *avcodec_alloc_context(void);
3906 
3909 attribute_deprecated
3910 AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
3911 #endif
3912 
3926 
3938 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
3939 
3946 
3955 
3959 
3967 unsigned avcodec_get_edge_width(void);
3988  int linesize_align[AV_NUM_DATA_POINTERS]);
3989 
3990 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
3991 
3992 #if FF_API_THREAD_INIT
3993 
3996 attribute_deprecated
3997 int avcodec_thread_init(AVCodecContext *s, int thread_count);
3998 #endif
3999 
4000 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
4001 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
4002 //FIXME func typedef
4003 
4004 #if FF_API_AVCODEC_OPEN
4005 
4034 attribute_deprecated
4035 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
4036 #endif
4037 
4075 
4076 #if FF_API_OLD_DECODE_AUDIO
4077 
4131 attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
4132  int *frame_size_ptr,
4133  AVPacket *avpkt);
4134 #endif
4135 
4169 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
4170  int *got_frame_ptr, AVPacket *avpkt);
4171 
4214  int *got_picture_ptr,
4215  AVPacket *avpkt);
4216 
4234  int *got_sub_ptr,
4235  AVPacket *avpkt);
4236 
4242 void avsubtitle_free(AVSubtitle *sub);
4243 
4244 #if FF_API_OLD_ENCODE_AUDIO
4245 
4269 int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
4270  uint8_t *buf, int buf_size,
4271  const short *samples);
4272 #endif
4273 
4312 int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
4313  const AVFrame *frame, int *got_packet_ptr);
4314 
4332  enum AVSampleFormat sample_fmt, const uint8_t *buf,
4333  int buf_size, int align);
4334 
4347 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
4348  const AVFrame *pict);
4349 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
4350  const AVSubtitle *sub);
4351 
4361 int avcodec_close(AVCodecContext *avctx);
4362 
4373 void avcodec_register_all(void);
4374 
4379 
4381 
4382 /* misc useful functions */
4383 
4384 #if FF_API_OLD_FF_PICT_TYPES
4385 
4392 attribute_deprecated
4393 char av_get_pict_type_char(int pict_type);
4394 #endif
4395 
4403 
4404 #if FF_API_OLD_SAMPLE_FMT
4405 
4408 attribute_deprecated
4409 int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt);
4410 #endif
4411 
4412 /* frame parsing */
4413 typedef struct AVCodecParserContext {
4414  void *priv_data;
4416  int64_t frame_offset; /* offset of the current frame */
4417  int64_t cur_offset; /* current offset
4418  (incremented by each av_parser_parse()) */
4419  int64_t next_frame_offset; /* offset of the next frame */
4420  /* video info */
4421  int pict_type; /* XXX: Put it back in AVCodecContext. */
4431  int repeat_pict; /* XXX: Put it back in AVCodecContext. */
4432  int64_t pts; /* pts of the current frame */
4433  int64_t dts; /* dts of the current frame */
4434 
4435  /* private data */
4436  int64_t last_pts;
4437  int64_t last_dts;
4438  int fetch_timestamp;
4440 #define AV_PARSER_PTS_NB 4
4446  int flags;
4447 #define PARSER_FLAG_COMPLETE_FRAMES 0x0001
4448 #define PARSER_FLAG_ONCE 0x0002
4450 #define PARSER_FLAG_FETCHED_OFFSET 0x0004
4452  int64_t offset;
4454 
4461  int key_frame;
4462 
4480  int64_t convergence_duration;
4481 
4482  // Timestamp generation support:
4492  int dts_sync_point;
4493 
4507  int dts_ref_dts_delta;
4508 
4521  int pts_dts_delta;
4522 
4529 
4533  int64_t pos;
4534 
4538  int64_t last_pos;
4541 typedef struct AVCodecParser {
4542  int codec_ids[5]; /* several codec IDs are permitted */
4546  AVCodecContext *avctx,
4547  const uint8_t **poutbuf, int *poutbuf_size,
4548  const uint8_t *buf, int buf_size);
4550  int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
4551  struct AVCodecParser *next;
4552 } AVCodecParser;
4553 
4555 
4558 
4588  AVCodecContext *avctx,
4589  uint8_t **poutbuf, int *poutbuf_size,
4590  const uint8_t *buf, int buf_size,
4591  int64_t pts, int64_t dts,
4592  int64_t pos);
4593 
4595  AVCodecContext *avctx,
4596  uint8_t **poutbuf, int *poutbuf_size,
4597  const uint8_t *buf, int buf_size, int keyframe);
4599 
4602  void *priv_data;
4607 
4609 typedef struct AVBitStreamFilter {
4610  const char *name;
4612  int (*filter)(AVBitStreamFilterContext *bsfc,
4613  AVCodecContext *avctx, const char *args,
4614  uint8_t **poutbuf, int *poutbuf_size,
4615  const uint8_t *buf, int buf_size, int keyframe);
4617  struct AVBitStreamFilter *next;
4619 
4623  AVCodecContext *avctx, const char *args,
4624  uint8_t **poutbuf, int *poutbuf_size,
4625  const uint8_t *buf, int buf_size, int keyframe);
4627 
4629 
4630 /* memory */
4631 
4637 void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
4638 
4651 void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
4652 
4656 void av_picture_copy(AVPicture *dst, const AVPicture *src,
4657  enum PixelFormat pix_fmt, int width, int height);
4658 
4662 int av_picture_crop(AVPicture *dst, const AVPicture *src,
4663  enum PixelFormat pix_fmt, int top_band, int left_band);
4664 
4668 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
4669  int padtop, int padbottom, int padleft, int padright, int *color);
4670 
4678 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
4679 
4692 void av_log_missing_feature(void *avc, const char *feature, int want_sample);
4693 
4702 void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3);
4703 
4707 void av_register_hwaccel(AVHWAccel *hwaccel);
4708 
4715 
4716 
4720 enum AVLockOp {
4724  AV_LOCK_DESTROY,
4725 };
4726 
4740 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
4741 
4746 
4753 const AVClass *avcodec_get_class(void);
4754 
4760 
4761 #endif /* AVCODEC_AVCODEC_H */