diff --git a/linux/x86/include/libavutil/ffversion.h b/linux/x86/include/libavutil/ffversion.h index 2e2a1ec2..4fa9278a 100644 --- a/linux/x86/include/libavutil/ffversion.h +++ b/linux/x86/include/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "81379c5" +#define FFMPEG_VERSION "aa09a9a" #endif /* AVUTIL_FFVERSION_H */ diff --git a/linux/x86/lib/libavcodec.a b/linux/x86/lib/libavcodec.a index 0d9c68f8..f8d66191 100644 Binary files a/linux/x86/lib/libavcodec.a and b/linux/x86/lib/libavcodec.a differ diff --git a/linux/x86/lib/libavformat.a b/linux/x86/lib/libavformat.a index a62c5c3c..d8e3009b 100644 Binary files a/linux/x86/lib/libavformat.a and b/linux/x86/lib/libavformat.a differ diff --git a/linux/x86/lib/libavutil.a b/linux/x86/lib/libavutil.a index 10677994..f09ab79d 100644 Binary files a/linux/x86/lib/libavutil.a and b/linux/x86/lib/libavutil.a differ diff --git a/linux/x86/lib/libswresample.a b/linux/x86/lib/libswresample.a index 0f7b912b..0fd3a501 100644 Binary files a/linux/x86/lib/libswresample.a and b/linux/x86/lib/libswresample.a differ diff --git a/linux/x86/lib/libswscale.a b/linux/x86/lib/libswscale.a index 75571240..26e17d43 100644 Binary files a/linux/x86/lib/libswscale.a and b/linux/x86/lib/libswscale.a differ diff --git a/linux/x86_64/include/libavcodec/avcodec.h b/linux/x86_64/include/libavcodec/avcodec.h index 4aeb57ae..d8497655 100644 --- a/linux/x86_64/include/libavcodec/avcodec.h +++ b/linux/x86_64/include/libavcodec/avcodec.h @@ -93,8 +93,7 @@ * * If you add a codec ID to this list, add it so that * 1. no value of a existing codec ID changes (that would break ABI), - * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec. - * This ensures that 2 forks can independently add AVCodecIDs without producing conflicts. + * 2. it is as close as possible to similar codecs * * After adding new codec IDs, do not forget to add an entry to the codec * descriptor list and bump libavcodec minor version. @@ -242,7 +241,7 @@ enum AVCodecID { AV_CODEC_ID_ANM, AV_CODEC_ID_BINKVIDEO, AV_CODEC_ID_IFF_ILBM, - AV_CODEC_ID_IFF_BYTERUN1, +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM AV_CODEC_ID_KGV1, AV_CODEC_ID_YOP, AV_CODEC_ID_VP8, @@ -275,54 +274,48 @@ enum AVCodecID { AV_CODEC_ID_MSS2, AV_CODEC_ID_VP9, AV_CODEC_ID_AIC, - AV_CODEC_ID_ESCAPE130_DEPRECATED, - AV_CODEC_ID_G2M_DEPRECATED, - AV_CODEC_ID_WEBP_DEPRECATED, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, AV_CODEC_ID_HNM4_VIDEO, - AV_CODEC_ID_HEVC_DEPRECATED, + AV_CODEC_ID_HEVC, +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC AV_CODEC_ID_FIC, AV_CODEC_ID_ALIAS_PIX, - AV_CODEC_ID_BRENDER_PIX_DEPRECATED, - AV_CODEC_ID_PAF_VIDEO_DEPRECATED, - AV_CODEC_ID_EXR_DEPRECATED, - AV_CODEC_ID_VP7_DEPRECATED, - AV_CODEC_ID_SANM_DEPRECATED, - AV_CODEC_ID_SGIRLE_DEPRECATED, - AV_CODEC_ID_MVC1_DEPRECATED, - AV_CODEC_ID_MVC2_DEPRECATED, + AV_CODEC_ID_BRENDER_PIX, + AV_CODEC_ID_PAF_VIDEO, + AV_CODEC_ID_EXR, + AV_CODEC_ID_VP7, + AV_CODEC_ID_SANM, + AV_CODEC_ID_SGIRLE, + AV_CODEC_ID_MVC1, + AV_CODEC_ID_MVC2, AV_CODEC_ID_HQX, AV_CODEC_ID_TDSC, AV_CODEC_ID_HQ_HQA, - - AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'), - AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), - AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), - AV_CODEC_ID_EXR = MKBETAG('0','E','X','R'), - AV_CODEC_ID_AVRP = MKBETAG('A','V','R','P'), - - AV_CODEC_ID_012V = MKBETAG('0','1','2','V'), - AV_CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), - AV_CODEC_ID_AVUI = MKBETAG('A','V','U','I'), - AV_CODEC_ID_AYUV = MKBETAG('A','Y','U','V'), - AV_CODEC_ID_TARGA_Y216 = MKBETAG('T','2','1','6'), - AV_CODEC_ID_V308 = MKBETAG('V','3','0','8'), - AV_CODEC_ID_V408 = MKBETAG('V','4','0','8'), - AV_CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), - AV_CODEC_ID_SANM = MKBETAG('S','A','N','M'), - AV_CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'), - AV_CODEC_ID_AVRN = MKBETAG('A','V','R','n'), - AV_CODEC_ID_CPIA = MKBETAG('C','P','I','A'), - AV_CODEC_ID_XFACE = MKBETAG('X','F','A','C'), - AV_CODEC_ID_SGIRLE = MKBETAG('S','G','I','R'), - AV_CODEC_ID_MVC1 = MKBETAG('M','V','C','1'), - AV_CODEC_ID_MVC2 = MKBETAG('M','V','C','2'), - AV_CODEC_ID_SNOW = MKBETAG('S','N','O','W'), - AV_CODEC_ID_WEBP = MKBETAG('W','E','B','P'), - AV_CODEC_ID_SMVJPEG = MKBETAG('S','M','V','J'), - AV_CODEC_ID_HEVC = MKBETAG('H','2','6','5'), -#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC - AV_CODEC_ID_VP7 = MKBETAG('V','P','7','0'), - AV_CODEC_ID_APNG = MKBETAG('A','P','N','G'), + AV_CODEC_ID_HAP, + AV_CODEC_ID_DDS, + AV_CODEC_ID_DXV, + AV_CODEC_ID_SCREENPRESSO, + AV_CODEC_ID_RSCC, + + AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_AVRP, + AV_CODEC_ID_012V, + AV_CODEC_ID_AVUI, + AV_CODEC_ID_AYUV, + AV_CODEC_ID_TARGA_Y216, + AV_CODEC_ID_V308, + AV_CODEC_ID_V408, + AV_CODEC_ID_YUV4, + AV_CODEC_ID_AVRN, + AV_CODEC_ID_CPIA, + AV_CODEC_ID_XFACE, + AV_CODEC_ID_SNOW, + AV_CODEC_ID_SMVJPEG, + AV_CODEC_ID_APNG, + AV_CODEC_ID_DAALA, + AV_CODEC_ID_CFHD, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -354,11 +347,12 @@ enum AVCodecID { AV_CODEC_ID_PCM_LXF, AV_CODEC_ID_S302M, AV_CODEC_ID_PCM_S8_PLANAR, - AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED, - AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED, - AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'), - AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'), - AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16), + AV_CODEC_ID_PCM_S24LE_PLANAR, + AV_CODEC_ID_PCM_S32LE_PLANAR, + AV_CODEC_ID_PCM_S16BE_PLANAR, + /* new PCM "codecs" should be added right below this line starting with + * an explicit value of for example 0x10800 + */ /* various ADPCM codecs */ AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, @@ -391,16 +385,19 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_IMA_ISS, AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, - AV_CODEC_ID_ADPCM_VIMA_DEPRECATED, - AV_CODEC_ID_ADPCM_VIMA = MKBETAG('V','I','M','A'), + AV_CODEC_ID_ADPCM_VIMA, #if FF_API_VIMA_DECODER - AV_CODEC_ID_VIMA = MKBETAG('V','I','M','A'), + AV_CODEC_ID_VIMA = AV_CODEC_ID_ADPCM_VIMA, #endif - AV_CODEC_ID_ADPCM_AFC = MKBETAG('A','F','C',' '), - AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '), - AV_CODEC_ID_ADPCM_DTK = MKBETAG('D','T','K',' '), - AV_CODEC_ID_ADPCM_IMA_RAD = MKBETAG('R','A','D',' '), - AV_CODEC_ID_ADPCM_G726LE = MKBETAG('6','2','7','G'), + + AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_IMA_OKI, + AV_CODEC_ID_ADPCM_DTK, + AV_CODEC_ID_ADPCM_IMA_RAD, + AV_CODEC_ID_ADPCM_G726LE, + AV_CODEC_ID_ADPCM_THP_LE, + AV_CODEC_ID_ADPCM_PSX, + AV_CODEC_ID_ADPCM_AICA, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -416,6 +413,8 @@ enum AVCodecID { AV_CODEC_ID_XAN_DPCM, AV_CODEC_ID_SOL_DPCM, + AV_CODEC_ID_SDX2_DPCM = 0x14800, + /* audio codecs */ AV_CODEC_ID_MP2 = 0x15000, AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 @@ -480,25 +479,27 @@ enum AVCodecID { AV_CODEC_ID_RALF, AV_CODEC_ID_IAC, AV_CODEC_ID_ILBC, - AV_CODEC_ID_OPUS_DEPRECATED, + AV_CODEC_ID_OPUS, AV_CODEC_ID_COMFORT_NOISE, - AV_CODEC_ID_TAK_DEPRECATED, + AV_CODEC_ID_TAK, AV_CODEC_ID_METASOUND, - AV_CODEC_ID_PAF_AUDIO_DEPRECATED, + AV_CODEC_ID_PAF_AUDIO, AV_CODEC_ID_ON2AVC, AV_CODEC_ID_DSS_SP, - AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'), - AV_CODEC_ID_SONIC = MKBETAG('S','O','N','C'), - AV_CODEC_ID_SONIC_LS = MKBETAG('S','O','N','L'), - AV_CODEC_ID_PAF_AUDIO = MKBETAG('P','A','F','A'), - AV_CODEC_ID_OPUS = MKBETAG('O','P','U','S'), - AV_CODEC_ID_TAK = MKBETAG('t','B','a','K'), - AV_CODEC_ID_EVRC = MKBETAG('s','e','v','c'), - AV_CODEC_ID_SMV = MKBETAG('s','s','m','v'), - AV_CODEC_ID_DSD_LSBF = MKBETAG('D','S','D','L'), - AV_CODEC_ID_DSD_MSBF = MKBETAG('D','S','D','M'), - AV_CODEC_ID_DSD_LSBF_PLANAR = MKBETAG('D','S','D','1'), - AV_CODEC_ID_DSD_MSBF_PLANAR = MKBETAG('D','S','D','8'), + + AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_SONIC, + AV_CODEC_ID_SONIC_LS, + AV_CODEC_ID_EVRC, + AV_CODEC_ID_SMV, + AV_CODEC_ID_DSD_LSBF, + AV_CODEC_ID_DSD_MSBF, + AV_CODEC_ID_DSD_LSBF_PLANAR, + AV_CODEC_ID_DSD_MSBF_PLANAR, + AV_CODEC_ID_4GV, + AV_CODEC_ID_INTERPLAY_ACM, + AV_CODEC_ID_XMA1, + AV_CODEC_ID_XMA2, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -511,32 +512,35 @@ enum AVCodecID { AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT, AV_CODEC_ID_SRT, - AV_CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'), - AV_CODEC_ID_EIA_608 = MKBETAG('c','6','0','8'), - AV_CODEC_ID_JACOSUB = MKBETAG('J','S','U','B'), - AV_CODEC_ID_SAMI = MKBETAG('S','A','M','I'), - AV_CODEC_ID_REALTEXT = MKBETAG('R','T','X','T'), - AV_CODEC_ID_STL = MKBETAG('S','p','T','L'), - AV_CODEC_ID_SUBVIEWER1 = MKBETAG('S','b','V','1'), - AV_CODEC_ID_SUBVIEWER = MKBETAG('S','u','b','V'), - AV_CODEC_ID_SUBRIP = MKBETAG('S','R','i','p'), - AV_CODEC_ID_WEBVTT = MKBETAG('W','V','T','T'), - AV_CODEC_ID_MPL2 = MKBETAG('M','P','L','2'), - AV_CODEC_ID_VPLAYER = MKBETAG('V','P','l','r'), - AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), - AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska + + AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_EIA_608, + AV_CODEC_ID_JACOSUB, + AV_CODEC_ID_SAMI, + AV_CODEC_ID_REALTEXT, + AV_CODEC_ID_STL, + AV_CODEC_ID_SUBVIEWER1, + AV_CODEC_ID_SUBVIEWER, + AV_CODEC_ID_SUBRIP, + AV_CODEC_ID_WEBVTT, + AV_CODEC_ID_MPL2, + AV_CODEC_ID_VPLAYER, + AV_CODEC_ID_PJS, + AV_CODEC_ID_ASS, + AV_CODEC_ID_HDMV_TEXT_SUBTITLE, /* other specific kind of codecs (generally used for attachments) */ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. AV_CODEC_ID_TTF = 0x18000, - AV_CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'), - AV_CODEC_ID_XBIN = MKBETAG('X','B','I','N'), - AV_CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'), - AV_CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'), - AV_CODEC_ID_SMPTE_KLV = MKBETAG('K','L','V','A'), - AV_CODEC_ID_DVD_NAV = MKBETAG('D','N','A','V'), - AV_CODEC_ID_TIMED_ID3 = MKBETAG('T','I','D','3'), - AV_CODEC_ID_BIN_DATA = MKBETAG('D','A','T','A'), + + AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_XBIN, + AV_CODEC_ID_IDF, + AV_CODEC_ID_OTF, + AV_CODEC_ID_SMPTE_KLV, + AV_CODEC_ID_DVD_NAV, + AV_CODEC_ID_TIMED_ID3, + AV_CODEC_ID_BIN_DATA, AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it @@ -546,10 +550,7 @@ enum AVCodecID { AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems * stream (only used by libavformat) */ AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. - -#if FF_API_CODEC_ID -#include "old_codec_ids.h" -#endif + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket }; /** @@ -574,13 +575,17 @@ typedef struct AVCodecDescriptor { * Codec properties, a combination of AV_CODEC_PROP_* flags. */ int props; - /** * MIME type(s) associated with the codec. * May be NULL; if not, a NULL-terminated array of MIME types. * The first item is always non-NULL and is the preferred MIME type. */ const char *const *mime_types; + /** + * If non-NULL, an array of profiles recognized for this codec. + * Terminated with FF_PROFILE_UNKNOWN. + */ + const struct AVProfile *profiles; } AVCodecDescriptor; /** @@ -627,20 +632,33 @@ typedef struct AVCodecDescriptor { * Note: If the first 23 bits of the additional bytes are not 0, then damaged * MPEG bitstreams could cause overread and segfault. */ -#define FF_INPUT_BUFFER_PADDING_SIZE 32 +#define AV_INPUT_BUFFER_PADDING_SIZE 32 /** * @ingroup lavc_encoding * minimum encoding buffer size * Used to avoid some checks during header writing. */ -#define FF_MIN_BUFFER_SIZE 16384 +#define AV_INPUT_BUFFER_MIN_SIZE 16384 +#if FF_API_WITHOUT_PREFIX +/** + * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 32 + +/** + * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead + */ +#define FF_MIN_BUFFER_SIZE 16384 +#endif /* FF_API_WITHOUT_PREFIX */ /** * @ingroup lavc_encoding * motion estimation type. + * @deprecated use codec private option instead */ +#if FF_API_MOTION_EST enum Motion_Est_ID { ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed ME_FULL, @@ -653,6 +671,7 @@ enum Motion_Est_ID { ME_TESA, ///< transformed exhaustive search algorithm ME_ITER=50, ///< iterative search }; +#endif /** * @ingroup lavc_decoding @@ -708,11 +727,232 @@ typedef struct RcOverride{ * Allow decoders to produce frames with data planes that are not aligned * to CPU requirements (e.g. due to cropping). */ -#define CODEC_FLAG_UNALIGNED 0x0001 -#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. -#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. -#define CODEC_FLAG_OUTPUT_CORRUPT 0x0008 ///< Output even those frames that might be corrupted -#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. +#define AV_CODEC_FLAG_UNALIGNED (1 << 0) +/** + * Use fixed qscale. + */ +#define AV_CODEC_FLAG_QSCALE (1 << 1) +/** + * 4 MV per MB allowed / advanced prediction for H.263. + */ +#define AV_CODEC_FLAG_4MV (1 << 2) +/** + * Output even those frames that might be corrupted. + */ +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3) +/** + * Use qpel MC. + */ +#define AV_CODEC_FLAG_QPEL (1 << 4) +/** + * Use internal 2pass ratecontrol in first pass mode. + */ +#define AV_CODEC_FLAG_PASS1 (1 << 9) +/** + * Use internal 2pass ratecontrol in second pass mode. + */ +#define AV_CODEC_FLAG_PASS2 (1 << 10) +/** + * loop filter. + */ +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11) +/** + * Only decode/encode grayscale. + */ +#define AV_CODEC_FLAG_GRAY (1 << 13) +/** + * error[?] variables will be set during encoding. + */ +#define AV_CODEC_FLAG_PSNR (1 << 15) +/** + * Input bitstream might be truncated at a random location + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG_TRUNCATED (1 << 16) +/** + * Use interlaced DCT. + */ +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18) +/** + * Force low delay. + */ +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19) +/** + * Place global headers in extradata instead of every keyframe. + */ +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) +/** + * Use only bitexact stuff (except (I)DCT). + */ +#define AV_CODEC_FLAG_BITEXACT (1 << 23) +/* Fx : Flag for h263+ extra options */ +/** + * H.263 advanced intra coding / MPEG-4 AC prediction + */ +#define AV_CODEC_FLAG_AC_PRED (1 << 24) +/** + * interlaced motion estimation + */ +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29) +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31) + +/** + * Allow non spec compliant speedup tricks. + */ +#define AV_CODEC_FLAG2_FAST (1 << 0) +/** + * Skip bitstream encoding. + */ +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2) +/** + * Place global headers at every keyframe instead of in extradata. + */ +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3) + +/** + * timecode is in drop frame format. DEPRECATED!!!! + */ +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13) + +/** + * Input bitstream might be truncated at a packet boundaries + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG2_CHUNKS (1 << 15) +/** + * Discard cropping information from SPS. + */ +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16) + +/** + * Show all frames before the first keyframe + */ +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) +/** + * Export motion vectors through frame side data + */ +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28) +/** + * Do not skip samples and export skip information as frame side data + */ +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29) + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +/** + * Decoder can use draw_horiz_band callback. + */ +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0) +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define AV_CODEC_CAP_DR1 (1 << 1) +#define AV_CODEC_CAP_TRUNCATED (1 << 3) +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define AV_CODEC_CAP_DELAY (1 << 5) +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) + +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define AV_CODEC_CAP_HWACCEL_VDPAU (1 << 7) +#endif + +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define AV_CODEC_CAP_SUBFRAMES (1 << 8) +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9) +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10) +/** + * Codec supports frame-level multithreading. + */ +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12) +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13) +/** + * Codec supports changed parameters at any point. + */ +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14) +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define AV_CODEC_CAP_AUTO_THREADS (1 << 15) +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16) +/** + * Codec is intra only. + */ +#define AV_CODEC_CAP_INTRA_ONLY 0x40000000 +/** + * Codec is lossless. + */ +#define AV_CODEC_CAP_LOSSLESS 0x80000000 + + +#if FF_API_WITHOUT_PREFIX +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define CODEC_FLAG_UNALIGNED AV_CODEC_FLAG_UNALIGNED +#define CODEC_FLAG_QSCALE AV_CODEC_FLAG_QSCALE +#define CODEC_FLAG_4MV AV_CODEC_FLAG_4MV +#define CODEC_FLAG_OUTPUT_CORRUPT AV_CODEC_FLAG_OUTPUT_CORRUPT +#define CODEC_FLAG_QPEL AV_CODEC_FLAG_QPEL #if FF_API_GMC /** * @deprecated use the "gmc" private option of the libxvid encoder @@ -733,9 +973,9 @@ typedef struct RcOverride{ */ #define CODEC_FLAG_INPUT_PRESERVED 0x0100 #endif -#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. -#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. -#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. +#define CODEC_FLAG_PASS1 AV_CODEC_FLAG_PASS1 +#define CODEC_FLAG_PASS2 AV_CODEC_FLAG_PASS2 +#define CODEC_FLAG_GRAY AV_CODEC_FLAG_GRAY #if FF_API_EMU_EDGE /** * @deprecated edges are not used/required anymore. I.e. this flag is now always @@ -743,9 +983,9 @@ typedef struct RcOverride{ */ #define CODEC_FLAG_EMU_EDGE 0x4000 #endif -#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. -#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random - location instead of only at frame boundaries. */ +#define CODEC_FLAG_PSNR AV_CODEC_FLAG_PSNR +#define CODEC_FLAG_TRUNCATED AV_CODEC_FLAG_TRUNCATED + #if FF_API_NORMALIZE_AQP /** * @deprecated use the flag "naq" in the "mpv_flags" private option of the @@ -753,25 +993,24 @@ typedef struct RcOverride{ */ #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 #endif -#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. -#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. -#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. -#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). -/* Fx : Flag for h263+ extra options */ -#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction -#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter -#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation -#define CODEC_FLAG_CLOSED_GOP 0x80000000 -#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. -#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. -#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. -#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. DEPRECATED!!!! -#define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS. - -#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. -#define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe -#define CODEC_FLAG2_EXPORT_MVS 0x10000000 ///< Export motion vectors through frame side data -#define CODEC_FLAG2_SKIP_MANUAL 0x20000000 ///< Do not skip samples and export skip information as frame side data +#define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT +#define CODEC_FLAG_LOW_DELAY AV_CODEC_FLAG_LOW_DELAY +#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER +#define CODEC_FLAG_BITEXACT AV_CODEC_FLAG_BITEXACT +#define CODEC_FLAG_AC_PRED AV_CODEC_FLAG_AC_PRED +#define CODEC_FLAG_LOOP_FILTER AV_CODEC_FLAG_LOOP_FILTER +#define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME +#define CODEC_FLAG_CLOSED_GOP AV_CODEC_FLAG_CLOSED_GOP +#define CODEC_FLAG2_FAST AV_CODEC_FLAG2_FAST +#define CODEC_FLAG2_NO_OUTPUT AV_CODEC_FLAG2_NO_OUTPUT +#define CODEC_FLAG2_LOCAL_HEADER AV_CODEC_FLAG2_LOCAL_HEADER +#define CODEC_FLAG2_DROP_FRAME_TIMECODE AV_CODEC_FLAG2_DROP_FRAME_TIMECODE +#define CODEC_FLAG2_IGNORE_CROP AV_CODEC_FLAG2_IGNORE_CROP + +#define CODEC_FLAG2_CHUNKS AV_CODEC_FLAG2_CHUNKS +#define CODEC_FLAG2_SHOW_ALL AV_CODEC_FLAG2_SHOW_ALL +#define CODEC_FLAG2_EXPORT_MVS AV_CODEC_FLAG2_EXPORT_MVS +#define CODEC_FLAG2_SKIP_MANUAL AV_CODEC_FLAG2_SKIP_MANUAL /* Unsupported options : * Syntax Arithmetic coding (SAC) @@ -780,14 +1019,14 @@ typedef struct RcOverride{ /* /Fx */ /* codec capabilities */ -#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. +#define CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DRAW_HORIZ_BAND ///< Decoder can use draw_horiz_band callback. /** * Codec uses get_buffer() for allocating buffers and supports custom allocators. * If not set, it might not use get_buffer() at all or use operations that * assume the buffer was allocated by avcodec_default_get_buffer. */ -#define CODEC_CAP_DR1 0x0002 -#define CODEC_CAP_TRUNCATED 0x0008 +#define CODEC_CAP_DR1 AV_CODEC_CAP_DR1 +#define CODEC_CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED #if FF_API_XVMC /* Codec can export data for HW decoding. This flag indicates that * the codec would call get_format() with list that might contain HW accelerated @@ -821,17 +1060,17 @@ typedef struct RcOverride{ * each output packet. If this flag is not set, the pts and duration will * be determined by libavcodec from the input frame. */ -#define CODEC_CAP_DELAY 0x0020 +#define CODEC_CAP_DELAY AV_CODEC_CAP_DELAY /** * Codec can be fed a final frame with a smaller size. * This can be used to prevent truncation of the last audio samples. */ -#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +#define CODEC_CAP_SMALL_LAST_FRAME AV_CODEC_CAP_SMALL_LAST_FRAME #if FF_API_CAP_VDPAU /** * Codec can export data for HW decoding (VDPAU). */ -#define CODEC_CAP_HWACCEL_VDPAU 0x0080 +#define CODEC_CAP_HWACCEL_VDPAU AV_CODEC_CAP_HWACCEL_VDPAU #endif /** * Codec can output multiple frames per AVPacket @@ -844,16 +1083,16 @@ typedef struct RcOverride{ * prohibiting stream copy in many cases thus it should only be considered * as a last resort. */ -#define CODEC_CAP_SUBFRAMES 0x0100 +#define CODEC_CAP_SUBFRAMES AV_CODEC_CAP_SUBFRAMES /** * Codec is experimental and is thus avoided in favor of non experimental * encoders */ -#define CODEC_CAP_EXPERIMENTAL 0x0200 +#define CODEC_CAP_EXPERIMENTAL AV_CODEC_CAP_EXPERIMENTAL /** * Codec should fill in channel configuration and samplerate instead of container */ -#define CODEC_CAP_CHANNEL_CONF 0x0400 +#define CODEC_CAP_CHANNEL_CONF AV_CODEC_CAP_CHANNEL_CONF #if FF_API_NEG_LINESIZES /** * @deprecated no codecs use this capability @@ -863,31 +1102,38 @@ typedef struct RcOverride{ /** * Codec supports frame-level multithreading. */ -#define CODEC_CAP_FRAME_THREADS 0x1000 +#define CODEC_CAP_FRAME_THREADS AV_CODEC_CAP_FRAME_THREADS /** * Codec supports slice-based (or partition-based) multithreading. */ -#define CODEC_CAP_SLICE_THREADS 0x2000 +#define CODEC_CAP_SLICE_THREADS AV_CODEC_CAP_SLICE_THREADS /** * Codec supports changed parameters at any point. */ -#define CODEC_CAP_PARAM_CHANGE 0x4000 +#define CODEC_CAP_PARAM_CHANGE AV_CODEC_CAP_PARAM_CHANGE /** * Codec supports avctx->thread_count == 0 (auto). */ -#define CODEC_CAP_AUTO_THREADS 0x8000 +#define CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_AUTO_THREADS /** * Audio encoder supports receiving a different number of samples in each call. */ -#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 +#define CODEC_CAP_VARIABLE_FRAME_SIZE AV_CODEC_CAP_VARIABLE_FRAME_SIZE /** * Codec is intra only. */ -#define CODEC_CAP_INTRA_ONLY 0x40000000 +#define CODEC_CAP_INTRA_ONLY AV_CODEC_CAP_INTRA_ONLY /** * Codec is lossless. */ -#define CODEC_CAP_LOSSLESS 0x80000000 +#define CODEC_CAP_LOSSLESS AV_CODEC_CAP_LOSSLESS + +/** + * HWAccel is experimental and is thus avoided in favor of non experimental + * codecs + */ +#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200 +#endif /* FF_API_WITHOUT_PREFIX */ #if FF_API_MB_TYPE //The following defines may change, don't expect compatibility if you use them. @@ -944,6 +1190,44 @@ typedef struct AVPanScan{ int16_t position[3][2]; }AVPanScan; +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + #if FF_API_QSCALE_TYPE #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 @@ -951,18 +1235,6 @@ typedef struct AVPanScan{ #define FF_QSCALE_TYPE_VP56 3 #endif -#if FF_API_GET_BUFFER -#define FF_BUFFER_TYPE_INTERNAL 1 -#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) -#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. -#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. - -#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). -#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. -#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. -#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). -#endif - /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -1043,6 +1315,31 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_AUDIO_SERVICE_TYPE, + /** + * This side data contains quality related information from the encoder. + * @code + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad). + * u8 picture type + * u8 error count + * u16 reserved + * u64le[error count] sum of squared differences between encoder in and output + * @endcode + */ + AV_PKT_DATA_QUALITY_STATS, + + /** + * This side data contains an integer value representing the stream index + * of a "fallback" track. A fallback track indicates an alternate + * track to use when the current track can not be decoded for some reason. + * e.g. no decoder available for codec. + */ + AV_PKT_DATA_FALLBACK_TRACK, + + /** + * This side data corresponds to the AVCPBProperties struct. + */ + AV_PKT_DATA_CPB_PROPERTIES, + /** * Recommmends skipping the specified number of samples * @code @@ -1108,6 +1405,8 @@ enum AVPacketSideDataType { AV_PKT_DATA_METADATA_UPDATE, }; +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED + typedef struct AVPacketSideData { uint8_t *data; int size; @@ -1120,21 +1419,27 @@ typedef struct AVPacketSideData { * then passed to muxers. * * For video, it should typically contain one compressed frame. For audio it may - * contain several compressed frames. + * contain several compressed frames. Encoders are allowed to output empty + * packets, with no compressed data, containing only side data + * (e.g. to update some stream parameters at the end of encoding). * * AVPacket is one of the few structs in FFmpeg, whose size is a part of public * ABI. Thus it may be allocated on stack and no new fields can be added to it * without libavcodec and libavformat major bump. * - * The semantics of data ownership depends on the buf or destruct (deprecated) - * fields. If either is set, the packet data is dynamically allocated and is - * valid indefinitely until av_free_packet() is called (which in turn calls - * av_buffer_unref()/the destruct callback to free the data). If neither is set, - * the packet data is typically backed by some static buffer somewhere and is - * only valid for a limited time (e.g. until the next read call when demuxing). + * The semantics of data ownership depends on the buf field. + * If it is set, the packet data is dynamically allocated and is + * valid indefinitely until a call to av_packet_unref() reduces the + * reference count to 0. + * + * If the buf field is not set av_packet_ref() would make a copy instead + * of increasing the reference count. + * + * The side data is always allocated with av_malloc(), copied by + * av_packet_ref() and freed by av_packet_unref(). * - * The side data is always allocated with av_malloc() and is freed in - * av_free_packet(). + * @see av_packet_ref + * @see av_packet_unref */ typedef struct AVPacket { /** @@ -1177,33 +1482,19 @@ typedef struct AVPacket { * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. */ - int duration; -#if FF_API_DESTRUCT_PACKET - attribute_deprecated - void (*destruct)(struct AVPacket *); - attribute_deprecated - void *priv; -#endif + int64_t duration; + int64_t pos; ///< byte position in stream, -1 if unknown +#if FF_API_CONVERGENCE_DURATION /** - * Time difference in AVStream->time_base units from the pts of this - * packet to the point at which the output from the decoder has converged - * independent from the availability of previous frames. That is, the - * frames are virtually identical no matter if decoding started from - * the very first frame or from this keyframe. - * Is AV_NOPTS_VALUE if unknown. - * This field is not the display duration of the current packet. - * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY - * set. - * - * The purpose of this field is to allow seeking in streams that have no - * keyframes in the conventional sense. It corresponds to the - * recovery point SEI in H.264 and match_time_delta in NUT. It is also - * essential for some types of subtitle streams to ensure that all - * subtitles are correctly displayed after seeking. + * @deprecated Same as the duration field, but as int64_t. This was required + * for Matroska subtitles, whose duration values could overflow when the + * duration field was still an int. */ + attribute_deprecated int64_t convergence_duration; +#endif } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted @@ -1300,9 +1591,10 @@ typedef struct AVCodecContext { /** * the average bitrate * - encoding: Set by user; unused for constant quantizer encoding. - * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + * - decoding: Set by user, may be overwritten by libavcodec + * if this info is available in the stream */ - int bit_rate; + int64_t bit_rate; /** * number of bits the bitstream is allowed to diverge from the reference. @@ -1328,14 +1620,14 @@ typedef struct AVCodecContext { #define FF_COMPRESSION_DEFAULT -1 /** - * CODEC_FLAG_*. + * AV_CODEC_FLAG_*. * - encoding: Set by user. * - decoding: Set by user. */ int flags; /** - * CODEC_FLAG2_* + * AV_CODEC_FLAG2_* * - encoding: Set by user. * - decoding: Set by user. */ @@ -1346,7 +1638,7 @@ typedef struct AVCodecContext { * mjpeg: Huffman tables * rv10: additional flags * mpeg4: global headers (they can be in the bitstream or here) - * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger * than extradata_size to avoid problems if it is read with the bitstream reader. * The bytewise contents of extradata must not depend on the architecture or CPU endianness. * - encoding: Set/allocated/freed by libavcodec. @@ -1405,21 +1697,31 @@ typedef struct AVCodecContext { /* video only */ /** * picture width / height. + * + * @note Those fields may not match the values of the last + * AVFrame outputted by avcodec_decode_video2 due frame + * reordering. + * * - encoding: MUST be set by user. * - decoding: May be set by the user before opening the decoder if known e.g. * from the container. Some decoders will require the dimensions * to be set by the caller. During decoding, the decoder may - * overwrite those values as required. + * overwrite those values as required while parsing the data. */ int width, height; /** * Bitstream width / height, may be different from width/height e.g. when * the decoded frame is cropped before being output or lowres is enabled. + * + * @note Those field may not match the value of the last + * AVFrame outputted by avcodec_decode_video2 due frame + * reordering. + * * - encoding: unused * - decoding: May be set by the user before opening the decoder if known * e.g. from the container. During decoding, the decoder may - * overwrite those values as required. + * overwrite those values as required while parsing the data. */ int coded_width, coded_height; @@ -1438,19 +1740,24 @@ typedef struct AVCodecContext { * Pixel format, see AV_PIX_FMT_xxx. * May be set by the demuxer if known from headers. * May be overridden by the decoder if it knows better. + * + * @note This field may not match the value of the last + * AVFrame outputted by avcodec_decode_video2 due frame + * reordering. + * * - encoding: Set by user. - * - decoding: Set by user if known, overridden by libavcodec if known + * - decoding: Set by user if known, overridden by libavcodec while + * parsing the data. */ enum AVPixelFormat pix_fmt; +#if FF_API_MOTION_EST /** - * Motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused + * This option does nothing + * @deprecated use codec private options instead */ - int me_method; + attribute_deprecated int me_method; +#endif /** * If non NULL, 'draw_horiz_band' is called by the libavcodec @@ -1511,11 +1818,17 @@ typedef struct AVCodecContext { */ float b_quant_factor; - /** obsolete FIXME remove */ - int rc_strategy; +#if FF_API_RC_STRATEGY + /** @deprecated use codec private option instead */ + attribute_deprecated int rc_strategy; #define FF_RC_STRATEGY_XVID 1 +#endif +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int b_frame_strategy; +#endif /** * qscale offset between IP and B-frames @@ -1532,12 +1845,11 @@ typedef struct AVCodecContext { */ int has_b_frames; - /** - * 0-> h263 quant 1-> mpeg quant - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int mpeg_quant; +#endif /** * qscale factor between P and I-frames @@ -1596,15 +1908,15 @@ typedef struct AVCodecContext { * - decoding: Set by user (or 0). */ int slice_count; - /** - * prediction method (needed for huffyuv) - * - encoding: Set by user. - * - decoding: unused - */ + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int prediction_method; #define FF_PRED_LEFT 0 #define FF_PRED_PLANE 1 #define FF_PRED_MEDIAN 2 +#endif /** * slice offsets in the frame in bytes @@ -1677,12 +1989,11 @@ typedef struct AVCodecContext { */ int last_predictor_count; - /** - * prepass for motion estimation - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int pre_me; +#endif /** * motion estimation prepass comparison function @@ -1734,20 +2045,18 @@ typedef struct AVCodecContext { */ int me_range; +#if FF_API_QUANT_BIAS /** - * intra quantizer bias - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private option instead */ - int intra_quant_bias; + attribute_deprecated int intra_quant_bias; #define FF_DEFAULT_QUANT_BIAS 999999 /** - * inter quantizer bias - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private option instead */ - int inter_quant_bias; + attribute_deprecated int inter_quant_bias; +#endif /** * slice flags @@ -1793,20 +2102,15 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; - /** - * scene change detection threshold - * 0 is default, larger means fewer detected scene changes. - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int scenechange_threshold; - /** - * noise reduction strength - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int noise_reduction; +#endif #if FF_API_MPV_OPT /** @@ -1865,12 +2169,13 @@ typedef struct AVCodecContext { */ int mb_lmax; +#if FF_API_PRIVATE_OPT /** - * - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated int me_penalty_compensation; +#endif /** * @@ -1879,12 +2184,11 @@ typedef struct AVCodecContext { */ int bidir_refine; - /** - * - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int brd_scale; +#endif /** * minimum GOP size @@ -1900,12 +2204,11 @@ typedef struct AVCodecContext { */ int refs; - /** - * chroma qp offset from luma - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int chromaoffset; +#endif #if FF_API_UNUSED_MEMBERS /** @@ -1924,12 +2227,11 @@ typedef struct AVCodecContext { */ int mv0_threshold; - /** - * Adjust sensitivity of b_frame_strategy 1. - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int b_sensitivity; +#endif /** * Chromaticity coordinates of the source primaries. @@ -1998,7 +2300,7 @@ typedef struct AVCodecContext { * * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame * except the last must contain exactly frame_size samples per channel. - * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the * frame size is not restricted. * - decoding: may be set by some decoders to indicate constant frame size */ @@ -2028,16 +2330,6 @@ typedef struct AVCodecContext { */ int cutoff; -#if FF_API_REQUEST_CHANNELS - /** - * Decoder should decode to this many channels if it can (0 for default) - * - encoding: unused - * - decoding: Set by user. - * @deprecated Deprecated in favor of request_channel_layout. - */ - attribute_deprecated int request_channels; -#endif - /** * Audio channel layout. * - encoding: set by user. @@ -2060,108 +2352,12 @@ typedef struct AVCodecContext { enum AVAudioServiceType audio_service_type; /** - * desired sample format - * - encoding: Not used. - * - decoding: Set by user. - * Decoder will decode to this format if it can. - */ - enum AVSampleFormat request_sample_fmt; - -#if FF_API_GET_BUFFER - /** - * Called at the beginning of each frame to get a buffer for it. - * - * The function will set AVFrame.data[], AVFrame.linesize[]. - * AVFrame.extended_data[] must also be set, but it should be the same as - * AVFrame.data[] except for planar audio with more channels than can fit - * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as - * many data pointers as it can hold. - * - * if CODEC_CAP_DR1 is not set then get_buffer() must call - * avcodec_default_get_buffer() instead of providing buffers allocated by - * some other means. - * - * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't - * need it. avcodec_default_get_buffer() aligns the output buffer properly, - * but if get_buffer() is overridden then alignment considerations should - * be taken into account. - * - * @see avcodec_default_get_buffer() - * - * Video: - * - * If pic.reference is set then the frame will be read later by libavcodec. - * avcodec_align_dimensions2() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16. - * - * If frame multithreading is used and thread_safe_callbacks is set, - * it may be called from a different thread, but not from more than one at - * once. Does not need to be reentrant. - * - * @see release_buffer(), reget_buffer() - * @see avcodec_align_dimensions2() - * - * Audio: - * - * Decoders request a buffer of a particular size by setting - * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, - * however, utilize only part of the buffer by setting AVFrame.nb_samples - * to a smaller value in the output frame. - * - * Decoders cannot use the buffer after returning from - * avcodec_decode_audio4(), so they will not call release_buffer(), as it - * is assumed to be released immediately upon return. In some rare cases, - * a decoder may need to call get_buffer() more than once in a single - * call to avcodec_decode_audio4(). In that case, when get_buffer() is - * called again after it has already been called once, the previously - * acquired buffer is assumed to be released at that time and may not be - * reused by the decoder. - * - * As a convenience, av_samples_get_buffer_size() and - * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() - * functions to find the required data size and to fill data pointers and - * linesize. In AVFrame.linesize, only linesize[0] may be set for audio - * since all planes must be the same size. - * - * @see av_samples_get_buffer_size(), av_samples_fill_arrays() - * - * - encoding: unused - * - decoding: Set by libavcodec, user can override. - * - * @deprecated use get_buffer2() - */ - attribute_deprecated - int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * Called to release buffers which were allocated with get_buffer. - * A released buffer can be reused in get_buffer(). - * pic.data[*] must be set to NULL. - * May be called from a different thread if frame multithreading is used, - * but not by more than one thread at once, so does not need to be reentrant. - * - encoding: unused - * - decoding: Set by libavcodec, user can override. - * - * @deprecated custom freeing callbacks should be set from get_buffer2() - */ - attribute_deprecated - void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * Called at the beginning of a frame to get cr buffer for it. - * Buffer type (size, hints) must be the same. libavcodec won't check it. - * libavcodec will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * If pic.data[0] == NULL must behave like get_buffer(). - * if CODEC_CAP_DR1 is not set then reget_buffer() must call - * avcodec_default_reget_buffer() instead of providing buffers allocated by - * some other means. - * - encoding: unused - * - decoding: Set by libavcodec, user can override. + * desired sample format + * - encoding: Not used. + * - decoding: Set by user. + * Decoder will decode to this format if it can. */ - attribute_deprecated - int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); -#endif + enum AVSampleFormat request_sample_fmt; /** * This callback is called at the beginning of each frame to get data @@ -2200,7 +2396,7 @@ typedef struct AVCodecContext { * buffers than buf[] can hold. extended_buf will be freed in * av_frame_unref(). * - * If CODEC_CAP_DR1 is not set then get_buffer2() must call + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call * avcodec_default_get_buffer2() instead of providing buffers allocated by * some other means. * @@ -2322,16 +2518,16 @@ typedef struct AVCodecContext { /** * maximum bitrate * - encoding: Set by user. - * - decoding: Set by libavcodec. + * - decoding: Set by user, may be overwritten by libavcodec. */ - int rc_max_rate; + int64_t rc_max_rate; /** * minimum bitrate * - encoding: Set by user. * - decoding: unused */ - int rc_min_rate; + int64_t rc_min_rate; #if FF_API_MPV_OPT /** @@ -2365,6 +2561,7 @@ typedef struct AVCodecContext { */ int rc_initial_buffer_occupancy; +#if FF_API_CODER_TYPE #define FF_CODER_TYPE_VLC 0 #define FF_CODER_TYPE_AC 1 #define FF_CODER_TYPE_RAW 2 @@ -2373,18 +2570,17 @@ typedef struct AVCodecContext { #define FF_CODER_TYPE_DEFLATE 4 #endif /* FF_API_UNUSED_MEMBERS */ /** - * coder type - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated int coder_type; +#endif /* FF_API_CODER_TYPE */ - /** - * context model - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int context_model; +#endif #if FF_API_MPV_OPT /** @@ -2400,33 +2596,23 @@ typedef struct AVCodecContext { int lmax; #endif - /** - * frame skip threshold - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_threshold; - /** - * frame skip factor - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_factor; - /** - * frame skip exponent - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_exp; - /** - * frame skip comparison function - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_cmp; +#endif /* FF_API_PRIVATE_OPT */ /** * trellis RD quantization @@ -2435,56 +2621,68 @@ typedef struct AVCodecContext { */ int trellis; - /** - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int min_prediction_order; - /** - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int max_prediction_order; - /** - * GOP timecode frame start number - * - encoding: Set by user, in non drop frame format - * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset) - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int64_t timecode_frame_start; +#endif +#if FF_API_RTP_CALLBACK + /** + * @deprecated unused + */ /* The RTP callback: This function is called */ /* every time the encoder has a packet to send. */ /* It depends on the encoder if the data starts */ /* with a Start Code (it should). H.263 does. */ /* mb_nb contains the number of macroblocks */ /* encoded in the RTP payload. */ + attribute_deprecated void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); +#endif +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int rtp_payload_size; /* The size of the RTP payload: the coder will */ /* do its best to deliver a chunk with size */ /* below rtp_payload_size, the chunk will start */ /* with a start code on some codecs like H.263. */ /* This doesn't take account of any particular */ /* headers inside the transmitted RTP payload. */ +#endif +#if FF_API_STAT_BITS /* statistics, used for 2-pass encoding */ + attribute_deprecated int mv_bits; + attribute_deprecated int header_bits; + attribute_deprecated int i_tex_bits; + attribute_deprecated int p_tex_bits; + attribute_deprecated int i_count; + attribute_deprecated int p_count; + attribute_deprecated int skip_count; + attribute_deprecated int misc_bits; - /** - * number of bits used for the previously encoded frame - * - encoding: Set by libavcodec. - * - decoding: unused - */ + /** @deprecated this field is unused */ + attribute_deprecated int frame_bits; +#endif /** * pass1 encoding statistics output buffer @@ -2589,6 +2787,7 @@ typedef struct AVCodecContext { #endif #define FF_DEBUG_BUFFERS 0x00008000 #define FF_DEBUG_THREADS 0x00010000 +#define FF_DEBUG_GREEN_MD 0x00800000 #define FF_DEBUG_NOMC 0x01000000 #if FF_API_DEBUG_MV @@ -2657,7 +2856,7 @@ typedef struct AVCodecContext { /** * error - * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR. * - decoding: unused */ uint64_t error[AV_NUM_DATA_POINTERS]; @@ -2670,9 +2869,7 @@ typedef struct AVCodecContext { int dct_algo; #define FF_DCT_AUTO 0 #define FF_DCT_FASTINT 1 -#if FF_API_UNUSED_MEMBERS #define FF_DCT_INT 2 -#endif /* FF_API_UNUSED_MEMBERS */ #define FF_DCT_MMX 3 #define FF_DCT_ALTIVEC 5 #define FF_DCT_FAAN 6 @@ -2737,12 +2934,16 @@ typedef struct AVCodecContext { int lowres; #endif +#if FF_API_CODED_FRAME /** * the picture in the bitstream * - encoding: Set by libavcodec. * - decoding: unused + * + * @deprecated use the quality factor packet side data instead */ - AVFrame *coded_frame; + attribute_deprecated AVFrame *coded_frame; +#endif /** * thread count @@ -2812,14 +3013,6 @@ typedef struct AVCodecContext { */ int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); -#if FF_API_THREAD_OPAQUE - /** - * @deprecated this field should not be used from outside of lavc - */ - attribute_deprecated - void *thread_opaque; -#endif - /** * noise vs. sse weight for the nsse comparison function * - encoding: Set by user. @@ -2906,17 +3099,16 @@ typedef struct AVCodecContext { #define FF_PROFILE_JPEG2000_DCINEMA_2K 3 #define FF_PROFILE_JPEG2000_DCINEMA_4K 4 +#define FF_PROFILE_VP9_0 0 +#define FF_PROFILE_VP9_1 1 +#define FF_PROFILE_VP9_2 2 +#define FF_PROFILE_VP9_3 3 #define FF_PROFILE_HEVC_MAIN 1 #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT 4 -#define FF_PROFILE_VP9_0 0 -#define FF_PROFILE_VP9_1 1 -#define FF_PROFILE_VP9_2 2 -#define FF_PROFILE_VP9_3 3 - /** * level * - encoding: Set by user. @@ -2966,36 +3158,33 @@ typedef struct AVCodecContext { int error_rate; #endif -#if FF_API_CODEC_PKT - /** - * @deprecated this field is not supposed to be accessed from outside lavc - */ - attribute_deprecated - AVPacket *pkt; -#endif - +#if FF_API_VBV_DELAY /** * VBV delay coded in the last frame (in periods of a 27 MHz clock). * Used for compliant TS muxing. * - encoding: Set by libavcodec. * - decoding: unused. + * @deprecated this value is now exported as a part of + * AV_PKT_DATA_CPB_PROPERTIES packet side data */ + attribute_deprecated uint64_t vbv_delay; +#endif +#if FF_API_SIDEDATA_ONLY_PKT /** - * Encoding only. Allow encoders to output packets that do not contain any - * encoded data, only side data. + * Encoding only and set by default. Allow encoders to output packets + * that do not contain any encoded data, only side data. * * Some encoders need to output such packets, e.g. to update some stream * parameters at the end of encoding. * - * All callers are strongly recommended to set this option to 1 and update - * their code to deal with such packets, since this behaviour may become - * always enabled in the future (then this option will be deprecated and - * later removed). To avoid ABI issues when this happens, the callers should - * use AVOptions to set this field. + * @deprecated this field disables the default behaviour and + * it is kept only for compatibility. */ + attribute_deprecated int side_data_only_packets; +#endif /** * Audio only. The number of "priming" samples (padding) inserted by the @@ -3146,6 +3335,26 @@ typedef struct AVCodecContext { * - decoding: set by user through AVOPtions (NO direct access) */ char *codec_whitelist; + + /* + * Properties of the stream that gets decoded + * To be accessed through av_codec_get_properties() (NO direct access) + * - encoding: unused + * - decoding: set by libavcodec + */ + unsigned properties; +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 + + /** + * Additional data associated with the entire coded stream. + * + * - decoding: unused + * - encoding: may be set by libavcodec after avcodec_open2(). + */ + AVPacketSideData *coded_side_data; + int nb_coded_side_data; + } AVCodecContext; AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); @@ -3154,6 +3363,8 @@ void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); + int av_codec_get_lowres(const AVCodecContext *avctx); void av_codec_set_lowres(AVCodecContext *avctx, int val); @@ -3195,7 +3406,7 @@ typedef struct AVCodec { enum AVCodecID id; /** * Codec capabilities. - * see CODEC_CAP_* + * see AV_CODEC_CAP_* */ int capabilities; const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} @@ -3203,9 +3414,7 @@ typedef struct AVCodec { const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 -#if FF_API_LOWRES uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres() -#endif const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} @@ -3316,7 +3525,7 @@ typedef struct AVHWAccel { /** * Hardware accelerated codec capabilities. - * see FF_HWACCEL_CODEC_CAP_* + * see HWACCEL_CODEC_CAP_* */ int capabilities; @@ -3423,6 +3632,9 @@ typedef struct AVHWAccel { * Hardware acceleration should be used for decoding even if the codec level * used is unknown or higher than the maximum supported level reported by the * hardware driver. + * + * It's generally a good idea to pass this flag unless you have a specific + * reason not to, as hardware tends to under-report supported levels. */ #define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) @@ -3436,6 +3648,7 @@ typedef struct AVHWAccel { * @} */ +#if FF_API_AVPICTURE /** * @defgroup lavc_picture AVPicture * @@ -3448,15 +3661,19 @@ typedef struct AVHWAccel { * * Up to four components can be stored into it, the last component is * alpha. + * @deprecated use AVFrame or imgutils functions instead */ typedef struct AVPicture { + attribute_deprecated uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes + attribute_deprecated int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line } AVPicture; /** * @} */ +#endif enum AVSubtitleType { SUBTITLE_NONE, @@ -3485,11 +3702,20 @@ typedef struct AVSubtitleRect { int h; ///< height of pict, undefined when pict is not set int nb_colors; ///< number of colors in pict, undefined when pict is not set +#if FF_API_AVPICTURE /** - * data+linesize for the bitmap of this subtitle. - * can be set for text/ass as well once they are rendered + * @deprecated unused */ + attribute_deprecated AVPicture pict; +#endif + /** + * data+linesize for the bitmap of this subtitle. + * Can be set for text/ass as well once they are rendered. + */ + uint8_t *data[4]; + int linesize[4]; + enum AVSubtitleType type; char *text; ///< 0 terminated plain UTF-8 text @@ -3627,39 +3853,6 @@ const AVClass *avcodec_get_subtitle_rect_class(void); */ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#if FF_API_AVFRAME_LAVC -/** - * @deprecated use av_frame_alloc() - */ -attribute_deprecated -AVFrame *avcodec_alloc_frame(void); - -/** - * Set the fields of the given AVFrame to default values. - * - * @param frame The AVFrame of which the fields should be set to default values. - * - * @deprecated use av_frame_unref() - */ -attribute_deprecated -void avcodec_get_frame_defaults(AVFrame *frame); - -/** - * Free the frame and any dynamically allocated objects in it, - * e.g. extended_data. - * - * @param frame frame to be freed. The pointer will be set to NULL. - * - * @warning this function does NOT free the data buffers themselves - * (it does not know how, since they might have been allocated with - * a custom get_buffer()). - * - * @deprecated use av_frame_free() - */ -attribute_deprecated -void avcodec_free_frame(AVFrame **frame); -#endif - /** * Initialize the AVCodecContext to use the given AVCodec. Prior to using this * function the context has to be allocated with avcodec_alloc_context3(). @@ -3728,14 +3921,39 @@ void avsubtitle_free(AVSubtitle *sub); * @{ */ -#if FF_API_DESTRUCT_PACKET /** - * Default packet destructor. - * @deprecated use the AVBuffer API instead + * Allocate an AVPacket and set its fields to default values. The resulting + * struct must be freed using av_packet_free(). + * + * @return An AVPacket filled with default values or NULL on failure. + * + * @note this only allocates the AVPacket itself, not the data buffers. Those + * must be allocated through other means such as av_new_packet. + * + * @see av_new_packet + */ +AVPacket *av_packet_alloc(void); + +/** + * Create a new packet that references the same data as src. + * + * This is a shortcut for av_packet_alloc()+av_packet_ref(). + * + * @return newly created AVPacket on success, NULL on error. + * + * @see av_packet_alloc + * @see av_packet_ref */ -attribute_deprecated -void av_destruct_packet(AVPacket *pkt); -#endif +AVPacket *av_packet_clone(AVPacket *src); + +/** + * Free the packet, if the packet is reference counted, it will be + * unreferenced first. + * + * @param packet packet to be freed. The pointer will be set to NULL. + * @note passing NULL is a no-op. + */ +void av_packet_free(AVPacket **pkt); /** * Initialize optional fields of a packet with default values. @@ -3782,18 +4000,21 @@ int av_grow_packet(AVPacket *pkt, int grow_by); * function returns successfully, the data is owned by the underlying AVBuffer. * The caller may not access the data through other means. * @param size size of data in bytes, without the padding. I.e. the full buffer - * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE. * * @return 0 on success, a negative AVERROR on error */ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); +#if FF_API_AVPACKET_OLD_API /** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. + * + * @deprecated Use av_packet_ref */ +attribute_deprecated int av_dup_packet(AVPacket *pkt); - /** * Copy packet, including contents * @@ -3811,10 +4032,13 @@ int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); /** * Free a packet. * + * @deprecated Use av_packet_unref + * * @param pkt packet to free */ +attribute_deprecated void av_free_packet(AVPacket *pkt); - +#endif /** * Allocate new information of a packet. * @@ -3826,6 +4050,22 @@ void av_free_packet(AVPacket *pkt); uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size); +/** + * Wrap an existing array as a packet side data. + * + * @param pkt packet + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * pkt. + * @param size side information size + * @return a non-negative number on success, a negative AVERROR code on + * failure. On failure, the packet is unchanged and the data remains + * owned by the caller. + */ +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + /** * Shrink the already allocated side data buffer * @@ -3971,16 +4211,10 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); */ AVCodec *avcodec_find_decoder_by_name(const char *name); -#if FF_API_GET_BUFFER -attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); -attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); -attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); -#endif - /** * The default callback for AVCodecContext.get_buffer2(). It is made public so * it can be called by custom get_buffer2() implementations for decoders without - * CODEC_CAP_DR1 set. + * AV_CODEC_CAP_DR1 set. */ int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); @@ -4004,7 +4238,7 @@ unsigned avcodec_get_edge_width(void); * buffer that is acceptable for the codec if you do not use any horizontal * padding. * - * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. */ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); @@ -4013,7 +4247,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); * buffer that is acceptable for the codec if you also ensure that all * line sizes are a multiple of the respective linesize_align[i]. * - * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. */ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]); @@ -4040,66 +4274,6 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); */ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); -#if FF_API_OLD_DECODE_AUDIO -/** - * Wrapper function which calls avcodec_decode_audio4. - * - * @deprecated Use avcodec_decode_audio4 instead. - * - * Decode the audio frame of size avpkt->size from avpkt->data into samples. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. In this case, - * avcodec_decode_audio3 has to be called again with an AVPacket that contains - * the remaining data in order to decode the second frame etc. - * If no frame - * could be outputted, frame_size_ptr is zero. Otherwise, it is the - * decompressed frame size in bytes. - * - * @warning You must set frame_size_ptr to the allocated size of the - * output buffer before calling avcodec_decode_audio3(). - * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @warning You must not provide a custom get_buffer() when using - * avcodec_decode_audio3(). Doing so will override it with - * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, - * which does allow the application to provide a custom get_buffer(). - * - * @note You might have to align the input buffer avpkt->data and output buffer - * samples. The alignment requirements depend on the CPU: On some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. - * - * In practice, avpkt->data should have 4 byte alignment at minimum and - * samples should be 16 byte aligned unless the CPU doesn't need it - * (AltiVec and SSE do). - * - * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @param avctx the codec context - * @param[out] samples the output buffer, sample type in avctx->sample_fmt - * If the sample format is planar, each channel plane will - * be the same size, with no padding between channels. - * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields. - * All decoders are designed to use the least fields possible though. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame data was decompressed (used) from the input AVPacket. - */ -attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - AVPacket *avpkt); -#endif - /** * Decode the audio frame of size avpkt->size from avpkt->data into frame. * @@ -4111,15 +4285,15 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s * needs to be fed to the decoder with remaining data until it is completely * consumed or an error occurs. * - * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input * and output. This means that for some packets they will not immediately * produce decoded output and need to be flushed at the end of decoding to get * all the decoded data. Flushing is done by calling this function with packets * with avpkt->data set to NULL and avpkt->size set to 0 until it stops * returning samples. It is safe to flush even those decoders that are not - * marked with CODEC_CAP_DELAY, then no samples will be returned. + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. * - * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * @@ -4142,7 +4316,7 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is * non-zero. Note that this field being set to zero * does not mean that an error has occurred. For - * decoders with CODEC_CAP_DELAY set, no given decode + * decoders with AV_CODEC_CAP_DELAY set, no given decode * call is guaranteed to produce a frame. * @param[in] avpkt The input AVPacket containing the input buffer. * At least avpkt->data and avpkt->size should be set. Some @@ -4159,14 +4333,14 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * * @warning The end of the input buffer buf should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * - * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay * between input and output, these need to be fed with avpkt->data=NULL, * avpkt->size=0 at the end to return the remaining frames. * @@ -4206,7 +4380,7 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, * Return a negative value on error, otherwise return the number of bytes used. * If no subtitle could be decompressed, got_sub_ptr is zero. * Otherwise, the subtitle is stored in *sub. - * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for * simplicity, because the performance difference is expect to be negligible * and reusing a get_buffer written for video codecs would probably perform badly * due to a potentially very different allocation pattern. @@ -4295,24 +4469,13 @@ typedef struct AVCodecParserContext { */ int key_frame; +#if FF_API_CONVERGENCE_DURATION /** - * Time difference in stream time base units from the pts of this - * packet to the point at which the output from the decoder has converged - * independent from the availability of previous frames. That is, the - * frames are virtually identical no matter if decoding started from - * the very first frame or from this keyframe. - * Is AV_NOPTS_VALUE if unknown. - * This field is not the display duration of the current frame. - * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY - * set. - * - * The purpose of this field is to allow seeking in streams that have no - * keyframes in the conventional sense. It corresponds to the - * recovery point SEI in H.264 and match_time_delta in NUT. It is also - * essential for some types of subtitle streams to ensure that all - * subtitles are correctly displayed after seeking. + * @deprecated unused */ + attribute_deprecated int64_t convergence_duration; +#endif // Timestamp generation support: /** @@ -4513,36 +4676,6 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id); */ AVCodec *avcodec_find_encoder_by_name(const char *name); -#if FF_API_OLD_ENCODE_AUDIO -/** - * Encode an audio frame from samples into buf. - * - * @deprecated Use avcodec_encode_audio2 instead. - * - * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. - * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user - * will know how much space is needed because it depends on the value passed - * in buf_size as described below. In that case a lower value can be used. - * - * @param avctx the codec context - * @param[out] buf the output buffer - * @param[in] buf_size the output buffer size - * @param[in] samples the input buffer containing the samples - * The number of samples read from this buffer is frame_size*channels, - * both of which are defined in avctx. - * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of - * samples read from samples is equal to: - * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) - * This also implies that av_get_bits_per_sample() must not return 0 for these - * codecs. - * @return On error a negative value is returned, on success zero or the number - * of bytes used to encode the data read from the input buffer. - */ -int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, - uint8_t *buf, int buf_size, - const short *samples); -#endif - /** * Encode a frame of audio. * @@ -4564,12 +4697,11 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, * of the output packet. * * If this function fails or produces no output, avpkt will be - * freed using av_free_packet() (i.e. avpkt->destruct will be - * called to free the user supplied buffer). + * freed using av_packet_unref(). * @param[in] frame AVFrame containing the raw audio data to be encoded. * May be NULL when flushing an encoder that has the - * CODEC_CAP_DELAY capability set. - * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * AV_CODEC_CAP_DELAY capability set. + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame * can have any number of samples. * If it is not set, frame->nb_samples must be equal to * avctx->frame_size for all frames except the last. @@ -4585,26 +4717,6 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr); -#if FF_API_OLD_ENCODE_VIDEO -/** - * @deprecated use avcodec_encode_video2() instead. - * - * Encode a video frame from pict into buf. - * The input picture should be - * stored using a specific format, namely avctx.pix_fmt. - * - * @param avctx the codec context - * @param[out] buf the output buffer for the bitstream of encoded frame - * @param[in] buf_size the size of the output buffer in bytes - * @param[in] pict the input picture to encode - * @return On error a negative value is returned, on success zero or the number - * of bytes used from the output buffer. - */ -attribute_deprecated -int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVFrame *pict); -#endif - /** * Encode a frame of video. * @@ -4626,11 +4738,10 @@ int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, * caller, he is responsible for freeing it. * * If this function fails or produces no output, avpkt will be - * freed using av_free_packet() (i.e. avpkt->destruct will be - * called to free the user supplied buffer). + * freed using av_packet_unref(). * @param[in] frame AVFrame containing the raw video data to be encoded. * May be NULL when flushing an encoder that has the - * CODEC_CAP_DELAY capability set. + * AV_CODEC_CAP_DELAY capability set. * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the * output packet is non-empty, and to 0 if it is * empty. If the function returns an error, the @@ -4747,129 +4858,70 @@ void av_resample_close(struct AVResampleContext *c); */ #endif +#if FF_API_AVPICTURE /** * @addtogroup lavc_picture * @{ */ /** - * Allocate memory for the pixels of a picture and setup the AVPicture - * fields for it. - * - * Call avpicture_free() to free it. - * - * @param picture the picture structure to be filled in - * @param pix_fmt the pixel format of the picture - * @param width the width of the picture - * @param height the height of the picture - * @return zero if successful, a negative error code otherwise - * - * @see av_image_alloc(), avpicture_fill() + * @deprecated unused */ +attribute_deprecated int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); /** - * Free a picture previously allocated by avpicture_alloc(). - * The data buffer used by the AVPicture is freed, but the AVPicture structure - * itself is not. - * - * @param picture the AVPicture to be freed + * @deprecated unused */ +attribute_deprecated void avpicture_free(AVPicture *picture); /** - * Setup the picture fields based on the specified image parameters - * and the provided image data buffer. - * - * The picture fields are filled in by using the image data buffer - * pointed to by ptr. - * - * If ptr is NULL, the function will fill only the picture linesize - * array and return the required size for the image buffer. - * - * To allocate an image buffer and fill the picture data in one call, - * use avpicture_alloc(). - * - * @param picture the picture to be filled in - * @param ptr buffer where the image data is stored, or NULL - * @param pix_fmt the pixel format of the image - * @param width the width of the image in pixels - * @param height the height of the image in pixels - * @return the size in bytes required for src, a negative error code - * in case of failure - * - * @see av_image_fill_arrays() + * @deprecated use av_image_fill_arrays() instead. */ +attribute_deprecated int avpicture_fill(AVPicture *picture, const uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height); /** - * Copy pixel data from an AVPicture into a buffer. - * - * avpicture_get_size() can be used to compute the required size for - * the buffer to fill. - * - * @param src source picture with filled data - * @param pix_fmt picture pixel format - * @param width picture width - * @param height picture height - * @param dest destination buffer - * @param dest_size destination buffer size in bytes - * @return the number of bytes written to dest, or a negative value - * (error code) on error, for example if the destination buffer is not - * big enough - * - * @see av_image_copy_to_buffer() + * @deprecated use av_image_copy_to_buffer() instead. */ +attribute_deprecated int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size); /** - * Calculate the size in bytes that a picture of the given width and height - * would occupy if stored in the given picture format. - * - * @param pix_fmt picture pixel format - * @param width picture width - * @param height picture height - * @return the computed picture buffer size or a negative error code - * in case of error - * - * @see av_image_get_buffer_size(). + * @deprecated use av_image_get_buffer_size() instead. */ +attribute_deprecated int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); -#if FF_API_DEINTERLACE /** - * deinterlace - if not supported return -1 - * - * @deprecated - use yadif (in libavfilter) instead + * @deprecated av_image_copy() instead. */ attribute_deprecated -int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); -#endif -/** - * Copy image src to dst. Wraps av_image_copy(). - */ void av_picture_copy(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height); /** - * Crop image top and left side. + * @deprecated unused */ +attribute_deprecated int av_picture_crop(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int top_band, int left_band); /** - * Pad image. + * @deprecated unused */ +attribute_deprecated int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color); /** * @} */ +#endif /** * @defgroup lavc_misc Utility functions @@ -4991,6 +5043,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); */ const char *av_get_profile_name(const AVCodec *codec, int profile); +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -5075,6 +5140,11 @@ typedef struct AVBitStreamFilterContext { struct AVBitStreamFilter *filter; AVCodecParserContext *parser; struct AVBitStreamFilterContext *next; + /** + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). + * Not for access by library users. + */ + char *args; } AVBitStreamFilterContext; @@ -5167,7 +5237,7 @@ AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); /** * Same behaviour av_fast_malloc but the buffer has additional - * FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. * * In addition the whole buffer will initially and after resizes * be 0-initialized so that no uninitialized data will ever appear. @@ -5314,6 +5384,17 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); */ const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + /** * @} */ diff --git a/linux/x86_64/include/libavcodec/avdct.h b/linux/x86_64/include/libavcodec/avdct.h new file mode 100644 index 00000000..272422e4 --- /dev/null +++ b/linux/x86_64/include/libavcodec/avdct.h @@ -0,0 +1,84 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVDCT_H +#define AVCODEC_AVDCT_H + +#include "libavutil/opt.h" + +/** + * AVDCT context. + * @note function pointers can be NULL if the specific features have been + * disabled at build time. + */ +typedef struct AVDCT { + const AVClass *av_class; + + void (*idct)(int16_t *block /* align 16 */); + + /** + * IDCT input permutation. + * Several optimized IDCTs need a permutated input (relative to the + * normal order of the reference IDCT). + * This permutation must be performed before the idct_put/add. + * Note, normally this can be merged with the zigzag/alternate scan
+ * An example to avoid confusion: + * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) + * - (x -> reference DCT -> reference IDCT -> x) + * - (x -> reference DCT -> simple_mmx_perm = idct_permutation + * -> simple_idct_mmx -> x) + * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant + * -> simple_idct_mmx -> ...) + */ + uint8_t idct_permutation[64]; + + void (*fdct)(int16_t *block /* align 16 */); + + + /** + * DCT algorithm. + * must use AVOptions to set this field. + */ + int dct_algo; + + /** + * IDCT algorithm. + * must use AVOptions to set this field. + */ + int idct_algo; + + void (*get_pixels)(int16_t *block /* align 16 */, + const uint8_t *pixels /* align 8 */, + ptrdiff_t line_size); + + int bits_per_sample; +} AVDCT; + +/** + * Allocates a AVDCT context. + * This needs to be initialized with avcodec_dct_init() after optionally + * configuring it with AVOptions. + * + * To free it use av_free() + */ +AVDCT *avcodec_dct_alloc(void); +int avcodec_dct_init(AVDCT *); + +const AVClass *avcodec_dct_get_class(void); + +#endif /* AVCODEC_AVDCT_H */ diff --git a/linux/x86_64/include/libavcodec/d3d11va.h b/linux/x86_64/include/libavcodec/d3d11va.h index d51e2ff8..6816b6c1 100644 --- a/linux/x86_64/include/libavcodec/d3d11va.h +++ b/linux/x86_64/include/libavcodec/d3d11va.h @@ -30,9 +30,9 @@ * Public libavcodec D3D11VA header. */ -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 #undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 +#define _WIN32_WINNT 0x0602 #endif #include @@ -53,8 +53,10 @@ * to the Direct3D11 FFmpeg HWAccel implementation. * * The application must make it available as AVCodecContext.hwaccel_context. + * + * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. */ -struct AVD3D11VAContext { +typedef struct AVD3D11VAContext { /** * D3D11 decoder object */ @@ -89,7 +91,19 @@ struct AVD3D11VAContext { * Private to the FFmpeg AVHWAccel implementation */ unsigned report_id; -}; + + /** + * Mutex to access video_context + */ + HANDLE context_mutex; +} AVD3D11VAContext; + +/** + * Allocate an AVD3D11VAContext. + * + * @return Newly-allocated AVD3D11VAContext or NULL on failure. + */ +AVD3D11VAContext *av_d3d11va_alloc_context(void); /** * @} diff --git a/linux/x86_64/include/libavcodec/dirac.h b/linux/x86_64/include/libavcodec/dirac.h new file mode 100644 index 00000000..e6d9d346 --- /dev/null +++ b/linux/x86_64/include/libavcodec/dirac.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007 Marco Gerards + * Copyright (C) 2009 David Conrad + * Copyright (C) 2011 Jordi Ortiz + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DIRAC_H +#define AVCODEC_DIRAC_H + +/** + * @file + * Interface to Dirac Decoder/Encoder + * @author Marco Gerards + * @author David Conrad + * @author Jordi Ortiz + */ + +#include "avcodec.h" + +/** + * The spec limits the number of wavelet decompositions to 4 for both + * level 1 (VC-2) and 128 (long-gop default). + * 5 decompositions is the maximum before >16-bit buffers are needed. + * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting + * the others to 4 decompositions (or 3 for the fidelity filter). + * + * We use this instead of MAX_DECOMPOSITIONS to save some memory. + */ +#define MAX_DWT_LEVELS 5 + +/** + * Parse code values: + * + * Dirac Specification -> + * 9.6.1 Table 9.1 + * + * VC-2 Specification -> + * 10.4.1 Table 10.1 + */ + +enum DiracParseCodes { + DIRAC_PCODE_SEQ_HEADER = 0x00, + DIRAC_PCODE_END_SEQ = 0x10, + DIRAC_PCODE_AUX = 0x20, + DIRAC_PCODE_PAD = 0x30, + DIRAC_PCODE_PICTURE_CODED = 0x08, + DIRAC_PCODE_PICTURE_RAW = 0x48, + DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8, + DIRAC_PCODE_PICTURE_HQ = 0xE8, + DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A, + DIRAC_PCODE_INTER_NOREF_CO2 = 0x09, + DIRAC_PCODE_INTER_REF_CO1 = 0x0D, + DIRAC_PCODE_INTER_REF_CO2 = 0x0E, + DIRAC_PCODE_INTRA_REF_CO = 0x0C, + DIRAC_PCODE_INTRA_REF_RAW = 0x4C, + DIRAC_PCODE_INTRA_REF_PICT = 0xCC, + DIRAC_PCODE_MAGIC = 0x42424344, +}; + +typedef struct DiracVersionInfo { + int major; + int minor; +} DiracVersionInfo; + +typedef struct AVDiracSeqHeader { + unsigned width; + unsigned height; + uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 + + uint8_t interlaced; + uint8_t top_field_first; + + uint8_t frame_rate_index; ///< index into dirac_frame_rate[] + uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] + + uint16_t clean_width; + uint16_t clean_height; + uint16_t clean_left_offset; + uint16_t clean_right_offset; + + uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] + uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] + + int profile; + int level; + + AVRational framerate; + AVRational sample_aspect_ratio; + + enum AVPixelFormat pix_fmt; + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace colorspace; + + DiracVersionInfo version; + int bit_depth; +} AVDiracSeqHeader; + +/** + * Parse a Dirac sequence header. + * + * @param dsh this function will allocate and fill an AVDiracSeqHeader struct + * and write it into this pointer. The caller must free it with + * av_free(). + * @param buf the data buffer + * @param buf_size the size of the data buffer in bytes + * @param log_ctx if non-NULL, this function will log errors here + * @return 0 on success, a negative AVERROR code on failure + */ +int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh, + const uint8_t *buf, size_t buf_size, + void *log_ctx); + +#endif /* AVCODEC_DIRAC_H */ diff --git a/linux/x86_64/include/libavcodec/dv_profile.h b/linux/x86_64/include/libavcodec/dv_profile.h index d22ad266..9380a66f 100644 --- a/linux/x86_64/include/libavcodec/dv_profile.h +++ b/linux/x86_64/include/libavcodec/dv_profile.h @@ -58,15 +58,6 @@ typedef struct AVDVProfile { const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ } AVDVProfile; -#if FF_API_DV_FRAME_PROFILE -/** - * @deprecated use av_dv_frame_profile() - */ -attribute_deprecated -const AVDVProfile* avpriv_dv_frame_profile2(AVCodecContext* codec, const AVDVProfile *sys, - const uint8_t* frame, unsigned buf_size); -#endif - /** * Get a DV profile for the provided compressed frame. * diff --git a/linux/x86_64/include/libavcodec/dxva2.h b/linux/x86_64/include/libavcodec/dxva2.h index be246d71..22c93992 100644 --- a/linux/x86_64/include/libavcodec/dxva2.h +++ b/linux/x86_64/include/libavcodec/dxva2.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_DXVA_H -#define AVCODEC_DXVA_H +#ifndef AVCODEC_DXVA2_H +#define AVCODEC_DXVA2_H /** * @file @@ -29,9 +29,9 @@ * Public libavcodec DXVA2 header. */ -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 #undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 +#define _WIN32_WINNT 0x0602 #endif #include @@ -90,4 +90,4 @@ struct dxva_context { * @} */ -#endif /* AVCODEC_DXVA_H */ +#endif /* AVCODEC_DXVA2_H */ diff --git a/linux/x86_64/include/libavcodec/qsv.h b/linux/x86_64/include/libavcodec/qsv.h index e7487c88..b77158ec 100644 --- a/linux/x86_64/include/libavcodec/qsv.h +++ b/linux/x86_64/include/libavcodec/qsv.h @@ -23,12 +23,78 @@ #include +#include "libavutil/buffer.h" + +/** + * This struct is used for communicating QSV parameters between libavcodec and + * the caller. It is managed by the caller and must be assigned to + * AVCodecContext.hwaccel_context. + * - decoding: hwaccel_context must be set on return from the get_format() + * callback + * - encoding: hwaccel_context must be set before avcodec_open2() + */ typedef struct AVQSVContext { + /** + * If non-NULL, the session to use for encoding or decoding. + * Otherwise, libavcodec will try to create an internal session. + */ mfxSession session; + + /** + * The IO pattern to use. + */ int iopattern; + /** + * Extra buffers to pass to encoder or decoder initialization. + */ mfxExtBuffer **ext_buffers; int nb_ext_buffers; + + /** + * Encoding only. If this field is set to non-zero by the caller, libavcodec + * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to + * the encoder initialization. This only makes sense if iopattern is also + * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY. + * + * The number of allocated opaque surfaces will be the sum of the number + * required by the encoder and the user-provided value nb_opaque_surfaces. + * The array of the opaque surfaces will be exported to the caller through + * the opaque_surfaces field. + */ + int opaque_alloc; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. Before + * calling avcodec_open2(), the caller should set this field to the number + * of extra opaque surfaces to allocate beyond what is required by the + * encoder. + * + * On return from avcodec_open2(), this field will be set by libavcodec to + * the total number of allocated opaque surfaces. + */ + int nb_opaque_surfaces; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. On return + * from avcodec_open2(), this field will be used by libavcodec to export the + * array of the allocated opaque surfaces to the caller, so they can be + * passed to other parts of the pipeline. + * + * The buffer reference exported here is owned and managed by libavcodec, + * the callers should make their own reference with av_buffer_ref() and free + * it with av_buffer_unref() when it is no longer needed. + * + * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1. + */ + AVBufferRef *opaque_surfaces; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. On return + * from avcodec_open2(), this field will be set to the surface type used in + * the opaque allocation request. + */ + int opaque_alloc_type; } AVQSVContext; /** diff --git a/linux/x86_64/include/libavcodec/vaapi.h b/linux/x86_64/include/libavcodec/vaapi.h index 815a27e2..7a29f6f8 100644 --- a/linux/x86_64/include/libavcodec/vaapi.h +++ b/linux/x86_64/include/libavcodec/vaapi.h @@ -31,6 +31,8 @@ */ #include +#include "libavutil/attributes.h" +#include "version.h" /** * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding @@ -72,12 +74,14 @@ struct vaapi_context { */ uint32_t context_id; +#if FF_API_VAAPI_CONTEXT /** * VAPictureParameterBuffer ID * * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated uint32_t pic_param_buf_id; /** @@ -86,6 +90,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated uint32_t iq_matrix_buf_id; /** @@ -94,6 +99,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated uint32_t bitplane_buf_id; /** @@ -102,6 +108,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated uint32_t *slice_buf_ids; /** @@ -110,6 +117,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated unsigned int n_slice_buf_ids; /** @@ -118,6 +126,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated unsigned int slice_buf_ids_alloc; /** @@ -126,6 +135,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated void *slice_params; /** @@ -134,6 +144,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated unsigned int slice_param_size; /** @@ -142,6 +153,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated unsigned int slice_params_alloc; /** @@ -150,6 +162,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated unsigned int slice_count; /** @@ -157,6 +170,7 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated const uint8_t *slice_data; /** @@ -165,7 +179,9 @@ struct vaapi_context { * - encoding: unused * - decoding: Set by libavcodec */ + attribute_deprecated uint32_t slice_data_size; +#endif }; /* @} */ diff --git a/linux/x86_64/include/libavcodec/vdpau.h b/linux/x86_64/include/libavcodec/vdpau.h index a42ca013..e85e4d9e 100644 --- a/linux/x86_64/include/libavcodec/vdpau.h +++ b/linux/x86_64/include/libavcodec/vdpau.h @@ -196,10 +196,13 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, */ AVVDPAUContext *av_vdpau_alloc_context(void); +#if FF_API_VDPAU_PROFILE /** * Get a decoder profile that should be used for initializing a VDPAU decoder. * Should be called from the AVCodecContext.get_format() callback. * + * @deprecated Use av_vdpau_bind_context() instead. + * * @param avctx the codec context being used for decoding the stream * @param profile a pointer into which the result will be written on success. * The contents of profile are undefined if this function returns @@ -207,7 +210,9 @@ AVVDPAUContext *av_vdpau_alloc_context(void); * * @return 0 on success (non-negative), a negative AVERROR on failure. */ +attribute_deprecated int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); +#endif #if FF_API_CAP_VDPAU /** @brief The videoSurface is used for rendering. */ @@ -231,10 +236,8 @@ struct vdpau_render_state { int state; ///< Holds FF_VDPAU_STATE_* values. -#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI /** picture parameter information for all supported codecs */ union AVVDPAUPictureInfo info; -#endif /** Describe size/location of the compressed video data. Set to 0 when freeing bitstream_buffers. */ @@ -242,11 +245,6 @@ struct vdpau_render_state { int bitstream_buffers_used; /** The user is responsible for freeing this buffer using av_freep(). */ VdpBitstreamBuffer *bitstream_buffers; - -#if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI - /** picture parameter information for all supported codecs */ - union AVVDPAUPictureInfo info; -#endif }; #endif diff --git a/linux/x86_64/include/libavcodec/version.h b/linux/x86_64/include/libavcodec/version.h index 74a1b304..37a35e05 100644 --- a/linux/x86_64/include/libavcodec/version.h +++ b/linux/x86_64/include/libavcodec/version.h @@ -28,9 +28,9 @@ #include "libavutil/version.h" -#define LIBAVCODEC_VERSION_MAJOR 56 -#define LIBAVCODEC_VERSION_MINOR 41 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MAJOR 57 +#define LIBAVCODEC_VERSION_MINOR 24 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ @@ -46,141 +46,118 @@ * FF_API_* defines may be placed below to indicate public API that will be * dropped at a future version bump. The defines themselves are not part of * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. */ #ifndef FF_API_VIMA_DECODER -#define FF_API_VIMA_DECODER (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_REQUEST_CHANNELS -#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_OLD_DECODE_AUDIO -#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_OLD_ENCODE_AUDIO -#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_OLD_ENCODE_VIDEO -#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CODEC_ID -#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_VIMA_DECODER (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_AUDIO_CONVERT -#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_AVCODEC_RESAMPLE #define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT #endif -#ifndef FF_API_DEINTERLACE -#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_DESTRUCT_PACKET -#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_GET_BUFFER -#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57) +#ifndef FF_API_GETCHROMA +#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_MISSING_SAMPLE -#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_LOWRES -#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_CAP_VDPAU -#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_BUFS_VDPAU -#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_VOXWARE -#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_SET_DIMENSIONS -#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_DEBUG_MV -#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_AC_VLC -#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_OLD_MSMPEG4 -#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_ASPECT_EXTENDED -#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_THREAD_OPAQUE -#define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_CODEC_PKT -#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_ARCH_ALPHA -#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_XVMC -#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_ERROR_RATE -#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_QSCALE_TYPE -#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_MB_TYPE -#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_MAX_BFRAMES -#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_NEG_LINESIZES -#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_EMU_EDGE -#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_ARCH_SH4 -#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_ARCH_SPARC -#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_UNUSED_MEMBERS -#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_IDCT_XVIDMMX -#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_INPUT_PRESERVED -#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_NORMALIZE_AQP -#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_GMC -#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_MV0 -#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_CODEC_NAME -#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_AFD -#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_VISMV /* XXX: don't forget to drop the -vismv documentation */ -#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 57) -#endif -#ifndef FF_API_DV_FRAME_PROFILE -#define FF_API_DV_FRAME_PROFILE (LIBAVCODEC_VERSION_MAJOR < 57) +#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 58) #endif #ifndef FF_API_AUDIOENC_DELAY #define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) #endif +#ifndef FF_API_VAAPI_CONTEXT +#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58) +#endif #ifndef FF_API_AVCTX_TIMEBASE #define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) #endif @@ -190,5 +167,50 @@ #ifndef FF_API_STREAM_CODEC_TAG #define FF_API_STREAM_CODEC_TAG (LIBAVCODEC_VERSION_MAJOR < 59) #endif +#ifndef FF_API_QUANT_BIAS +#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_RC_STRATEGY +#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODED_FRAME +#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_MOTION_EST +#define FF_API_MOTION_EST (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_WITHOUT_PREFIX +#define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_SIDEDATA_ONLY_PKT +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_VDPAU_PROFILE +#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CONVERGENCE_DURATION +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_AVPICTURE +#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_AVPACKET_OLD_API +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_RTP_CALLBACK +#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_VBV_DELAY +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODER_TYPE +#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_STAT_BITS +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_PRIVATE_OPT +#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif #endif /* AVCODEC_VERSION_H */ diff --git a/linux/x86_64/include/libavcodec/videotoolbox.h b/linux/x86_64/include/libavcodec/videotoolbox.h new file mode 100644 index 00000000..a48638e2 --- /dev/null +++ b/linux/x86_64/include/libavcodec/videotoolbox.h @@ -0,0 +1,126 @@ +/* + * Videotoolbox hardware acceleration + * + * copyright (c) 2012 Sebastien Zwickert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VIDEOTOOLBOX_H +#define AVCODEC_VIDEOTOOLBOX_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_videotoolbox + * Public libavcodec Videotoolbox header. + */ + +#include + +#define Picture QuickdrawPicture +#include +#undef Picture + +#include "libavcodec/avcodec.h" + +/** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing Videotoolbox decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_videotoolbox_alloc_context() and freed with av_free(). + */ +typedef struct AVVideotoolboxContext { + /** + * Videotoolbox decompression session object. + * Created and freed the caller. + */ + VTDecompressionSessionRef session; + + /** + * The output callback that must be passed to the session. + * Set by av_videottoolbox_default_init() + */ + VTDecompressionOutputCallback output_callback; + + /** + * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames. + * set by the caller. + */ + OSType cv_pix_fmt_type; + + /** + * CoreMedia Format Description that Videotoolbox will use to create the decompression session. + * Set by the caller. + */ + CMVideoFormatDescriptionRef cm_fmt_desc; + + /** + * CoreMedia codec type that Videotoolbox will use to create the decompression session. + * Set by the caller. + */ + int cm_codec_type; +} AVVideotoolboxContext; + +/** + * Allocate and initialize a Videotoolbox context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create + * the decoder object (using the output callback provided by libavcodec) that + * will be used for Videotoolbox-accelerated decoding. + * + * When decoding with Videotoolbox is finished, the caller must destroy the decoder + * object and free the Videotoolbox context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVideotoolboxContext *av_videotoolbox_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the Videotoolbox context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_videotoolbox_default_init(AVCodecContext *avctx); + +/** + * This is a convenience function that creates and sets up the Videotoolbox context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * @param vtctx the Videotoolbox context to use + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx); + +/** + * This function must be called to free the Videotoolbox context initialized with + * av_videotoolbox_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_videotoolbox_default_free(AVCodecContext *avctx); + +/** + * @} + */ + +#endif /* AVCODEC_VIDEOTOOLBOX_H */ diff --git a/linux/x86_64/include/libavcodec/vorbis_parser.h b/linux/x86_64/include/libavcodec/vorbis_parser.h index 06e48bd3..81fda3b0 100644 --- a/linux/x86_64/include/libavcodec/vorbis_parser.h +++ b/linux/x86_64/include/libavcodec/vorbis_parser.h @@ -24,8 +24,8 @@ * Determines the duration for each packet. */ -#ifndef AVCODEC_VORBIS_PARSE_H -#define AVCODEC_VORBIS_PARSE_H +#ifndef AVCODEC_VORBIS_PARSER_H +#define AVCODEC_VORBIS_PARSER_H #include @@ -75,4 +75,4 @@ int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, void av_vorbis_parse_reset(AVVorbisParseContext *s); -#endif /* AVCODEC_VORBIS_PARSE_H */ +#endif /* AVCODEC_VORBIS_PARSER_H */ diff --git a/linux/x86_64/include/libavcodec/xvmc.h b/linux/x86_64/include/libavcodec/xvmc.h index c2e187cc..465ee78d 100644 --- a/linux/x86_64/include/libavcodec/xvmc.h +++ b/linux/x86_64/include/libavcodec/xvmc.h @@ -43,7 +43,7 @@ #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 speak for the letters IDCT MCo (motion compensation) */ -attribute_deprecated struct xvmc_pix_fmt { +struct attribute_deprecated xvmc_pix_fmt { /** The field contains the special constant value AV_XVMC_ID. It is used as a test that the application correctly uses the API, and that there is no corruption caused by pixel routines. diff --git a/linux/x86_64/include/libavformat/avformat.h b/linux/x86_64/include/libavformat/avformat.h index fb69852f..34bad436 100644 --- a/linux/x86_64/include/libavformat/avformat.h +++ b/linux/x86_64/include/libavformat/avformat.h @@ -78,6 +78,18 @@ * if its AVClass is non-NULL, and the protocols layer. See the discussion on * nesting in @ref avoptions documentation to learn how to access those. * + * @section urls + * URL strings in libavformat are made of a scheme/protocol, a ':', and a + * scheme specific string. URLs without a scheme and ':' used for local files + * are supported but deprecated. "file:" should be used for local files. + * + * It is important that the scheme string is not taken from untrusted + * sources without checks. + * + * Note that some schemes/protocols are quite powerful, allowing access to + * both local and remote files, parts of them, concatenations of them, local + * audio and video devices and so on. + * * @defgroup lavf_decoding Demuxing * @{ * Demuxers read a media file and split it into chunks of data (@em packets). A @@ -88,10 +100,10 @@ * cleanup. * * @section lavf_decoding_open Opening a media file - * The minimum information required to open a file is its URL or filename, which + * The minimum information required to open a file is its URL, which * is passed to avformat_open_input(), as in the following code: * @code - * const char *url = "in.mp3"; + * const char *url = "file:in.mp3"; * AVFormatContext *s = NULL; * int ret = avformat_open_input(&s, url, NULL, NULL); * if (ret < 0) @@ -165,7 +177,7 @@ * until the next av_read_frame() call or closing the file. If the caller * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy * of it. - * In both cases, the packet must be freed with av_free_packet() when it is no + * In both cases, the packet must be freed with av_packet_unref() when it is no * longer needed. * * @section lavf_decoding_seek Seeking @@ -465,8 +477,10 @@ typedef struct AVProbeData { #define AVFMT_NOFILE 0x0001 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#if FF_API_LAVF_FMT_RAWPICTURE #define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for - raw picture data. */ + raw picture data. @deprecated Not used anymore */ +#endif #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ @@ -478,12 +492,7 @@ typedef struct AVProbeData { #define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ #define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ #define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ -#if LIBAVFORMAT_VERSION_MAJOR <= 54 -#define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks -#else -#define AVFMT_TS_NONSTRICT 0x20000 -#endif - /**< Format does not require strictly +#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly increasing timestamps, but they must still be monotonic */ #define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative @@ -516,7 +525,7 @@ typedef struct AVOutputFormat { enum AVCodecID video_codec; /**< default video codec */ enum AVCodecID subtitle_codec; /**< default subtitle codec */ /** - * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, * AVFMT_TS_NONSTRICT @@ -603,6 +612,29 @@ typedef struct AVOutputFormat { */ int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); enum AVCodecID data_codec; /**< default data codec */ + /** + * Initialize format. May allocate data here, and set any AVFormatContext or + * AVStream parameters that need to be set before packets are sent. + * This method must not write output. + * + * Any allocations made here must be freed in deinit(). + */ + int (*init)(struct AVFormatContext *); + /** + * Deinitialize format. If present, this is called whenever the muxer is being + * destroyed, regardless of whether or not the header has been written. + * + * If a trailer is being written, this is called after write_trailer(). + * + * This is called if init() fails as well. + */ + void (*deinit)(struct AVFormatContext *); + /** + * Set up any necessary bitstream filtering and extract any extra data needed + * for the global header. + * Return 0 if more packets from this stream must be checked; 1 if not. + */ + int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); } AVOutputFormat; /** * @} @@ -810,6 +842,8 @@ typedef struct AVIndexEntry { */ #define AV_DISPOSITION_ATTACHED_PIC 0x0400 +typedef struct AVStreamInternal AVStreamInternal; + /** * To specify text track kind (different from subtitles default). */ @@ -968,7 +1002,7 @@ typedef struct AVStream { /** * Stream information used internally by av_find_stream_info() */ -#define MAX_STD_TIMEBASES (30*12+7+6) +#define MAX_STD_TIMEBASES (30*12+30+3+6) struct { int64_t last_dts; int64_t duration_gcd; @@ -1015,7 +1049,6 @@ typedef struct AVStream { /** * Number of packets to buffer for codec probing */ -#define MAX_PROBE_PACKETS 2500 int probe_packets; /** @@ -1171,6 +1204,14 @@ typedef struct AVStream { * - decoding: Set by libavformat to calculate sample_aspect_ratio internally */ AVRational display_aspect_ratio; + + struct FFFrac *priv_pts; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVStreamInternal *internal; } AVStream; AVRational av_stream_get_r_frame_rate(const AVStream *s); @@ -1362,7 +1403,7 @@ typedef struct AVFormatContext { * available. Never set it directly if the file_size and the * duration are known as FFmpeg can compute it automatically. */ - int bit_rate; + int64_t bit_rate; unsigned int packet_size; int max_delay; @@ -1396,15 +1437,19 @@ typedef struct AVFormatContext { #define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats /** - * @deprecated deprecated in favor of probesize2 + * Maximum size of the data read from input for determining + * the input container format. + * Demuxing only, set by the caller before avformat_open_input(). */ - unsigned int probesize; + int64_t probesize; /** - * @deprecated deprecated in favor of max_analyze_duration2 + * Maximum duration (in AV_TIME_BASE units) of the data read + * from input in avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + * Can be set to 0 to let avformat choose using a heuristic. */ - attribute_deprecated - int max_analyze_duration; + int64_t max_analyze_duration; const uint8_t *key; int keylen; @@ -1735,7 +1780,6 @@ typedef struct AVFormatContext { /** * User data. * This is a place for some private data of the user. - * Mostly usable with control_message_cb or any future callbacks in device's context. */ void *opaque; @@ -1750,23 +1794,6 @@ typedef struct AVFormatContext { */ int64_t output_ts_offset; - /** - * Maximum duration (in AV_TIME_BASE units) of the data read - * from input in avformat_find_stream_info(). - * Demuxing only, set by the caller before avformat_find_stream_info() - * via AVOptions (NO direct access). - * Can be set to 0 to let avformat choose using a heuristic. - */ - int64_t max_analyze_duration2; - - /** - * Maximum size of the data read from input for determining - * the input container format. - * Demuxing only, set by the caller before avformat_open_input() - * via AVOptions (NO direct access). - */ - int64_t probesize2; - /** * dump format separator. * can be ", " or "\n " or anything else @@ -1783,6 +1810,7 @@ typedef struct AVFormatContext { */ enum AVCodecID data_codec_id; +#if FF_API_OLD_OPEN_CALLBACKS /** * Called to open further IO contexts when needed for demuxing. * @@ -1797,8 +1825,47 @@ typedef struct AVFormatContext { * @See av_format_set_open_cb() * * Demuxing: Set by user. + * + * @deprecated Use io_open and io_close. */ + attribute_deprecated int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); +#endif + + /** + * ',' separated list of allowed protocols. + * - encoding: unused + * - decoding: set by user through AVOptions (NO direct access) + */ + char *protocol_whitelist; + + /* + * A callback for opening new IO streams. + * + * Certain muxers or demuxers (e.g. for various playlist-based formats) need + * to open additional files during muxing or demuxing. This callback allows + * the caller to provide custom IO in such cases. + * + * @param s the format context + * @param pb on success, the newly opened IO context should be returned here + * @param url the url to open + * @param flags a combination of AVIO_FLAG_* + * @param options a dictionary of additional options, with the same + * semantics as in avio_open2() + * @return 0 on success, a negative AVERROR code on failure + * + * @note Certain muxers and demuxers do nesting, i.e. they open one or more + * additional internal format contexts. Thus the AVFormatContext pointer + * passed to this callback may be different from the one facing the caller. + * It will, however, have the same 'opaque' field. + */ + int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, + int flags, AVDictionary **options); + + /** + * A callback for closing the streams opened with AVFormatContext.io_open(). + */ + void (*io_close)(struct AVFormatContext *s, AVIOContext *pb); } AVFormatContext; int av_format_get_probe_score(const AVFormatContext *s); @@ -1816,8 +1883,10 @@ void * av_format_get_opaque(const AVFormatContext *s); void av_format_set_opaque(AVFormatContext *s, void *opaque); av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s); void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback); -AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); -void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); +#if FF_API_OLD_OPEN_CALLBACKS +attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); +attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); +#endif /** * This function will cause global side data to be injected in the next packet @@ -1946,6 +2015,16 @@ const AVClass *avformat_get_class(void); */ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); +/** + * Allocate new information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t *av_stream_new_side_data(AVStream *stream, + enum AVPacketSideDataType type, int size); /** * Get side information from stream. * @@ -2033,7 +2112,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * * @param pb the bytestream to probe * @param fmt the input format is put here - * @param filename the filename of the stream + * @param url the url of the stream * @param logctx the log context * @param offset the offset within the bytestream to probe from * @param max_probe_size the maximum probe buffer size (zero for default) @@ -2042,14 +2121,14 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * AVERROR code otherwise */ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, + const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Like av_probe_input_buffer2() but returns 0 on success */ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, + const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** @@ -2060,7 +2139,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * May be a pointer to NULL, in which case an AVFormatContext is allocated by this * function and written into ps. * Note that a user-supplied AVFormatContext will be freed on failure. - * @param filename Name of the stream to open. + * @param url URL of the stream to open. * @param fmt If non-NULL, this parameter forces a specific input format. * Otherwise the format is autodetected. * @param options A dictionary filled with AVFormatContext and demuxer-private options. @@ -2071,7 +2150,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ -int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); +int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); attribute_deprecated int av_demuxer_open(AVFormatContext *ic); @@ -2111,6 +2190,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); */ AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); +void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); + /** * Find the "best" stream in the file. * The best stream is determined according to various heuristics as the most @@ -2153,7 +2234,7 @@ int av_find_best_stream(AVFormatContext *ic, * If pkt->buf is NULL, then the packet is valid until the next * av_read_frame() or until avformat_close_input(). Otherwise the packet * is valid indefinitely. In both cases the packet must be freed with - * av_free_packet when it is no longer needed. For video, the packet contains + * av_packet_unref when it is no longer needed. For video, the packet contains * exactly one frame. For audio, it contains an integer number of frames if each * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames * have a variable size (e.g. MPEG audio), then it contains one frame. @@ -2278,6 +2359,7 @@ void avformat_close_input(AVFormatContext **s); * * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. */ +av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options); /** @@ -2302,10 +2384,17 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options); *
* Packet's @ref AVPacket.stream_index "stream_index" field must be * set to the index of the corresponding stream in @ref - * AVFormatContext.streams "s->streams". It is very strongly - * recommended that timing information (@ref AVPacket.pts "pts", @ref - * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to - * correct values. + * AVFormatContext.streams "s->streams". + *
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") + * must be set to correct values in the stream's timebase (unless the + * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then + * they can be set to AV_NOPTS_VALUE). + * The dts for subsequent packets passed to this function must be strictly + * increasing when compared in their respective timebases (unless the + * output format is flagged with the AVFMT_TS_NONSTRICT, then they + * merely have to be nondecreasing). @ref AVPacket.duration + * "duration") should also be set if known. * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush * * @see av_interleaved_write_frame() @@ -2335,10 +2424,16 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt); *
* Packet's @ref AVPacket.stream_index "stream_index" field must be * set to the index of the corresponding stream in @ref - * AVFormatContext.streams "s->streams". It is very strongly - * recommended that timing information (@ref AVPacket.pts "pts", @ref - * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to - * correct values. + * AVFormatContext.streams "s->streams". + *
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") + * must be set to correct values in the stream's timebase (unless the + * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then + * they can be set to AV_NOPTS_VALUE). + * The dts for subsequent packets in one stream must be strictly + * increasing (unless the output format is flagged with the + * AVFMT_TS_NONSTRICT, then they merely have to be nondecreasing). + * @ref AVPacket.duration "duration") should also be set if known. * * @return 0 on success, a negative AVERROR on error. Libavformat will always * take care of freeing the packet, even if this function fails. @@ -2745,6 +2840,17 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); +/** + * Apply a list of bitstream filters to a packet. + * + * @param codec AVCodecContext, usually from an AVStream + * @param pkt the packet to apply filters to + * @param bsfc a NULL-terminated list of filters to apply + * @return >=0 on success; + * AVERROR code on failure + */ +int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, + AVBitStreamFilterContext *bsfc); /** * @} diff --git a/linux/x86_64/include/libavformat/avio.h b/linux/x86_64/include/libavformat/avio.h index 07305934..7fbce32b 100644 --- a/linux/x86_64/include/libavformat/avio.h +++ b/linux/x86_64/include/libavformat/avio.h @@ -122,6 +122,53 @@ typedef struct AVIOContext { * to any av_opt_* functions in that case. */ const AVClass *av_class; + + /* + * The following shows the relationship between buffer, buf_ptr, buf_end, buf_size, + * and pos, when reading and when writing (since AVIOContext is used for both): + * + ********************************************************************************** + * READING + ********************************************************************************** + * + * | buffer_size | + * |---------------------------------------| + * | | + * + * buffer buf_ptr buf_end + * +---------------+-----------------------+ + * |/ / / / / / / /|/ / / / / / /| | + * read buffer: |/ / consumed / | to be read /| | + * |/ / / / / / / /|/ / / / / / /| | + * +---------------+-----------------------+ + * + * pos + * +-------------------------------------------+-----------------+ + * input file: | | | + * +-------------------------------------------+-----------------+ + * + * + ********************************************************************************** + * WRITING + ********************************************************************************** + * + * | buffer_size | + * |-------------------------------| + * | | + * + * buffer buf_ptr buf_end + * +-------------------+-----------+ + * |/ / / / / / / / / /| | + * write buffer: | / to be flushed / | | + * |/ / / / / / / / / /| | + * +-------------------+-----------+ + * + * pos + * +--------------------------+-----------------------------------+ + * output file: | | | + * +--------------------------+-----------------------------------+ + * + */ unsigned char *buffer; /**< Start of the buffer. */ int buffer_size; /**< Maximum buffer size */ unsigned char *buf_ptr; /**< Current position in the buffer */ @@ -196,6 +243,17 @@ typedef struct AVIOContext { * This field is internal to libavformat and access from outside is not allowed. */ int orig_buffer_size; + + /** + * Threshold to favor readahead over seek. + * This is current internal only, do not use from outside. + */ + int short_seek_threshold; + + /** + * ',' separated list of allowed protocols. + */ + const char *protocol_whitelist; } AVIOContext; /* unbuffered I/O */ @@ -223,6 +281,25 @@ const char *avio_find_protocol_name(const char *url); */ int avio_check(const char *url, int flags); +/** + * Move or rename a resource. + * + * @note url_src and url_dst should share the same protocol and authority. + * + * @param url_src url to resource to be moved + * @param url_dst new url to resource if the operation succeeded + * @return >=0 on success or negative on error. + */ +int avpriv_io_move(const char *url_src, const char *url_dst); + +/** + * Delete a resource. + * + * @param url resource to be deleted. + * @return >=0 on success or negative on error. + */ +int avpriv_io_delete(const char *url); + /** * Open directory for reading. * @@ -386,7 +463,7 @@ attribute_deprecated int url_feof(AVIOContext *s); #endif -/** @warning currently size is limited */ +/** @warning Writes up to 4 KiB per call */ int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); /** @@ -560,7 +637,7 @@ int avio_open_dyn_buf(AVIOContext **s); /** * Return the written size and a pointer to the buffer. The buffer * must be freed with av_free(). - * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer. * * @param s IO context * @param pbuffer pointer to a byte buffer @@ -623,4 +700,33 @@ struct AVBPrint; */ int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); +/** + * Accept and allocate a client context on a server context. + * @param s the server context + * @param c the client context, must be unallocated + * @return >= 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_accept(AVIOContext *s, AVIOContext **c); + +/** + * Perform one step of the protocol handshake to accept a new client. + * This function must be called on a client returned by avio_accept() before + * using it as a read/write context. + * It is separate from avio_accept() because it may block. + * A step of the handshake is defined by places where the application may + * decide to change the proceedings. + * For example, on a protocol with a request header and a reply header, each + * one can constitute a step because the application may use the parameters + * from the request to change parameters in the reply; or each individual + * chunk of the request can constitute a step. + * If the handshake is already finished, avio_handshake() does nothing and + * returns 0 immediately. + * + * @param c the client context to perform the handshake on + * @return 0 on a complete and successful handshake + * > 0 if the handshake progressed, but is not complete + * < 0 for an AVERROR code + */ +int avio_handshake(AVIOContext *c); #endif /* AVFORMAT_AVIO_H */ diff --git a/linux/x86_64/include/libavformat/version.h b/linux/x86_64/include/libavformat/version.h index c0920d54..024ab915 100644 --- a/linux/x86_64/include/libavformat/version.h +++ b/linux/x86_64/include/libavformat/version.h @@ -29,8 +29,8 @@ #include "libavutil/version.h" -#define LIBAVFORMAT_VERSION_MAJOR 56 -#define LIBAVFORMAT_VERSION_MINOR 36 +#define LIBAVFORMAT_VERSION_MAJOR 57 +#define LIBAVFORMAT_VERSION_MINOR 25 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ @@ -47,18 +47,32 @@ * FF_API_* defines may be placed below to indicate public API that will be * dropped at a future version bump. The defines themselves are not part of * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * */ #ifndef FF_API_LAVF_BITEXACT -#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 57) +#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 58) #endif #ifndef FF_API_LAVF_FRAC -#define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 57) +#define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 58) #endif #ifndef FF_API_LAVF_CODEC_TB -#define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 57) +#define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 58) #endif #ifndef FF_API_URL_FEOF -#define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 57) +#define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_LAVF_FMT_RAWPICTURE +#define FF_API_LAVF_FMT_RAWPICTURE (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_COMPUTE_PKT_FIELDS2 +#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_OLD_OPEN_CALLBACKS +#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 58) #endif #ifndef FF_API_R_FRAME_RATE diff --git a/linux/x86_64/include/libavutil/aes_ctr.h b/linux/x86_64/include/libavutil/aes_ctr.h new file mode 100644 index 00000000..f596fa6a --- /dev/null +++ b/linux/x86_64/include/libavutil/aes_ctr.h @@ -0,0 +1,83 @@ +/* + * AES-CTR cipher + * Copyright (c) 2015 Eran Kornblau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_CTR_H +#define AVUTIL_AES_CTR_H + +#include + +#include "attributes.h" +#include "version.h" + +#define AES_CTR_KEY_SIZE (16) +#define AES_CTR_IV_SIZE (8) + +struct AVAESCTR; + +/** + * Allocate an AVAESCTR context. + */ +struct AVAESCTR *av_aes_ctr_alloc(void); + +/** + * Initialize an AVAESCTR context. + * @param key encryption key, must have a length of AES_CTR_KEY_SIZE + */ +int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); + +/** + * Release an AVAESCTR context. + */ +void av_aes_ctr_free(struct AVAESCTR *a); + +/** + * Process a buffer using a previously initialized context. + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param size the size of src and dst + */ +void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); + +/** + * Get the current iv + */ +const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); + +/** + * Generate a random iv + */ +void av_aes_ctr_set_random_iv(struct AVAESCTR *a); + +/** + * Forcefully change the iv + */ +void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); + +/** + * Increment the top 64 bit of the iv (performed after each frame) + */ +void av_aes_ctr_increment_iv(struct AVAESCTR *a); + +/** + * @} + */ + +#endif /* AVUTIL_AES_CTR_H */ diff --git a/linux/x86_64/include/libavutil/attributes.h b/linux/x86_64/include/libavutil/attributes.h index ebcdd6b8..5c6b9dee 100644 --- a/linux/x86_64/include/libavutil/attributes.h +++ b/linux/x86_64/include/libavutil/attributes.h @@ -28,8 +28,10 @@ #ifdef __GNUC__ # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y)) #else # define AV_GCC_VERSION_AT_LEAST(x,y) 0 +# define AV_GCC_VERSION_AT_MOST(x,y) 0 #endif #ifndef av_always_inline @@ -50,6 +52,12 @@ #endif #endif +#if AV_GCC_VERSION_AT_LEAST(3,4) +# define av_warn_unused_result __attribute__((warn_unused_result)) +#else +# define av_warn_unused_result +#endif + #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_noinline __attribute__((noinline)) #elif defined(_MSC_VER) diff --git a/linux/x86_64/include/libavutil/audio_fifo.h b/linux/x86_64/include/libavutil/audio_fifo.h index d21e6a13..24f91dab 100644 --- a/linux/x86_64/include/libavutil/audio_fifo.h +++ b/linux/x86_64/include/libavutil/audio_fifo.h @@ -73,6 +73,7 @@ AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, * @param nb_samples new allocation size, in samples * @return 0 if OK, or negative AVERROR code on failure */ +av_warn_unused_result int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); /** @@ -93,6 +94,22 @@ int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); */ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); +/** + * Peek data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to peek + * @return number of samples actually peek, or negative AVERROR code + * on failure. The number of samples actually peek will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples); + /** * Read data from an AVAudioFifo. * diff --git a/linux/x86_64/include/libavutil/avstring.h b/linux/x86_64/include/libavutil/avstring.h index 466edaf9..15b04bab 100644 --- a/linux/x86_64/include/libavutil/avstring.h +++ b/linux/x86_64/include/libavutil/avstring.h @@ -203,17 +203,27 @@ char *av_strtok(char *s, const char *delim, char **saveptr); /** * Locale-independent conversion of ASCII isdigit. */ -av_const int av_isdigit(int c); +static inline av_const int av_isdigit(int c) +{ + return c >= '0' && c <= '9'; +} /** * Locale-independent conversion of ASCII isgraph. */ -av_const int av_isgraph(int c); +static inline av_const int av_isgraph(int c) +{ + return c > 32 && c < 127; +} /** * Locale-independent conversion of ASCII isspace. */ -av_const int av_isspace(int c); +static inline av_const int av_isspace(int c) +{ + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || + c == '\v'; +} /** * Locale-independent conversion of ASCII characters to uppercase. @@ -238,7 +248,11 @@ static inline av_const int av_tolower(int c) /** * Locale-independent conversion of ASCII isxdigit. */ -av_const int av_isxdigit(int c); +static inline av_const int av_isxdigit(int c) +{ + c = av_tolower(c); + return av_isdigit(c) || (c >= 'a' && c <= 'f'); +} /** * Locale-independent case-insensitive compare. @@ -270,6 +284,11 @@ const char *av_dirname(char *path); /** * Match instances of a name in a comma-separated list of names. + * List entries are checked from the start to the end of the names list, + * the first match ends further processing. If an entry prefixed with '-' + * matches, then 0 is returned. The "ALL" list entry is considered to + * match all names. + * * @param name Name to look for. * @param names List of names. * @return 1 on match, 0 otherwise. @@ -300,14 +319,14 @@ enum AVEscapeMode { * characters lists, except it is guaranteed to use the exact same list * of whitespace characters as the rest of libavutil. */ -#define AV_ESCAPE_FLAG_WHITESPACE 0x01 +#define AV_ESCAPE_FLAG_WHITESPACE (1 << 0) /** * Escape only specified special characters. * Without this flag, escape also any characters that may be considered * special by av_get_token(), such as the single quote. */ -#define AV_ESCAPE_FLAG_STRICT 0x02 +#define AV_ESCAPE_FLAG_STRICT (1 << 1) /** * Escape string in src, and put the escaped string in an allocated @@ -325,6 +344,7 @@ enum AVEscapeMode { * @return the length of the allocated string, or a negative error code in case of error * @see av_bprint_escape() */ +av_warn_unused_result int av_escape(char **dst, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags); @@ -364,6 +384,7 @@ int av_escape(char **dst, const char *src, const char *special_chars, * @return >= 0 in case a sequence was successfully read, a negative * value in case of invalid sequence */ +av_warn_unused_result int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags); diff --git a/linux/x86_64/include/libavutil/avutil.h b/linux/x86_64/include/libavutil/avutil.h index e6ebb6c4..9bcf6741 100644 --- a/linux/x86_64/include/libavutil/avutil.h +++ b/linux/x86_64/include/libavutil/avutil.h @@ -138,14 +138,6 @@ * * @{ * - * @defgroup lavu_internal Internal - * - * Not exported functions, for internal usage only - * - * @{ - * - * @} - * * @defgroup preproc_misc Preprocessor String Macros * * @{ @@ -170,6 +162,13 @@ */ unsigned avutil_version(void); +/** + * Return an informative version string. This usually is the actual release + * version number or a git commit description. This string has no fixed format + * and can change any time. It should never be parsed by code. + */ +const char *av_version_info(void); + /** * Return the libavutil build-time configuration. */ diff --git a/linux/x86_64/include/libavutil/blowfish.h b/linux/x86_64/include/libavutil/blowfish.h index 0b004532..9e289a40 100644 --- a/linux/x86_64/include/libavutil/blowfish.h +++ b/linux/x86_64/include/libavutil/blowfish.h @@ -37,6 +37,11 @@ typedef struct AVBlowfish { uint32_t s[4][256]; } AVBlowfish; +/** + * Allocate an AVBlowfish context. + */ +AVBlowfish *av_blowfish_alloc(void); + /** * Initialize an AVBlowfish context. * diff --git a/linux/x86_64/include/libavutil/cast5.h b/linux/x86_64/include/libavutil/cast5.h index e5cc8b11..ad5b347e 100644 --- a/linux/x86_64/include/libavutil/cast5.h +++ b/linux/x86_64/include/libavutil/cast5.h @@ -48,6 +48,7 @@ struct AVCAST5 *av_cast5_alloc(void); * @param ctx an AVCAST5 context * @param key a key of 5,6,...16 bytes used for encryption/decryption * @param key_bits number of keybits: possible are 40,48,...,128 + * @return 0 on success, less than 0 on failure */ int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); diff --git a/linux/x86_64/include/libavutil/channel_layout.h b/linux/x86_64/include/libavutil/channel_layout.h index dea4d609..ec7effea 100644 --- a/linux/x86_64/include/libavutil/channel_layout.h +++ b/linux/x86_64/include/libavutil/channel_layout.h @@ -108,6 +108,7 @@ #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) enum AVMatrixEncoding { diff --git a/linux/x86_64/include/libavutil/common.h b/linux/x86_64/include/libavutil/common.h index 3e62b6d5..8142b31f 100644 --- a/linux/x86_64/include/libavutil/common.h +++ b/linux/x86_64/include/libavutil/common.h @@ -40,6 +40,7 @@ #include #include "attributes.h" +#include "macros.h" #include "version.h" #include "libavutil/avconfig.h" @@ -53,14 +54,43 @@ #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -/* assume a>0 and b>0 */ -#define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ +/* Fast a/(1<=0 and b>=0 */ +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ : ((a) + (1<<(b)) - 1) >> (b)) +/* Backwards compat. */ +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT + #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) + +/** + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they + * are not representable as absolute values of their type. This is the same + * as with *abs() + * @see FFNABS() + */ #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) #define FFSIGN(a) ((a) > 0 ? 1 : -1) +/** + * Negative Absolute value. + * this works for all integers of all types. + * As with many macros, this evaluates its argument twice, it thus must not have + * a sideeffect, that is FFNABS(x++) has undefined behavior. + */ +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a))) + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) @@ -68,17 +98,9 @@ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) -#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) /* misc math functions */ -/** - * Reverse the order of the bits of an 8-bits unsigned integer. - */ -#if FF_API_AV_REVERSE -extern attribute_deprecated const uint8_t av_reverse[256]; -#endif - #ifdef HAVE_AV_CONFIG_H # include "config.h" # include "intmath.h" @@ -192,7 +214,7 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) */ static av_always_inline av_const int av_clip_intp2_c(int a, int p) { - if ((a + (1 << p)) & ~((2 << p) - 1)) + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1)) return (a >> 31) ^ ((1 << p) - 1); else return a; @@ -312,6 +334,11 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); } +static av_always_inline av_const int av_parity_c(uint32_t v) +{ + return av_popcount(v) & 1; +} + #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) @@ -332,13 +359,13 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) * to prevent undefined results. */ #define GET_UTF8(val, GET_BYTE, ERROR)\ - val= GET_BYTE;\ + val= (GET_BYTE);\ {\ uint32_t top = (val & 128) >> 1;\ if ((val & 0xc0) == 0x80 || val >= 0xFE)\ ERROR\ while (val & top) {\ - int tmp= GET_BYTE - 128;\ + int tmp= (GET_BYTE) - 128;\ if(tmp>>6)\ ERROR\ val= (val<<6) + tmp;\ @@ -498,3 +525,6 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) #ifndef av_popcount64 # define av_popcount64 av_popcount64_c #endif +#ifndef av_parity +# define av_parity av_parity_c +#endif diff --git a/linux/x86_64/include/libavutil/cpu.h b/linux/x86_64/include/libavutil/cpu.h index 471f7866..cc4e30c4 100644 --- a/linux/x86_64/include/libavutil/cpu.h +++ b/linux/x86_64/include/libavutil/cpu.h @@ -42,15 +42,12 @@ #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions -// #if LIBAVUTIL_VERSION_MAJOR <52 -#define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction -// #else -// #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction -// #endif +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction #define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 @@ -67,6 +64,7 @@ #define AV_CPU_FLAG_VFPV3 (1 << 4) #define AV_CPU_FLAG_NEON (1 << 5) #define AV_CPU_FLAG_ARMV8 (1 << 6) +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations #define AV_CPU_FLAG_SETEND (1 <<16) /** diff --git a/linux/x86_64/include/libavutil/crc.h b/linux/x86_64/include/libavutil/crc.h index e86bf1de..ef8a7137 100644 --- a/linux/x86_64/include/libavutil/crc.h +++ b/linux/x86_64/include/libavutil/crc.h @@ -24,6 +24,7 @@ #include #include #include "attributes.h" +#include "version.h" /** * @defgroup lavu_crc32 CRC32 @@ -40,7 +41,11 @@ typedef enum { AV_CRC_32_IEEE, AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ +#if FF_API_CRC_BIG_TABLE AV_CRC_24_IEEE = 12, +#else + AV_CRC_24_IEEE, +#endif /* FF_API_CRC_BIG_TABLE */ AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ }AVCRCId; diff --git a/linux/x86_64/include/libavutil/des.h b/linux/x86_64/include/libavutil/des.h new file mode 100644 index 00000000..4cf11f5b --- /dev/null +++ b/linux/x86_64/include/libavutil/des.h @@ -0,0 +1,77 @@ +/* + * DES encryption/decryption + * Copyright (c) 2007 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DES_H +#define AVUTIL_DES_H + +#include + +/** + * @defgroup lavu_des DES + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVDES { + uint64_t round_keys[3][16]; + int triple_des; +} AVDES; + +/** + * Allocate an AVDES context. + */ +AVDES *av_des_alloc(void); + +/** + * @brief Initializes an AVDES context. + * + * @param key_bits must be 64 or 192 + * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption + * @return zero on success, negative value otherwise + */ +int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); + +/** + * @brief Encrypts / decrypts using the DES algorithm. + * + * @param count number of 8 byte blocks + * @param dst destination array, can be equal to src, must be 8-byte aligned + * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL + * @param iv initialization vector for CBC mode, if NULL then ECB will be used, + * must be 8-byte aligned + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @brief Calculates CBC-MAC using the DES algorithm. + * + * @param count number of 8 byte blocks + * @param dst destination array, can be equal to src, must be 8-byte aligned + * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL + */ +void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); + +/** + * @} + */ + +#endif /* AVUTIL_DES_H */ diff --git a/linux/x86_64/include/libavutil/dict.h b/linux/x86_64/include/libavutil/dict.h index f2df687c..5b8d0033 100644 --- a/linux/x86_64/include/libavutil/dict.h +++ b/linux/x86_64/include/libavutil/dict.h @@ -162,8 +162,10 @@ int av_dict_parse_string(AVDictionary **pm, const char *str, * @param src pointer to source AVDictionary struct * @param flags flags to use when setting entries in *dst * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + * @return 0 on success, negative AVERROR code on failure. If dst was allocated + * by this function, callers should free the associated memory. */ -void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); /** * Free all the memory allocated for an AVDictionary struct diff --git a/linux/x86_64/include/libavutil/eval.h b/linux/x86_64/include/libavutil/eval.h index 6159b0fe..dacd22b9 100644 --- a/linux/x86_64/include/libavutil/eval.h +++ b/linux/x86_64/include/libavutil/eval.h @@ -102,7 +102,7 @@ void av_expr_free(AVExpr *e); * @param numstr a string representing a number, may contain one of * the International System number postfixes, for example 'K', 'M', * 'G'. If 'i' is appended after the postfix, powers of 2 are used - * instead of powers of 10. The 'B' postfix multiplies the value for + * instead of powers of 10. The 'B' postfix multiplies the value by * 8, and can be appended after another postfix or used alone. This * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. * @param tail if non-NULL puts here the pointer to the char next diff --git a/linux/x86_64/include/libavutil/ffversion.h b/linux/x86_64/include/libavutil/ffversion.h index 3e19caab..e3f34b99 100644 --- a/linux/x86_64/include/libavutil/ffversion.h +++ b/linux/x86_64/include/libavutil/ffversion.h @@ -1,4 +1,5 @@ +/* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "v1.0.1-777-gf4e0034" +#define FFMPEG_VERSION "b8c8694" #endif /* AVUTIL_FFVERSION_H */ diff --git a/linux/x86_64/include/libavutil/fifo.h b/linux/x86_64/include/libavutil/fifo.h index f3bdcbce..dc7bc6f0 100644 --- a/linux/x86_64/include/libavutil/fifo.h +++ b/linux/x86_64/include/libavutil/fifo.h @@ -83,6 +83,27 @@ int av_fifo_size(const AVFifoBuffer *f); */ int av_fifo_space(const AVFifoBuffer *f); +/** + * Feed data at specific position from an AVFifoBuffer to a user-supplied callback. + * Similar as av_fifo_gereric_read but without discarding data. + * @param f AVFifoBuffer to read from + * @param offset offset from current read position + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * Similar as av_fifo_gereric_read but without discarding data. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); + /** * Feed data from an AVFifoBuffer to a user-supplied callback. * @param f AVFifoBuffer to read from diff --git a/linux/x86_64/include/libavutil/file.h b/linux/x86_64/include/libavutil/file.h index 1cae2951..e931be71 100644 --- a/linux/x86_64/include/libavutil/file.h +++ b/linux/x86_64/include/libavutil/file.h @@ -40,6 +40,7 @@ * @return a non negative number in case of success, a negative value * corresponding to an AVERROR error code in case of failure */ +av_warn_unused_result int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx); diff --git a/linux/x86_64/include/libavutil/frame.h b/linux/x86_64/include/libavutil/frame.h index e910b517..8dc40490 100644 --- a/linux/x86_64/include/libavutil/frame.h +++ b/linux/x86_64/include/libavutil/frame.h @@ -106,12 +106,22 @@ enum AVFrameSideDataType { * @endcode */ AV_FRAME_DATA_SKIP_SAMPLES, - /** * This side data must be associated with an audio frame and corresponds to * enum AVAudioServiceType defined in avcodec.h. */ AV_FRAME_DATA_AUDIO_SERVICE_TYPE, + /** + * Mastering display metadata associated with a video frame. The payload is + * an AVMasteringDisplayMetadata type and contains information about the + * mastering display color volume. + */ + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA, + /** + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer. + * This is set on the first frame of a GOP that has a temporal reference of 0. + */ + AV_FRAME_DATA_GOP_TIMECODE }; enum AVActiveFormatDescription { @@ -241,11 +251,6 @@ typedef struct AVFrame { */ enum AVPictureType pict_type; -#if FF_API_AVFRAME_LAVC - attribute_deprecated - uint8_t *base[AV_NUM_DATA_POINTERS]; -#endif - /** * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. */ @@ -282,77 +287,17 @@ typedef struct AVFrame { */ int quality; -#if FF_API_AVFRAME_LAVC - attribute_deprecated - int reference; - - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - /** - * mbskip_table[mb]>=1 if MB didn't change - * stride= mb_width = (width+15)>>4 - */ - attribute_deprecated - uint8_t *mbskip_table; - - /** - * motion vector table - * @code - * example: - * int mv_sample_log2= 4 - motion_subsample_log2; - * int mb_width= (width+15)>>4; - * int mv_stride= (mb_width << mv_sample_log2) + 1; - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; - * @endcode - */ - int16_t (*motion_val[2])[2]; - - /** - * macroblock type table - * mb_type_base + mb_width + 2 - */ - attribute_deprecated - uint32_t *mb_type; - - /** - * DCT coefficients - */ - attribute_deprecated - short *dct_coeff; - - /** - * motion reference frame index - * the order in which these are stored can depend on the codec. - */ - attribute_deprecated - int8_t *ref_index[2]; -#endif - /** * for some private data of the user */ void *opaque; +#if FF_API_ERROR_FRAME /** - * error + * @deprecated unused */ - uint64_t error[AV_NUM_DATA_POINTERS]; - -#if FF_API_AVFRAME_LAVC attribute_deprecated - int type; + uint64_t error[AV_NUM_DATA_POINTERS]; #endif /** @@ -376,17 +321,6 @@ typedef struct AVFrame { */ int palette_has_changed; -#if FF_API_AVFRAME_LAVC - attribute_deprecated - int buffer_hints; - - /** - * Pan scan. - */ - attribute_deprecated - struct AVPanScan *pan_scan; -#endif - /** * reordered opaque 64bit (generally an integer or a double precision float * PTS but can be anything). @@ -398,24 +332,6 @@ typedef struct AVFrame { */ int64_t reordered_opaque; -#if FF_API_AVFRAME_LAVC - /** - * @deprecated this field is unused - */ - attribute_deprecated void *hwaccel_picture_private; - - attribute_deprecated - struct AVCodecContext *owner; - attribute_deprecated - void *thread_opaque; - - /** - * log2 of the size of the block which a single vector in motion_val represents: - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) - */ - uint8_t motion_subsample_log2; -#endif - /** * Sample rate of the audio data. */ @@ -507,7 +423,7 @@ typedef struct AVFrame { /** * frame timestamp estimated using various heuristics, in stream time base - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_best_effort_timestamp(frame) * - encoding: unused * - decoding: set by libavcodec, read by user. @@ -516,7 +432,7 @@ typedef struct AVFrame { /** * reordered pos from the last AVPacket that has been input into the decoder - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_pkt_pos(frame) * - encoding: unused * - decoding: Read by user. @@ -526,7 +442,7 @@ typedef struct AVFrame { /** * duration of the corresponding packet, expressed in * AVStream->time_base units, 0 if unknown. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_pkt_duration(frame) * - encoding: unused * - decoding: Read by user. @@ -535,7 +451,7 @@ typedef struct AVFrame { /** * metadata. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_metadata(frame) * - encoding: Set by user. * - decoding: Set by libavcodec. @@ -546,7 +462,7 @@ typedef struct AVFrame { * decode error flags of the frame, set to a combination of * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there * were errors during the decoding. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_decode_error_flags(frame) * - encoding: unused * - decoding: set by libavcodec, read by user. @@ -557,7 +473,7 @@ typedef struct AVFrame { /** * number of audio channels, only used for audio. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_channels(frame) * - encoding: unused * - decoding: Read by user. @@ -574,16 +490,34 @@ typedef struct AVFrame { */ int pkt_size; +#if FF_API_FRAME_QP + /** + * QP table + * Not to be accessed directly from outside libavutil + */ + attribute_deprecated + int8_t *qscale_table; + /** + * QP store stride + * Not to be accessed directly from outside libavutil + */ + attribute_deprecated + int qstride; + + attribute_deprecated + int qscale_type; + /** * Not to be accessed directly from outside libavutil */ AVBufferRef *qp_table_buf; +#endif } AVFrame; /** * Accessors for some AVFrame fields. * The position of these field in the structure is not part of the ABI, - * they should not be accessed directly outside libavcodec. + * they should not be accessed directly outside libavutil. */ int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); @@ -604,8 +538,10 @@ void av_frame_set_decode_error_flags (AVFrame *frame, int val); int av_frame_get_pkt_size(const AVFrame *frame); void av_frame_set_pkt_size(AVFrame *frame, int val); AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); +#if FF_API_FRAME_QP int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); +#endif enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); enum AVColorRange av_frame_get_color_range(const AVFrame *frame); diff --git a/linux/x86_64/include/libavutil/hmac.h b/linux/x86_64/include/libavutil/hmac.h index d36d4de1..576a0a4f 100644 --- a/linux/x86_64/include/libavutil/hmac.h +++ b/linux/x86_64/include/libavutil/hmac.h @@ -23,6 +23,7 @@ #include +#include "version.h" /** * @defgroup lavu_hmac HMAC * @ingroup lavu_crypto @@ -32,9 +33,9 @@ enum AVHMACType { AV_HMAC_MD5, AV_HMAC_SHA1, - AV_HMAC_SHA224 = 10, + AV_HMAC_SHA224, AV_HMAC_SHA256, - AV_HMAC_SHA384, + AV_HMAC_SHA384 = 12, AV_HMAC_SHA512, }; diff --git a/linux/x86_64/include/libavutil/log.h b/linux/x86_64/include/libavutil/log.h index db7eb3f7..321748cd 100644 --- a/linux/x86_64/include/libavutil/log.h +++ b/linux/x86_64/include/libavutil/log.h @@ -196,13 +196,13 @@ typedef struct AVClass { */ #define AV_LOG_DEBUG 48 -#define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET) - /** * Extremely verbose debugging, useful for libav* development. */ #define AV_LOG_TRACE 56 +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET) + /** * @} */ diff --git a/linux/x86_64/include/libavutil/macros.h b/linux/x86_64/include/libavutil/macros.h index 44653237..2007ee56 100644 --- a/linux/x86_64/include/libavutil/macros.h +++ b/linux/x86_64/include/libavutil/macros.h @@ -45,4 +45,6 @@ #define AV_PRAGMA(s) _Pragma(#s) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + #endif /* AVUTIL_MACROS_H */ diff --git a/linux/x86_64/include/libavutil/mastering_display_metadata.h b/linux/x86_64/include/libavutil/mastering_display_metadata.h new file mode 100644 index 00000000..936533fe --- /dev/null +++ b/linux/x86_64/include/libavutil/mastering_display_metadata.h @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2016 Neil Birkbeck + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H +#define AVUTIL_MASTERING_DISPLAY_METADATA_H + +#include "frame.h" +#include "rational.h" + + +/** + * Mastering display metadata capable of representing the color volume of + * the display used to master the content (SMPTE 2086:2014). + * + * To be used as payload of a AVFrameSideData or AVPacketSideData with the + * appropriate type. + * + * @note The struct should be allocated with av_mastering_display_metadata_alloc() + * and its size is not a part of the public ABI. + */ +typedef struct AVMasteringDisplayMetadata { + /** + * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). + */ + AVRational display_primaries[3][2]; + + /** + * CIE 1931 xy chromaticity coords of white point. + */ + AVRational white_point[2]; + + /** + * Min luminance of mastering display (cd/m^2). + */ + AVRational min_luminance; + + /** + * Max luminance of mastering display (cd/m^2). + */ + AVRational max_luminance; + + /** + * Flag indicating whether the display primaries (and white point) are set. + */ + int has_primaries; + + /** + * Flag indicating whether the luminance (min_ and max_) have been set. + */ + int has_luminance; + +} AVMasteringDisplayMetadata; + +/** + * Allocate an AVMasteringDisplayMetadata structure and set its fields to + * default values. The resulting struct can be freed using av_freep(). + * + * @return An AVMasteringDisplayMetadata filled with default values or NULL + * on failure. + */ +AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); + +/** + * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVMasteringDisplayMetadata structure to be filled by caller. + */ +AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame); + +#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */ diff --git a/linux/x86_64/include/libavutil/mathematics.h b/linux/x86_64/include/libavutil/mathematics.h index ac944887..57c44f84 100644 --- a/linux/x86_64/include/libavutil/mathematics.h +++ b/linux/x86_64/include/libavutil/mathematics.h @@ -77,9 +77,10 @@ enum AVRounding { }; /** - * Return the greatest common divisor of a and b. - * If both a and b are 0 or either or both are <0 then behavior is - * undefined. + * Compute the greatest common divisor of a and b. + * + * @return gcd of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0; + * if a == 0 and b == 0, returns 0. */ int64_t av_const av_gcd(int64_t a, int64_t b); diff --git a/linux/x86_64/include/libavutil/mem.h b/linux/x86_64/include/libavutil/mem.h index 2a1e36d6..d25b3229 100644 --- a/linux/x86_64/include/libavutil/mem.h +++ b/linux/x86_64/include/libavutil/mem.h @@ -144,6 +144,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); * The situation is undefined according to POSIX and may crash with * some libc implementations. */ +av_warn_unused_result int av_reallocp(void *ptr, size_t size); /** @@ -304,6 +305,7 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); * @return >=0 on success, negative otherwise. * @see av_dynarray_add(), av_dynarray2_add() */ +av_warn_unused_result int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); /** @@ -382,6 +384,21 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); */ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); +/** + * Allocate a buffer, reusing the given one if large enough. + * + * All newly allocated space is initially cleared + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); + /** * @} */ diff --git a/linux/x86_64/include/libavutil/motion_vector.h b/linux/x86_64/include/libavutil/motion_vector.h index 30cfb994..ec295563 100644 --- a/linux/x86_64/include/libavutil/motion_vector.h +++ b/linux/x86_64/include/libavutil/motion_vector.h @@ -45,6 +45,13 @@ typedef struct AVMotionVector { * Currently unused. */ uint64_t flags; + /** + * Motion vector + * src_x = dst_x + motion_x / motion_scale + * src_y = dst_y + motion_y / motion_scale + */ + int32_t motion_x, motion_y; + uint16_t motion_scale; } AVMotionVector; #endif /* AVUTIL_MOTION_VECTOR_H */ diff --git a/linux/x86_64/include/libavutil/opt.h b/linux/x86_64/include/libavutil/opt.h index 0bc0d309..753434d6 100644 --- a/linux/x86_64/include/libavutil/opt.h +++ b/linux/x86_64/include/libavutil/opt.h @@ -236,17 +236,7 @@ enum AVOptionType{ AV_OPT_TYPE_DURATION = MKBETAG('D','U','R',' '), AV_OPT_TYPE_COLOR = MKBETAG('C','O','L','R'), AV_OPT_TYPE_CHANNEL_LAYOUT = MKBETAG('C','H','L','A'), -#if FF_API_OLD_AVOPTIONS - FF_OPT_TYPE_FLAGS = 0, - FF_OPT_TYPE_INT, - FF_OPT_TYPE_INT64, - FF_OPT_TYPE_DOUBLE, - FF_OPT_TYPE_FLOAT, - FF_OPT_TYPE_STRING, - FF_OPT_TYPE_RATIONAL, - FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length - FF_OPT_TYPE_CONST=128, -#endif + AV_OPT_TYPE_BOOL = MKBETAG('B','O','O','L'), }; /** @@ -378,48 +368,6 @@ typedef struct AVOptionRanges { int nb_components; } AVOptionRanges; - -#if FF_API_OLD_AVOPTIONS -/** - * Set the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an - * AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. If the field is not of a string - * type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param[out] o_out if non-NULL put here a pointer to the AVOption - * found - * @param alloc this parameter is currently ignored - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR_OPTION_NOT_FOUND if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid - * @deprecated use av_opt_set() - */ -attribute_deprecated -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); - -attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n); -attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n); -attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n); - -double av_get_double(void *obj, const char *name, const AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); -attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -attribute_deprecated const AVOption *av_next_option(FF_CONST_AVUTIL55 void *obj, const AVOption *last); -#endif - /** * Show the obj options. * @@ -438,10 +386,16 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); */ void av_opt_set_defaults(void *s); -#if FF_API_OLD_AVOPTIONS -attribute_deprecated +/** + * Set the values of all AVOption fields to their default values. Only these + * AVOption fields for which (opt->flags & mask) == flags will have their + * default applied to s. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + * @param mask combination of AV_OPT_FLAG_* + * @param flags combination of AV_OPT_FLAG_* + */ void av_opt_set_defaults2(void *s, int mask, int flags); -#endif /** * Parse the key/value pairs list in opts. For each key/value pair @@ -599,22 +553,28 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational * @} */ -#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the - given object first. */ +#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the + given object first. */ /** * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass * instead of a required pointer to a struct containing AVClass. This is * useful for searching for options without needing to allocate the corresponding * object. */ -#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 +#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1) + +/** + * In av_opt_get, return NULL if the option has a pointer type and is set to NULL, + * rather than returning an empty string. + */ +#define AV_OPT_ALLOW_NULL (1 << 2) /** * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than * one component for certain option types. * @see AVOptionRanges for details. */ -#define AV_OPT_MULTI_COMPONENT_RANGE 0x1000 +#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12) /** * Look for an option in an object. Consider only options which @@ -674,7 +634,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, * or NULL * @return next AVOption or NULL */ -const AVOption *av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *prev); +const AVOption *av_opt_next(const void *obj, const AVOption *prev); /** * Iterate over AVOptions-enabled children of obj. @@ -768,6 +728,10 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in */ /** * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller + * + * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has + * AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set + * to NULL instead of an allocated empty string. */ int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); @@ -826,7 +790,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags * @param src Object to copy into * @return 0 on success, negative on error */ -int av_opt_copy(void *dest, FF_CONST_AVUTIL55 void *src); +int av_opt_copy(void *dest, const void *src); /** * Get a default list of allowed ranges for the given option. diff --git a/linux/x86_64/include/libavutil/pixdesc.h b/linux/x86_64/include/libavutil/pixdesc.h index 78f8d559..b1d218db 100644 --- a/linux/x86_64/include/libavutil/pixdesc.h +++ b/linux/x86_64/include/libavutil/pixdesc.h @@ -26,35 +26,47 @@ #include "attributes.h" #include "pixfmt.h" +#include "version.h" typedef struct AVComponentDescriptor { /** * Which of the 4 planes contains the component. */ - uint16_t plane : 2; + int plane; /** - * Number of elements between 2 horizontally consecutive pixels minus 1. + * Number of elements between 2 horizontally consecutive pixels. * Elements are bits for bitstream formats, bytes otherwise. */ - uint16_t step_minus1 : 3; + int step; /** - * Number of elements before the component of the first pixel plus 1. + * Number of elements before the component of the first pixel. * Elements are bits for bitstream formats, bytes otherwise. */ - uint16_t offset_plus1 : 3; + int offset; /** * Number of least significant bits that must be shifted away * to get the value. */ - uint16_t shift : 3; + int shift; /** - * Number of bits in the component minus 1. + * Number of bits in the component. */ - uint16_t depth_minus1 : 4; + int depth; + +#if FF_API_PLUS1_MINUS1 + /** deprecated, use step instead */ + attribute_deprecated int step_minus1; + + /** deprecated, use depth instead */ + attribute_deprecated int depth_minus1; + + /** deprecated, use offset instead */ + attribute_deprecated int offset_plus1; +#endif } AVComponentDescriptor; /** @@ -87,15 +99,20 @@ typedef struct AVPixFmtDescriptor { * This value only refers to the chroma components. */ uint8_t log2_chroma_h; - uint8_t flags; + + /** + * Combination of AV_PIX_FMT_FLAG_... flags. + */ + uint64_t flags; /** * Parameters that describe how pixels are packed. - * If the format has 2 or 4 components, then alpha is last. * If the format has 1 or 2 components, then luma is 0. * If the format has 3 or 4 components: * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. + * + * If present, the Alpha channel is always the last component. */ AVComponentDescriptor comp[4]; @@ -155,27 +172,6 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_ALPHA (1 << 7) -#if FF_API_PIX_FMT -/** - * @deprecated use the AV_PIX_FMT_FLAG_* flags - */ -#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE -#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL -#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM -#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL -#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR -#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB -#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL -#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA -#endif - -#if FF_API_PIX_FMT_DESC -/** - * The array of all the pixel format descriptors. - */ -extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; -#endif - /** * Read a line from an image, and write the values of the * pixel format component c to dst. @@ -296,8 +292,8 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); * you do check the return code! * * @param[in] pix_fmt the pixel format - * @param[out] h_shift store log2_chroma_w - * @param[out] v_shift store log2_chroma_h + * @param[out] h_shift store log2_chroma_w (horizontal/width shift) + * @param[out] v_shift store log2_chroma_h (vertical/height shift) * * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format */ diff --git a/linux/x86_64/include/libavutil/pixfmt.h b/linux/x86_64/include/libavutil/pixfmt.h index eef64449..c01c0575 100644 --- a/linux/x86_64/include/libavutil/pixfmt.h +++ b/linux/x86_64/include/libavutil/pixfmt.h @@ -121,9 +121,21 @@ enum AVPixelFormat { AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined +#if FF_API_VAAPI + /** @name Deprecated pixel formats */ + /**@{*/ AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + /**@}*/ + AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, +#else + /** + * Hardware acceleration through VA-API, data[3] contains a + * VASurfaceID. + */ + AV_PIX_FMT_VAAPI, +#endif AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian @@ -166,13 +178,6 @@ enum AVPixelFormat { AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA - -#ifdef AV_PIX_FMT_ABI_GIT_MASTER - AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian - AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian -#endif AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian @@ -180,15 +185,8 @@ enum AVPixelFormat { AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian - - /** - * duplicated pixel formats for compatibility with libav. - * FFmpeg supports these formats since May 8 2012 and Jan 28 2012 (commits f9ca1ac7 and 143a5c55) - * Libav added them Oct 12 2012 with incompatible values (commit 6d5600e85) - */ - AV_PIX_FMT_YUVA422P_LIBAV, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) - AV_PIX_FMT_YUVA444P_LIBAV, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) - + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian @@ -216,16 +214,10 @@ enum AVPixelFormat { AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian - /** - * duplicated pixel formats for compatibility with libav. - * FFmpeg supports these formats since Sat Sep 24 06:01:45 2011 +0200 (commits 9569a3c9f41387a8c7d1ce97d8693520477a66c3) - * also see Fri Nov 25 01:38:21 2011 +0100 92afb431621c79155fcb7171d26f137eb1bee028 - * Libav added them Sun Mar 16 23:05:47 2014 +0100 with incompatible values (commit 1481d24c3a0abf81e1d7a514547bd5305232be30) - */ - AV_PIX_FMT_RGBA64BE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_RGBA64LE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian - AV_PIX_FMT_BGRA64BE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_BGRA64LE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb @@ -234,14 +226,9 @@ enum AVPixelFormat { AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian) AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian) - /** - * duplicated pixel formats for compatibility with libav. - * FFmpeg supports these formats since May 3 2013 (commit e6d4e687558d08187e7a415a7725e4b1a416f782) - * Libav added them Jan 14 2015 with incompatible values (commit 0e6c7dfa650e8b0497bfa7a06394b7a462ddc33a) - */ - AV_PIX_FMT_GBRAP_LIBAV, ///< planar GBRA 4:4:4:4 32bpp - AV_PIX_FMT_GBRAP16BE_LIBAV, ///< planar GBRA 4:4:4:4 64bpp, big-endian - AV_PIX_FMT_GBRAP16LE_LIBAV, ///< planar GBRA 4:4:4:4 64bpp, little-endian + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian /** * HW acceleration through QSV, data[3] contains a pointer to the * mfxFrameSurface1 structure. @@ -255,18 +242,10 @@ enum AVPixelFormat { AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer -#ifndef AV_PIX_FMT_ABI_GIT_MASTER - AV_PIX_FMT_RGBA64BE=0x123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian - AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian - AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian -#endif AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined - AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) - AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian @@ -284,9 +263,6 @@ enum AVPixelFormat { AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian - AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp - AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian - AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */ @@ -308,26 +284,16 @@ enum AVPixelFormat { AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian - AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions - -#if FF_API_PIX_FMT -#include "old_pix_fmts.h" -#endif -}; + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox -#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI -#define AV_PIX_FMT_YUVA422P AV_PIX_FMT_YUVA422P_LIBAV -#define AV_PIX_FMT_YUVA444P AV_PIX_FMT_YUVA444P_LIBAV -#define AV_PIX_FMT_RGBA64BE AV_PIX_FMT_RGBA64BE_LIBAV -#define AV_PIX_FMT_RGBA64LE AV_PIX_FMT_RGBA64LE_LIBAV -#define AV_PIX_FMT_BGRA64BE AV_PIX_FMT_BGRA64BE_LIBAV -#define AV_PIX_FMT_BGRA64LE AV_PIX_FMT_BGRA64LE_LIBAV -#define AV_PIX_FMT_GBRAP AV_PIX_FMT_GBRAP_LIBAV -#define AV_PIX_FMT_GBRAP16BE AV_PIX_FMT_GBRAP16BE_LIBAV -#define AV_PIX_FMT_GBRAP16LE AV_PIX_FMT_GBRAP16LE_LIBAV -#endif + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian + AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions +}; #define AV_PIX_FMT_Y400A AV_PIX_FMT_GRAY8A #define AV_PIX_FMT_GBR24P AV_PIX_FMT_GBRP @@ -401,74 +367,26 @@ enum AVPixelFormat { #define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) #define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) - - -#if FF_API_PIX_FMT -#define PixelFormat AVPixelFormat - -#define PIX_FMT_Y400A AV_PIX_FMT_Y400A -#define PIX_FMT_GBR24P AV_PIX_FMT_GBR24P - -#define PIX_FMT_NE(be, le) AV_PIX_FMT_NE(be, le) - -#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32 -#define PIX_FMT_RGB32_1 AV_PIX_FMT_RGB32_1 -#define PIX_FMT_BGR32 AV_PIX_FMT_BGR32 -#define PIX_FMT_BGR32_1 AV_PIX_FMT_BGR32_1 -#define PIX_FMT_0RGB32 AV_PIX_FMT_0RGB32 -#define PIX_FMT_0BGR32 AV_PIX_FMT_0BGR32 - -#define PIX_FMT_GRAY16 AV_PIX_FMT_GRAY16 -#define PIX_FMT_RGB48 AV_PIX_FMT_RGB48 -#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565 -#define PIX_FMT_RGB555 AV_PIX_FMT_RGB555 -#define PIX_FMT_RGB444 AV_PIX_FMT_RGB444 -#define PIX_FMT_BGR48 AV_PIX_FMT_BGR48 -#define PIX_FMT_BGR565 AV_PIX_FMT_BGR565 -#define PIX_FMT_BGR555 AV_PIX_FMT_BGR555 -#define PIX_FMT_BGR444 AV_PIX_FMT_BGR444 - -#define PIX_FMT_YUV420P9 AV_PIX_FMT_YUV420P9 -#define PIX_FMT_YUV422P9 AV_PIX_FMT_YUV422P9 -#define PIX_FMT_YUV444P9 AV_PIX_FMT_YUV444P9 -#define PIX_FMT_YUV420P10 AV_PIX_FMT_YUV420P10 -#define PIX_FMT_YUV422P10 AV_PIX_FMT_YUV422P10 -#define PIX_FMT_YUV444P10 AV_PIX_FMT_YUV444P10 -#define PIX_FMT_YUV420P12 AV_PIX_FMT_YUV420P12 -#define PIX_FMT_YUV422P12 AV_PIX_FMT_YUV422P12 -#define PIX_FMT_YUV444P12 AV_PIX_FMT_YUV444P12 -#define PIX_FMT_YUV420P14 AV_PIX_FMT_YUV420P14 -#define PIX_FMT_YUV422P14 AV_PIX_FMT_YUV422P14 -#define PIX_FMT_YUV444P14 AV_PIX_FMT_YUV444P14 -#define PIX_FMT_YUV420P16 AV_PIX_FMT_YUV420P16 -#define PIX_FMT_YUV422P16 AV_PIX_FMT_YUV422P16 -#define PIX_FMT_YUV444P16 AV_PIX_FMT_YUV444P16 - -#define PIX_FMT_RGBA64 AV_PIX_FMT_RGBA64 -#define PIX_FMT_BGRA64 AV_PIX_FMT_BGRA64 -#define PIX_FMT_GBRP9 AV_PIX_FMT_GBRP9 -#define PIX_FMT_GBRP10 AV_PIX_FMT_GBRP10 -#define PIX_FMT_GBRP12 AV_PIX_FMT_GBRP12 -#define PIX_FMT_GBRP14 AV_PIX_FMT_GBRP14 -#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16 -#endif +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE) +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE) /** * Chromaticity coordinates of the source primaries. */ enum AVColorPrimaries { AVCOL_PRI_RESERVED0 = 0, - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B AVCOL_PRI_UNSPECIFIED = 2, AVCOL_PRI_RESERVED = 3, - AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) - - AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM - AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above - AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C - AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 - AVCOL_PRI_NB, ///< Not part of ABI + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_SMPTEST428_1= 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) + AVCOL_PRI_NB, ///< Not part of ABI }; /** @@ -491,6 +409,8 @@ enum AVColorTransferCharacteristic { AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system + AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10, 12, 14 and 16 bit systems + AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1 AVCOL_TRC_NB, ///< Not part of ABI }; diff --git a/linux/x86_64/include/libavutil/rc4.h b/linux/x86_64/include/libavutil/rc4.h new file mode 100644 index 00000000..029cd2ad --- /dev/null +++ b/linux/x86_64/include/libavutil/rc4.h @@ -0,0 +1,66 @@ +/* + * RC4 encryption/decryption/pseudo-random number generator + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RC4_H +#define AVUTIL_RC4_H + +#include + +/** + * @defgroup lavu_rc4 RC4 + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVRC4 { + uint8_t state[256]; + int x, y; +} AVRC4; + +/** + * Allocate an AVRC4 context. + */ +AVRC4 *av_rc4_alloc(void); + +/** + * @brief Initializes an AVRC4 context. + * + * @param key_bits must be a multiple of 8 + * @param decrypt 0 for encryption, 1 for decryption, currently has no effect + * @return zero on success, negative value otherwise + */ +int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); + +/** + * @brief Encrypts / decrypts using the RC4 algorithm. + * + * @param count number of bytes + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst, may be NULL + * @param iv not (yet) used for RC4, should be NULL + * @param decrypt 0 for encryption, 1 for decryption, not (yet) used + */ +void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_RC4_H */ diff --git a/linux/x86_64/include/libavutil/tea.h b/linux/x86_64/include/libavutil/tea.h new file mode 100644 index 00000000..dd929bda --- /dev/null +++ b/linux/x86_64/include/libavutil/tea.h @@ -0,0 +1,71 @@ +/* + * A 32-bit implementation of the TEA algorithm + * Copyright (c) 2015 Vesselin Bontchev + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TEA_H +#define AVUTIL_TEA_H + +#include + +/** + * @file + * @brief Public header for libavutil TEA algorithm + * @defgroup lavu_tea TEA + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_tea_size; + +struct AVTEA; + +/** + * Allocate an AVTEA context + * To free the struct: av_free(ptr) + */ +struct AVTEA *av_tea_alloc(void); + +/** + * Initialize an AVTEA context. + * + * @param ctx an AVTEA context + * @param key a key of 16 bytes used for encryption/decryption + * @param rounds the number of rounds in TEA (64 is the "standard") + */ +void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_TEA_H */ diff --git a/linux/x86_64/include/libavutil/threadmessage.h b/linux/x86_64/include/libavutil/threadmessage.h index a8481d8e..e256cae9 100644 --- a/linux/x86_64/include/libavutil/threadmessage.h +++ b/linux/x86_64/include/libavutil/threadmessage.h @@ -88,4 +88,20 @@ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, int err); +/** + * Set the optional free message callback function which will be called if an + * operation is removing messages from the queue. + */ +void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, + void (*free_func)(void *msg)); + +/** + * Flush the message queue + * + * This function is mostly equivalent to reading and free-ing every message + * except that it will be done in a single operation (no lock/unlock between + * reads). + */ +void av_thread_message_flush(AVThreadMessageQueue *mq); + #endif /* AVUTIL_THREADMESSAGE_H */ diff --git a/linux/x86_64/include/libavutil/tree.h b/linux/x86_64/include/libavutil/tree.h new file mode 100644 index 00000000..e1aefaa9 --- /dev/null +++ b/linux/x86_64/include/libavutil/tree.h @@ -0,0 +1,138 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * A tree container. + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_TREE_H +#define AVUTIL_TREE_H + +#include "attributes.h" +#include "version.h" + +/** + * @addtogroup lavu_tree AVTree + * @ingroup lavu_data + * + * Low-complexity tree container + * + * Insertion, removal, finding equal, largest which is smaller than and + * smallest which is larger than, all have O(log n) worst-case complexity. + * @{ + */ + + +struct AVTreeNode; +extern const int av_tree_node_size; + +/** + * Allocate an AVTreeNode. + */ +struct AVTreeNode *av_tree_node_alloc(void); + +/** + * Find an element. + * @param root a pointer to the root node of the tree + * @param next If next is not NULL, then next[0] will contain the previous + * element and next[1] the next element. If either does not exist, + * then the corresponding entry in next is unchanged. + * @param cmp compare function used to compare elements in the tree, + * API identical to that of Standard C's qsort + * It is guranteed that the first and only the first argument to cmp() + * will be the key parameter to av_tree_find(), thus it could if the + * user wants, be a different type (like an opaque context). + * @return An element with cmp(key, elem) == 0 or NULL if no such element + * exists in the tree. + */ +void *av_tree_find(const struct AVTreeNode *root, void *key, + int (*cmp)(const void *key, const void *b), void *next[2]); + +/** + * Insert or remove an element. + * + * If *next is NULL, then the supplied element will be removed if it exists. + * If *next is non-NULL, then the supplied element will be inserted, unless + * it already exists in the tree. + * + * @param rootp A pointer to a pointer to the root node of the tree; note that + * the root node can change during insertions, this is required + * to keep the tree balanced. + * @param key pointer to the element key to insert in the tree + * @param next Used to allocate and free AVTreeNodes. For insertion the user + * must set it to an allocated and zeroed object of at least + * av_tree_node_size bytes size. av_tree_insert() will set it to + * NULL if it has been consumed. + * For deleting elements *next is set to NULL by the user and + * av_tree_insert() will set it to the AVTreeNode which was + * used for the removed element. + * This allows the use of flat arrays, which have + * lower overhead compared to many malloced elements. + * You might want to define a function like: + * @code + * void *tree_insert(struct AVTreeNode **rootp, void *key, + * int (*cmp)(void *key, const void *b), + * AVTreeNode **next) + * { + * if (!*next) + * *next = av_mallocz(av_tree_node_size); + * return av_tree_insert(rootp, key, cmp, next); + * } + * void *tree_remove(struct AVTreeNode **rootp, void *key, + * int (*cmp)(void *key, const void *b, AVTreeNode **next)) + * { + * av_freep(next); + * return av_tree_insert(rootp, key, cmp, next); + * } + * @endcode + * @param cmp compare function used to compare elements in the tree, API identical + * to that of Standard C's qsort + * @return If no insertion happened, the found element; if an insertion or + * removal happened, then either key or NULL will be returned. + * Which one it is depends on the tree state and the implementation. You + * should make no assumptions that it's one or the other in the code. + */ +void *av_tree_insert(struct AVTreeNode **rootp, void *key, + int (*cmp)(const void *key, const void *b), + struct AVTreeNode **next); + +void av_tree_destroy(struct AVTreeNode *t); + +/** + * Apply enu(opaque, &elem) to all the elements in the tree in a given range. + * + * @param cmp a comparison function that returns < 0 for a element below the + * range, > 0 for a element above the range and == 0 for a + * element inside the range + * + * @note The cmp function should use the same ordering used to construct the + * tree. + */ +void av_tree_enumerate(struct AVTreeNode *t, void *opaque, + int (*cmp)(void *opaque, void *elem), + int (*enu)(void *opaque, void *elem)); + +/** + * @} + */ + +#endif /* AVUTIL_TREE_H */ diff --git a/linux/x86_64/include/libavutil/version.h b/linux/x86_64/include/libavutil/version.h index 215729ec..0ea8c794 100644 --- a/linux/x86_64/include/libavutil/version.h +++ b/linux/x86_64/include/libavutil/version.h @@ -36,6 +36,14 @@ #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) +/** + * Extract version components from the full ::AV_VERSION_INT int as returned + * by functions like ::avformat_version() and ::avcodec_version() + */ +#define AV_VERSION_MAJOR(a) ((a) >> 16) +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8) +#define AV_VERSION_MICRO(a) ((a) & 0xFF) + /** * @} */ @@ -55,9 +63,9 @@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 27 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MAJOR 55 +#define LIBAVUTIL_VERSION_MINOR 17 +#define LIBAVUTIL_VERSION_MICRO 103 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ @@ -77,63 +85,44 @@ * dropped at a future version bump. The defines themselves are not part of * the public API and may change, break or disappear at any time. * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * * @{ */ -#ifndef FF_API_OLD_AVOPTIONS -#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_PIX_FMT -#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_CONTEXT_SIZE -#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_PIX_FMT_DESC -#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_AV_REVERSE -#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_AUDIOCONVERT -#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_CPU_FLAG_MMX2 -#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_LLS_PRIVATE -#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_AVFRAME_LAVC -#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55) -#endif #ifndef FF_API_VDPAU -#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 55) -#endif -#ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT -#define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 55) +#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 56) #endif #ifndef FF_API_XVMC -#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 55) +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 56) #endif #ifndef FF_API_OPT_TYPE_METADATA -#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55) +#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 56) #endif #ifndef FF_API_DLOG -#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55) +#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 56) #endif - -#ifndef FF_CONST_AVUTIL55 -#if LIBAVUTIL_VERSION_MAJOR >= 55 -#define FF_CONST_AVUTIL55 const -#else -#define FF_CONST_AVUTIL55 +#ifndef FF_API_VAAPI +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) #endif +#ifndef FF_API_FRAME_QP +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_PLUS1_MINUS1 +#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_ERROR_FRAME +#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_CRC_BIG_TABLE +#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56) #endif + /** * @} */ #endif /* AVUTIL_VERSION_H */ - diff --git a/linux/x86_64/include/libavutil/xtea.h b/linux/x86_64/include/libavutil/xtea.h index 6f1e71e3..735427c1 100644 --- a/linux/x86_64/include/libavutil/xtea.h +++ b/linux/x86_64/include/libavutil/xtea.h @@ -36,16 +36,32 @@ typedef struct AVXTEA { uint32_t key[16]; } AVXTEA; +/** + * Allocate an AVXTEA context. + */ +AVXTEA *av_xtea_alloc(void); + /** * Initialize an AVXTEA context. * * @param ctx an AVXTEA context - * @param key a key of 16 bytes used for encryption/decryption + * @param key a key of 16 bytes used for encryption/decryption, + * interpreted as big endian 32 bit numbers */ void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); /** - * Encrypt or decrypt a buffer using a previously initialized context. + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption, + * interpreted as little endian 32 bit numbers + */ +void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, + * in big endian format. * * @param ctx an AVXTEA context * @param dst destination array, can be equal to src @@ -57,6 +73,20 @@ void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); +/** + * Encrypt or decrypt a buffer using a previously initialized context, + * in little endian format. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + /** * @} */ diff --git a/linux/x86_64/include/libswresample/swresample.h b/linux/x86_64/include/libswresample/swresample.h index e1617f47..10eaebc4 100644 --- a/linux/x86_64/include/libswresample/swresample.h +++ b/linux/x86_64/include/libswresample/swresample.h @@ -169,8 +169,8 @@ enum SwrEngine { /** Resampling Filter Types */ enum SwrFilterType { SWR_FILTER_TYPE_CUBIC, /**< Cubic */ - SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall Windowed Sinc */ - SWR_FILTER_TYPE_KAISER, /**< Kaiser Windowed Sinc */ + SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall windowed sinc */ + SWR_FILTER_TYPE_KAISER, /**< Kaiser windowed sinc */ }; /** diff --git a/linux/x86_64/include/libswresample/version.h b/linux/x86_64/include/libswresample/version.h index 94ac9c52..830f00e4 100644 --- a/linux/x86_64/include/libswresample/version.h +++ b/linux/x86_64/include/libswresample/version.h @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef SWR_VERSION_H -#define SWR_VERSION_H +#ifndef SWRESAMPLE_VERSION_H +#define SWRESAMPLE_VERSION_H /** * @file @@ -28,9 +28,9 @@ #include "libavutil/avutil.h" -#define LIBSWRESAMPLE_VERSION_MAJOR 1 -#define LIBSWRESAMPLE_VERSION_MINOR 2 -#define LIBSWRESAMPLE_VERSION_MICRO 100 +#define LIBSWRESAMPLE_VERSION_MAJOR 2 +#define LIBSWRESAMPLE_VERSION_MINOR 0 +#define LIBSWRESAMPLE_VERSION_MICRO 101 #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ LIBSWRESAMPLE_VERSION_MINOR, \ @@ -42,4 +42,4 @@ #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) -#endif /* SWR_VERSION_H */ +#endif /* SWRESAMPLE_VERSION_H */ diff --git a/linux/x86_64/include/libswscale/swscale.h b/linux/x86_64/include/libswscale/swscale.h index 903e1203..da9dd2ea 100644 --- a/linux/x86_64/include/libswscale/swscale.h +++ b/linux/x86_64/include/libswscale/swscale.h @@ -82,22 +82,6 @@ const char *swscale_license(void); #define SWS_BITEXACT 0x80000 #define SWS_ERROR_DIFFUSION 0x800000 -#if FF_API_SWS_CPU_CAPS -/** - * CPU caps are autodetected now, those flags - * are only provided for API compatibility. - */ -#define SWS_CPU_CAPS_MMX 0x80000000 -#define SWS_CPU_CAPS_MMXEXT 0x20000000 -#define SWS_CPU_CAPS_MMX2 0x20000000 -#define SWS_CPU_CAPS_3DNOW 0x40000000 -#define SWS_CPU_CAPS_ALTIVEC 0x10000000 -#if FF_API_ARCH_BFIN -#define SWS_CPU_CAPS_BFIN 0x01000000 -#endif -#define SWS_CPU_CAPS_SSE2 0x02000000 -#endif - #define SWS_MAX_REDUCE_CUTOFF 0.002 #define SWS_CS_ITU709 1 @@ -166,6 +150,7 @@ struct SwsContext *sws_alloc_context(void); * @return zero or positive value on success, a negative value on * error */ +av_warn_unused_result int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); /** @@ -185,6 +170,12 @@ void sws_freeContext(struct SwsContext *swsContext); * @param dstH the height of the destination image * @param dstFormat the destination image format * @param flags specify which algorithm and options to use for rescaling + * @param param extra parameters to tune the used scaler + * For SWS_BICUBIC param[0] and [1] tune the shape of the basis + * function, param[0] tunes f(1) and param[1] f´(1) + * For SWS_GAUSS param[0] tunes the exponent and thus cutoff + * frequency + * For SWS_LANCZOS param[0] tunes the width of the window function * @return a pointer to an allocated context, or NULL in case of error * @note this function is to be removed after a saner alternative is * written diff --git a/linux/x86_64/include/libswscale/version.h b/linux/x86_64/include/libswscale/version.h index 228c5770..24908b89 100644 --- a/linux/x86_64/include/libswscale/version.h +++ b/linux/x86_64/include/libswscale/version.h @@ -26,9 +26,9 @@ #include "libavutil/version.h" -#define LIBSWSCALE_VERSION_MAJOR 3 -#define LIBSWSCALE_VERSION_MINOR 1 -#define LIBSWSCALE_VERSION_MICRO 101 +#define LIBSWSCALE_VERSION_MAJOR 4 +#define LIBSWSCALE_VERSION_MINOR 0 +#define LIBSWSCALE_VERSION_MICRO 100 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ LIBSWSCALE_VERSION_MINOR, \ @@ -46,11 +46,4 @@ * the public API and may change, break or disappear at any time. */ -#ifndef FF_API_SWS_CPU_CAPS -#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 4) -#endif -#ifndef FF_API_ARCH_BFIN -#define FF_API_ARCH_BFIN (LIBSWSCALE_VERSION_MAJOR < 4) -#endif - #endif /* SWSCALE_VERSION_H */ diff --git a/linux/x86_64/lib/libavcodec.a b/linux/x86_64/lib/libavcodec.a index 619d74f0..fd2bffc6 100644 Binary files a/linux/x86_64/lib/libavcodec.a and b/linux/x86_64/lib/libavcodec.a differ diff --git a/linux/x86_64/lib/libavformat.a b/linux/x86_64/lib/libavformat.a index 00025eb5..8dd5456d 100644 Binary files a/linux/x86_64/lib/libavformat.a and b/linux/x86_64/lib/libavformat.a differ diff --git a/linux/x86_64/lib/libavutil.a b/linux/x86_64/lib/libavutil.a index 3640e0b7..27a6f951 100644 Binary files a/linux/x86_64/lib/libavutil.a and b/linux/x86_64/lib/libavutil.a differ diff --git a/linux/x86_64/lib/libswresample.a b/linux/x86_64/lib/libswresample.a index 8c95727e..2e705ad3 100644 Binary files a/linux/x86_64/lib/libswresample.a and b/linux/x86_64/lib/libswresample.a differ diff --git a/linux/x86_64/lib/libswscale.a b/linux/x86_64/lib/libswscale.a index 5fc6e05b..54d23471 100644 Binary files a/linux/x86_64/lib/libswscale.a and b/linux/x86_64/lib/libswscale.a differ diff --git a/linux_x86-64.sh b/linux_x86-64.sh index 7a3f2318..58dd57ac 100755 --- a/linux_x86-64.sh +++ b/linux_x86-64.sh @@ -27,6 +27,7 @@ MODULES="\ VIDEO_DECODERS="\ --enable-decoder=h264 \ + --enable-decoder=mpeg4 \ --enable-decoder=h263 \ --enable-decoder=h263p \ --enable-decoder=mpeg2video" diff --git a/linux_x86.sh b/linux_x86.sh index 332e81e3..271abd6e 100755 --- a/linux_x86.sh +++ b/linux_x86.sh @@ -27,6 +27,7 @@ MODULES="\ VIDEO_DECODERS="\ --enable-decoder=h264 \ + --enable-decoder=mpeg4 \ --enable-decoder=h263 \ --enable-decoder=h263p \ --enable-decoder=mpeg2video"