X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Favcodec.h;h=c803ec6da36dd54f4afe4a4695b460fbff690fc1;hb=f19c58b4cf0be11cdcfa609ca78265e4b4206091;hp=3667e723d686e09c84b763acbb46380a12c3a2a7;hpb=dc51a72ba45fbefb9f1c6c3ca5a5b2388d69b2da;p=ffmpeg diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3667e723d68..c803ec6da36 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -27,12 +27,13 @@ */ #include +#include "libavcore/samplefmt.h" #include "libavutil/avutil.h" #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 91 -#define LIBAVCODEC_VERSION_MICRO 1 +#define LIBAVCODEC_VERSION_MINOR 101 +#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ @@ -57,10 +58,36 @@ #ifndef FF_API_OPT_SHOW #define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53) #endif +#ifndef FF_API_AUDIO_OLD +#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_VIDEO_OLD +#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SUBTITLE_OLD +#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_USE_LPC +#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SET_STRING_OLD +#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_INOFFICIAL +#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OLD_SAMPLE_FMT +#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OLD_AUDIOCONVERT +#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53) +#endif -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} +#if LIBAVCODEC_VERSION_MAJOR < 53 +# define FF_INTERNALC_MEM_TYPE unsigned int +#else +# define FF_INTERNALC_MEM_TYPE size_t +#endif /** * Identify the syntax and semantics of the bitstream. @@ -231,6 +258,7 @@ enum CodecID { CODEC_ID_A64_MULTI, CODEC_ID_A64_MULTI5, CODEC_ID_R10K, + CODEC_ID_MXPEG, /* various PCM "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -258,6 +286,7 @@ enum CodecID { CODEC_ID_PCM_F64BE, CODEC_ID_PCM_F64LE, CODEC_ID_PCM_BLURAY, + CODEC_ID_PCM_LXF, /* various ADPCM codecs */ CODEC_ID_ADPCM_IMA_QT= 0x11000, @@ -357,6 +386,7 @@ enum CodecID { CODEC_ID_ATRAC1, CODEC_ID_BINKAUDIO_RDFT, CODEC_ID_BINKAUDIO_DCT, + CODEC_ID_AAC_LATM, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, @@ -376,6 +406,7 @@ enum CodecID { CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS * stream (only used by libavformat) */ + CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information. }; #if LIBAVCODEC_VERSION_MAJOR < 53 @@ -390,63 +421,65 @@ enum CodecID { #define CODEC_TYPE_NB AVMEDIA_TYPE_NB #endif -/** - * all in native-endian format - */ -enum SampleFormat { - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT, ///< float - SAMPLE_FMT_DBL, ///< double - SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec -}; +#if FF_API_OLD_SAMPLE_FMT +#define SampleFormat AVSampleFormat + +#define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE +#define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8 +#define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16 +#define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32 +#define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT +#define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL +#define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB +#endif + +#if FF_API_OLD_AUDIOCONVERT +#include "libavcore/audioconvert.h" /* Audio channel masks */ -#define CH_FRONT_LEFT 0x00000001 -#define CH_FRONT_RIGHT 0x00000002 -#define CH_FRONT_CENTER 0x00000004 -#define CH_LOW_FREQUENCY 0x00000008 -#define CH_BACK_LEFT 0x00000010 -#define CH_BACK_RIGHT 0x00000020 -#define CH_FRONT_LEFT_OF_CENTER 0x00000040 -#define CH_FRONT_RIGHT_OF_CENTER 0x00000080 -#define CH_BACK_CENTER 0x00000100 -#define CH_SIDE_LEFT 0x00000200 -#define CH_SIDE_RIGHT 0x00000400 -#define CH_TOP_CENTER 0x00000800 -#define CH_TOP_FRONT_LEFT 0x00001000 -#define CH_TOP_FRONT_CENTER 0x00002000 -#define CH_TOP_FRONT_RIGHT 0x00004000 -#define CH_TOP_BACK_LEFT 0x00008000 -#define CH_TOP_BACK_CENTER 0x00010000 -#define CH_TOP_BACK_RIGHT 0x00020000 -#define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. -#define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT. +#define CH_FRONT_LEFT AV_CH_FRONT_LEFT +#define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT +#define CH_FRONT_CENTER AV_CH_FRONT_CENTER +#define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY +#define CH_BACK_LEFT AV_CH_BACK_LEFT +#define CH_BACK_RIGHT AV_CH_BACK_RIGHT +#define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER +#define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER +#define CH_BACK_CENTER AV_CH_BACK_CENTER +#define CH_SIDE_LEFT AV_CH_SIDE_LEFT +#define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT +#define CH_TOP_CENTER AV_CH_TOP_CENTER +#define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT +#define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER +#define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT +#define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT +#define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER +#define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT +#define CH_STEREO_LEFT AV_CH_STEREO_LEFT +#define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT /** Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests the channel order of the decoder output to be the native codec channel order. */ -#define CH_LAYOUT_NATIVE 0x8000000000000000LL +#define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE /* Audio channel convenience macros */ -#define CH_LAYOUT_MONO (CH_FRONT_CENTER) -#define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT) -#define CH_LAYOUT_2_1 (CH_LAYOUT_STEREO|CH_BACK_CENTER) -#define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER) -#define CH_LAYOUT_4POINT0 (CH_LAYOUT_SURROUND|CH_BACK_CENTER) -#define CH_LAYOUT_2_2 (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT) -#define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT) -#define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY) -#define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY) -#define CH_LAYOUT_7POINT0 (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|\ - CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) -#define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT) +#define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO +#define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO +#define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1 +#define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND +#define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0 +#define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2 +#define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD +#define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0 +#define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1 +#define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK +#define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK +#define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0 +#define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1 +#define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE +#define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX +#endif /* in bytes */ #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio @@ -684,6 +717,14 @@ typedef struct RcOverride{ * encoders */ #define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 +/** + * Codec is able to deal with negative linesizes + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -951,8 +992,12 @@ typedef struct AVPanScan{ int8_t *ref_index[2];\ \ /**\ - * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque\ - * output in AVFrame.reordered_opaque\ + * reordered opaque 64bit (generally a integer or double preccission float \ + * PTS but can be anything). \ + * The user sets AVCodecContext.reordered_opaque to represent the input at\ + * that time ,\ + * the decoder reorderes values as needed and sets AVFrame.reordered_opaque\ + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque \ * - encoding: unused\ * - decoding: Read by user.\ */\ @@ -1203,7 +1248,7 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: Set by libavcodec. */ - enum SampleFormat sample_fmt; ///< sample format + enum AVSampleFormat sample_fmt; ///< sample format /* The following data should not be initialized. */ /** @@ -1396,7 +1441,7 @@ typedef struct AVCodecContext { #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. #define FF_COMPLIANCE_NORMAL 0 -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_INOFFICIAL #define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions (deprecated - use FF_COMPLIANCE_UNOFFICIAL instead). #endif #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions @@ -2444,7 +2489,7 @@ typedef struct AVCodecContext { int compression_level; #define FF_COMPRESSION_DEFAULT -1 -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_USE_LPC /** * Sets whether to use LPC mode - used by FLAC encoder. * - encoding: Set by user. @@ -2527,7 +2572,7 @@ typedef struct AVCodecContext { /** * Bits per sample/pixel of internal libavcodec pixel/sample format. - * This field is applicable only when sample_fmt is SAMPLE_FMT_S32. + * This field is applicable only when sample_fmt is AV_SAMPLE_FMT_S32. * - encoding: set by user. * - decoding: set by libavcodec. */ @@ -2720,6 +2765,26 @@ typedef struct AVCodecContext { * - decoding: unused */ int lpc_passes; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; } AVCodecContext; /** @@ -2759,7 +2824,7 @@ typedef struct AVCodec { */ const char *long_name; const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 - const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 uint8_t max_lowres; ///< maximum value for lowres supported by the decoder AVClass *priv_class; ///< AVClass for the private context @@ -2978,6 +3043,14 @@ int av_new_packet(AVPacket *pkt, int size); */ void av_shrink_packet(AVPacket *pkt, int size); +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + /** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. @@ -2998,7 +3071,7 @@ struct AVResampleContext; typedef struct ReSampleContext ReSampleContext; -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_AUDIO_OLD /** * @deprecated Use av_audio_resample_init() instead. */ @@ -3023,8 +3096,8 @@ attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i */ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, - enum SampleFormat sample_fmt_out, - enum SampleFormat sample_fmt_in, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff); @@ -3212,18 +3285,13 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); - +#if LIBAVCODEC_VERSION_MAJOR < 53 /** - * Print in buf the string corresponding to the pixel format with - * number pix_fmt, or an header if pix_fmt is negative. - * - * @param[in] buf the buffer where to write the string - * @param[in] buf_size the size of buf - * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or - * a negative value to print the corresponding header. - * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. + * @deprecated Use av_get_pix_fmt_string() instead. */ +attribute_deprecated void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); +#endif #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ @@ -3459,7 +3527,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, */ int avcodec_open(AVCodecContext *avctx, AVCodec *codec); -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_AUDIO_OLD /** * Decode an audio frame from buf into samples. * Wrapper function which calls avcodec_decode_audio3. @@ -3521,7 +3589,7 @@ int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_VIDEO_OLD /** * Decode a video frame from buf into picture. * Wrapper function which calls avcodec_decode_video2. @@ -3584,7 +3652,7 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_SUBTITLE_OLD /* Decode a subtitle message. Return -1 if 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. */ @@ -3702,13 +3770,13 @@ char av_get_pict_type_char(int pict_type); */ int av_get_bits_per_sample(enum CodecID codec_id); +#if FF_API_OLD_SAMPLE_FMT /** - * Return sample format bits per sample. - * - * @param[in] sample_fmt the sample format - * @return Number of bits per sample or zero if unknown for the given sample format. + * @deprecated Use av_get_bits_per_sample_fmt() instead. */ -int av_get_bits_per_sample_format(enum SampleFormat sample_fmt); +attribute_deprecated +int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt); +#endif /* frame parsing */ typedef struct AVCodecParserContext { @@ -3944,7 +4012,7 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); * * @see av_realloc */ -void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); +void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size); /** * Allocate a buffer, reusing the given one if large enough. @@ -3958,7 +4026,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and * *size 0 if an error occurred. */ -void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size); +void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size); #if LIBAVCODEC_VERSION_MAJOR < 53 /**