X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Favcodec.h;h=60cbeece57d62d47b6b94947d702fabb5185c719;hb=5f4b1b1cbd0604b74cacc0870b501659240b5b45;hp=c505a922e3a5441beab46cddf68da639459fb7c5;hpb=c68317ebbe4915035df0b08c23eea7a0b80ab881;p=ffmpeg diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c505a922e3a..60cbeece57d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -23,19 +23,24 @@ /** * @file - * external API header + * @ingroup libavc + * Libavcodec external API header */ #include #include "libavutil/samplefmt.h" +#include "libavutil/attributes.h" #include "libavutil/avutil.h" +#include "libavutil/buffer.h" #include "libavutil/cpu.h" #include "libavutil/dict.h" +#include "libavutil/frame.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "libavcodec/version.h" +#include "version.h" + /** * @defgroup libavc Encoding/Decoding Library * @{ @@ -152,7 +157,6 @@ enum AVCodecID { AV_CODEC_ID_MSZH, AV_CODEC_ID_ZLIB, AV_CODEC_ID_QTRLE, - AV_CODEC_ID_SNOW, AV_CODEC_ID_TSCC, AV_CODEC_ID_ULTI, AV_CODEC_ID_QDRAW, @@ -265,6 +269,11 @@ enum AVCodecID { AV_CODEC_ID_MTS2, AV_CODEC_ID_CLLC, AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, + AV_CODEC_ID_AIC, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -376,7 +385,9 @@ enum AVCodecID { AV_CODEC_ID_MLP, AV_CODEC_ID_GSM_MS, /* as found in WAV */ AV_CODEC_ID_ATRAC3, +#if FF_API_VOXWARE AV_CODEC_ID_VOXWARE, +#endif AV_CODEC_ID_APE, AV_CODEC_ID_NELLYMOSER, AV_CODEC_ID_MUSEPACK8, @@ -406,6 +417,9 @@ enum AVCodecID { AV_CODEC_ID_IAC, AV_CODEC_ID_ILBC, AV_CODEC_ID_OPUS, + AV_CODEC_ID_COMFORT_NOISE, + AV_CODEC_ID_TAK, + AV_CODEC_ID_METASOUND, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -430,16 +444,8 @@ 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 }; -#if FF_API_CODEC_ID -#define CodecID AVCodecID -#endif - /** * This struct describes the properties of a single codec described by an * AVCodecID. @@ -480,11 +486,6 @@ typedef struct AVCodecDescriptor { */ #define AV_CODEC_PROP_LOSSLESS (1 << 2) -#if FF_API_OLD_DECODE_AUDIO -/* in bytes */ -#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio -#endif - /** * @ingroup lavc_decoding * Required number of additionally allocated bytes at the end of the input bitstream for decoding. @@ -516,7 +517,6 @@ enum Motion_Est_ID { ME_X1, ///< reserved for experiments ME_HEX, ///< hexagon based search ME_UMH, ///< uneven multi-hexagon search - ME_ITER, ///< iterative search ME_TESA, ///< transformed exhaustive search algorithm }; @@ -619,6 +619,11 @@ typedef struct RcOverride{ Note: Not everything is supported yet. */ +/** + * 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_QPEL 0x0010 ///< Use qpel MC. @@ -650,12 +655,8 @@ typedef struct RcOverride{ #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. -#if FF_API_MPV_GLOBAL_OPTS -#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp. -#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon. -#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size. -#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping -#endif +#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. /* Unsupported options : @@ -704,10 +705,12 @@ typedef struct RcOverride{ * This can be used to prevent truncation of the last audio samples. */ #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +#if FF_API_CAP_VDPAU /** * Codec can export data for HW decoding (VDPAU). */ #define CODEC_CAP_HWACCEL_VDPAU 0x0080 +#endif /** * Codec can output multiple frames per AVPacket * Normally demuxers return one frame at a time, demuxers which do not do @@ -812,6 +815,7 @@ typedef struct AVPanScan{ #define FF_QSCALE_TYPE_H264 2 #define FF_QSCALE_TYPE_VP56 3 +#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. @@ -821,6 +825,12 @@ typedef struct AVPanScan{ #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. + */ +#define AV_GET_BUFFER_FLAG_REF (1 << 0) /** * @defgroup lavc_packet AVPacket @@ -871,7 +881,35 @@ enum AVPacketSideDataType { AV_PKT_DATA_H263_MB_INFO, }; +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. + * + * AVPacket is one of the few structs in Libav, 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 side data is always allocated with av_malloc() and is freed in + * av_free_packet(). + */ typedef struct AVPacket { + /** + * A reference to the reference-counted buffer where the packet data is + * stored. + * May be NULL, then the packet data is not reference-counted. + */ + AVBufferRef *buf; /** * Presentation timestamp in AVStream->time_base units; the time at which * the decompressed packet will be presented to the user. @@ -911,8 +949,12 @@ typedef struct AVPacket { * 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 pos; ///< byte position in stream, -1 if unknown /** @@ -947,345 +989,6 @@ enum AVSideDataParamChangeFlags { * @} */ -/** - * Audio Video Frame. - * New fields can be added to the end of AVFRAME with minor version - * bumps. Removal, reordering and changes to existing fields require - * a major version bump. - * sizeof(AVFrame) must not be used outside libav*. - */ -typedef struct AVFrame { -#define AV_NUM_DATA_POINTERS 8 - /** - * pointer to the picture/channel planes. - * This might be different from the first allocated byte - * - encoding: Set by user - * - decoding: set by AVCodecContext.get_buffer() - */ - uint8_t *data[AV_NUM_DATA_POINTERS]; - - /** - * Size, in bytes, of the data for each picture/channel plane. - * - * For audio, only linesize[0] may be set. For planar audio, each channel - * plane must be the same size. - * - * - encoding: Set by user - * - decoding: set by AVCodecContext.get_buffer() - */ - int linesize[AV_NUM_DATA_POINTERS]; - - /** - * pointers to the data planes/channels. - * - * For video, this should simply point to data[]. - * - * For planar audio, each channel has a separate data pointer, and - * linesize[0] contains the size of each channel buffer. - * For packed audio, there is just one data pointer, and linesize[0] - * contains the total size of the buffer for all channels. - * - * Note: Both data and extended_data will always be set by get_buffer(), - * but for planar audio with more channels that can fit in data, - * extended_data must be used by the decoder in order to access all - * channels. - * - * encoding: set by user - * decoding: set by AVCodecContext.get_buffer() - */ - uint8_t **extended_data; - - /** - * width and height of the video frame - * - encoding: unused - * - decoding: Read by user. - */ - int width, height; - - /** - * number of audio samples (per channel) described by this frame - * - encoding: Set by user - * - decoding: Set by libavcodec - */ - int nb_samples; - - /** - * format of the frame, -1 if unknown or unset - * Values correspond to enum AVPixelFormat for video frames, - * enum AVSampleFormat for audio) - * - encoding: unused - * - decoding: Read by user. - */ - int format; - - /** - * 1 -> keyframe, 0-> not - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - int key_frame; - - /** - * Picture type of the frame, see ?_TYPE below. - * - encoding: Set by libavcodec. for coded_picture (and set by user for input). - * - decoding: Set by libavcodec. - */ - enum AVPictureType pict_type; - - /** - * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. - * This isn't used by libavcodec unless the default get/release_buffer() is used. - * - encoding: - * - decoding: - */ - uint8_t *base[AV_NUM_DATA_POINTERS]; - - /** - * sample aspect ratio for the video frame, 0/1 if unknown/unspecified - * - encoding: unused - * - decoding: Read by user. - */ - AVRational sample_aspect_ratio; - - /** - * presentation timestamp in time_base units (time when frame should be shown to user) - * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. - * - encoding: MUST be set by user. - * - decoding: Set by libavcodec. - */ - int64_t pts; - - /** - * reordered pts from the last AVPacket that has been input into the decoder - * - encoding: unused - * - decoding: Read by user. - */ - int64_t pkt_pts; - - /** - * dts from the last AVPacket that has been input into the decoder - * - encoding: unused - * - decoding: Read by user. - */ - int64_t pkt_dts; - - /** - * picture number in bitstream order - * - encoding: set by - * - decoding: Set by libavcodec. - */ - int coded_picture_number; - /** - * picture number in display order - * - encoding: set by - * - decoding: Set by libavcodec. - */ - int display_picture_number; - - /** - * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) - * - encoding: Set by libavcodec. for coded_picture (and set by user for input). - * - decoding: Set by libavcodec. - */ - int quality; - - /** - * is this picture used as reference - * The values for this are the same as the MpegEncContext.picture_structure - * variable, that is 1->top field, 2->bottom field, 3->frame/both fields. - * Set to 4 for delayed, non-reference frames. - * - encoding: unused - * - decoding: Set by libavcodec. (before get_buffer() call)). - */ - int reference; - - /** - * QP table - * - encoding: unused - * - decoding: Set by libavcodec. - */ - int8_t *qscale_table; - /** - * QP store stride - * - encoding: unused - * - decoding: Set by libavcodec. - */ - int qstride; - - /** - * - */ - int qscale_type; - - /** - * mbskip_table[mb]>=1 if MB didn't change - * stride= mb_width = (width+15)>>4 - * - encoding: unused - * - decoding: Set by libavcodec. - */ - 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 - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int16_t (*motion_val[2])[2]; - - /** - * macroblock type table - * mb_type_base + mb_width + 2 - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - uint32_t *mb_type; - - /** - * DCT coefficients - * - encoding: unused - * - decoding: Set by libavcodec. - */ - short *dct_coeff; - - /** - * motion reference frame index - * the order in which these are stored can depend on the codec. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int8_t *ref_index[2]; - - /** - * for some private data of the user - * - encoding: unused - * - decoding: Set by user. - */ - void *opaque; - - /** - * error - * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. - * - decoding: unused - */ - uint64_t error[AV_NUM_DATA_POINTERS]; - - /** - * type of the buffer (to keep track of who has to deallocate data[*]) - * - encoding: Set by the one who allocates it. - * - decoding: Set by the one who allocates it. - * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. - */ - int type; - - /** - * When decoding, this signals how much the picture must be delayed. - * extra_delay = repeat_pict / (2*fps) - * - encoding: unused - * - decoding: Set by libavcodec. - */ - int repeat_pict; - - /** - * The content of the picture is interlaced. - * - encoding: Set by user. - * - decoding: Set by libavcodec. (default 0) - */ - int interlaced_frame; - - /** - * If the content is interlaced, is top field displayed first. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - int top_field_first; - - /** - * Tell user application that palette has changed from previous frame. - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: Set by libavcodec. (default 0). - */ - int palette_has_changed; - - /** - * codec suggestion on buffer type if != 0 - * - encoding: unused - * - decoding: Set by libavcodec. (before get_buffer() call)). - */ - int buffer_hints; - - /** - * Pan scan. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - */ - AVPanScan *pan_scan; - - /** - * reordered opaque 64bit (generally an integer or a double precision float - * PTS but can be anything). - * The user sets AVCodecContext.reordered_opaque to represent the input at - * that time, - * the decoder reorders values as needed and sets AVFrame.reordered_opaque - * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque - * @deprecated in favor of pkt_pts - * - encoding: unused - * - decoding: Read by user. - */ - int64_t reordered_opaque; - - /** - * hardware accelerator private data (Libav-allocated) - * - encoding: unused - * - decoding: Set by libavcodec - */ - void *hwaccel_picture_private; - - /** - * the AVCodecContext which ff_thread_get_buffer() was last called on - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - struct AVCodecContext *owner; - - /** - * used by multithreading to store frame-specific info - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - */ - 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) - * - encoding: unused - * - decoding: Set by libavcodec. - */ - uint8_t motion_subsample_log2; - - /** - * Sample rate of the audio data. - * - * - encoding: unused - * - decoding: set by get_buffer() - */ - int sample_rate; - - /** - * Channel layout of the audio data. - * - * - encoding: unused - * - decoding: set by get_buffer() - */ - uint64_t channel_layout; -} AVFrame; - struct AVCodecInternal; enum AVFieldOrder { @@ -1340,13 +1043,6 @@ typedef struct AVCodecContext { */ unsigned int stream_codec_tag; -#if FF_API_SUB_ID - /** - * @deprecated this field is unused - */ - attribute_deprecated int sub_id; -#endif - void *priv_data; /** @@ -1469,16 +1165,20 @@ typedef struct AVCodecContext { /** * picture width / height. * - encoding: MUST be set by user. - * - decoding: Set by libavcodec. - * Note: For compatibility it is possible to set this instead of - * coded_width/height before decoding. + * - 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. */ int width, height; /** - * Bitstream width / height, may be different from width/height. + * Bitstream width / height, may be different from width/height e.g. when + * the decoded frame is cropped before being output. * - encoding: unused - * - decoding: Set by user before init if known. Codec should override / dynamically change if needed. + * - 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. */ int coded_width, coded_height; @@ -1503,7 +1203,7 @@ typedef struct AVCodecContext { /** * 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] + * 8 (umh), 10 (tesa) [7, 8, 10 are x264 specific] * - encoding: MUST be set by user. * - decoding: unused */ @@ -1570,22 +1270,6 @@ typedef struct AVCodecContext { int b_frame_strategy; -#if FF_API_MPV_GLOBAL_OPTS - /** - * luma single coefficient elimination threshold - * - encoding: Set by user. - * - decoding: unused - */ - attribute_deprecated int luma_elim_threshold; - - /** - * chroma single coeff elimination threshold - * - encoding: Set by user. - * - decoding: unused - */ - attribute_deprecated int chroma_elim_threshold; -#endif - /** * qscale offset between IP and B-frames * - encoding: Set by user. @@ -1726,8 +1410,6 @@ typedef struct AVCodecContext { #define FF_CMP_VSAD 8 #define FF_CMP_VSSE 9 #define FF_CMP_NSSE 10 -#define FF_CMP_W53 11 -#define FF_CMP_W97 12 #define FF_CMP_DCTMAX 13 #define FF_CMP_DCT264 14 #define FF_CMP_CHROMA 256 @@ -1815,16 +1497,6 @@ typedef struct AVCodecContext { */ int inter_quant_bias; -#if FF_API_COLOR_TABLE_ID - /** - * color table ID - * - encoding: unused - * - decoding: Which clrtable should be used for 8bit RGB images. - * Tables have to be stored somewhere. FIXME - */ - attribute_deprecated int color_table_id; -#endif - /** * slice flags * - encoding: unused @@ -1881,20 +1553,6 @@ typedef struct AVCodecContext { */ int noise_reduction; -#if FF_API_INTER_THRESHOLD - /** - * @deprecated this field is unused - */ - attribute_deprecated int inter_threshold; -#endif - -#if FF_API_MPV_GLOBAL_OPTS - /** - * @deprecated use mpegvideo private options instead - */ - attribute_deprecated int quantizer_noise_shaping; -#endif - /** * Motion estimation threshold below which no motion estimation is * performed, but instead the user specified motion vectors are used. @@ -2122,7 +1780,7 @@ typedef struct AVCodecContext { * - decoding: Set by user. * @deprecated Deprecated in favor of request_channel_layout. */ - int request_channels; + attribute_deprecated int request_channels; #endif /** @@ -2153,6 +1811,7 @@ typedef struct AVCodecContext { */ enum AVSampleFormat request_sample_fmt; +#if FF_API_GET_BUFFER /** * Called at the beginning of each frame to get a buffer for it. * @@ -2195,7 +1854,12 @@ typedef struct AVCodecContext { * * 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. + * 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() @@ -2207,7 +1871,10 @@ typedef struct AVCodecContext { * * - encoding: unused * - decoding: Set by libavcodec, user can override. + * + * @deprecated use get_buffer2() */ + attribute_deprecated int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); /** @@ -2218,7 +1885,10 @@ typedef struct AVCodecContext { * 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); /** @@ -2233,8 +1903,105 @@ typedef struct AVCodecContext { * - encoding: unused * - decoding: Set by libavcodec, user can override. */ + attribute_deprecated int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); +#endif + + /** + * This callback is called at the beginning of each frame to get data + * buffer(s) for it. There may be one contiguous buffer for all the data or + * there may be a buffer per each data plane or anything in between. What + * this means is, you may set however many entries in buf[] you feel necessary. + * Each buffer must be reference-counted using the AVBuffer API (see description + * of buf[] below). + * + * The following fields will be set in the frame before this callback is + * called: + * - format + * - width, height (video only) + * - sample_rate, channel_layout, nb_samples (audio only) + * Their values may differ from the corresponding values in + * AVCodecContext. This callback must use the frame values, not the codec + * context values, to calculate the required buffer size. + * + * This callback must fill the following fields in the frame: + * - data[] + * - linesize[] + * - extended_data: + * * if the data is planar audio with more than 8 channels, then this + * callback must allocate and fill extended_data to contain all pointers + * to all data planes. data[] must hold as many pointers as it can. + * extended_data must be allocated with av_malloc() and will be freed in + * av_frame_unref(). + * * otherwise exended_data must point to data + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of + * the frame's data and extended_data pointers must be contained in these. That + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by + * this callback and filled with the extra buffers if there are more + * 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 + * avcodec_default_get_buffer2() instead of providing buffers allocated by + * some other means. + * + * Each data plane must be aligned to the maximum required by the target + * CPU. + * + * @see avcodec_default_get_buffer2() + * + * Video: + * + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * If CODEC_FLAG_EMU_EDGE is not set in s->flags, the buffer must contain an + * edge of the size returned by avcodec_get_edge_width() on all sides. + * + * 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, + * this callback may be called from a different thread, but not from more + * than one at once. Does not need to be reentrant. + * + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() + * 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. + */ + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); + /** + * If non-zero, the decoded audio and video frames returned from + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted + * and are valid indefinitely. The caller must free them with + * av_frame_unref() when they are not needed anymore. + * Otherwise, the decoded frames must not be freed by the caller and are + * only valid until the next decode call. + * + * - encoding: unused + * - decoding: set by the caller before avcodec_open2(). + */ + int refcounted_frames; /* - encoding parameters */ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) @@ -2263,7 +2030,7 @@ typedef struct AVCodecContext { /** * ratecontrol qmin qmax limiting method - * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax. + * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. * - encoding: Set by user. * - decoding: unused */ @@ -2626,38 +2393,18 @@ typedef struct AVCodecContext { #define FF_IDCT_INT 1 #define FF_IDCT_SIMPLE 2 #define FF_IDCT_SIMPLEMMX 3 -#if FF_API_LIBMPEG2 -#define FF_IDCT_LIBMPEG2MMX 4 -#endif -#if FF_API_MMI -#define FF_IDCT_MMI 5 -#endif #define FF_IDCT_ARM 7 #define FF_IDCT_ALTIVEC 8 #define FF_IDCT_SH4 9 #define FF_IDCT_SIMPLEARM 10 -#define FF_IDCT_H264 11 -#define FF_IDCT_VP3 12 #define FF_IDCT_IPP 13 #define FF_IDCT_XVIDMMX 14 -#define FF_IDCT_CAVS 15 #define FF_IDCT_SIMPLEARMV5TE 16 #define FF_IDCT_SIMPLEARMV6 17 #define FF_IDCT_SIMPLEVIS 18 -#define FF_IDCT_WMV2 19 #define FF_IDCT_FAAN 20 -#define FF_IDCT_EA 21 #define FF_IDCT_SIMPLENEON 22 #define FF_IDCT_SIMPLEALPHA 23 -#define FF_IDCT_BINK 24 - -#if FF_API_DSP_MASK - /** - * Unused. - * @deprecated use av_set_cpu_flags_mask() instead. - */ - attribute_deprecated unsigned dsp_mask; -#endif /** * bits per sample/pixel from the demuxer (needed for huffyuv). @@ -2673,12 +2420,16 @@ typedef struct AVCodecContext { */ int bits_per_raw_sample; +#if FF_API_LOWRES /** * low resolution decoding, 1-> 1/2 size, 2->1/4 size * - encoding: unused * - decoding: Set by user. + * + * @deprecated use decoder private options instead */ attribute_deprecated int lowres; +#endif /** * the picture in the bitstream @@ -2787,6 +2538,8 @@ typedef struct AVCodecContext { #define FF_PROFILE_AAC_HE_V2 28 #define FF_PROFILE_AAC_LD 22 #define FF_PROFILE_AAC_ELD 38 +#define FF_PROFILE_MPEG2_AAC_LOW 128 +#define FF_PROFILE_MPEG2_AAC_HE 131 #define FF_PROFILE_DTS 20 #define FF_PROFILE_DTS_ES 30 @@ -2840,6 +2593,12 @@ typedef struct AVCodecContext { #define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 0 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 1 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 2 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 + /** * level * - encoding: Set by user. @@ -3143,6 +2902,8 @@ enum AVSubtitleType { SUBTITLE_ASS, }; +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + typedef struct AVSubtitleRect { int x; ///< top left corner of pict, undefined when pict is not set int y; ///< top left corner of pict, undefined when pict is not set @@ -3165,6 +2926,7 @@ typedef struct AVSubtitleRect { * struct. */ char *ass; + int flags; } AVSubtitleRect; typedef struct AVSubtitle { @@ -3362,10 +3124,14 @@ void avsubtitle_free(AVSubtitle *sub); * @{ */ +#if FF_API_DESTRUCT_PACKET /** * Default packet destructor. + * @deprecated use the AVBuffer API instead */ +attribute_deprecated void av_destruct_packet(AVPacket *pkt); +#endif /** * Initialize optional fields of a packet with default values. @@ -3403,6 +3169,21 @@ void av_shrink_packet(AVPacket *pkt, int size); */ int av_grow_packet(AVPacket *pkt, int grow_by); +/** + * Initialize a reference-counted packet from av_malloc()ed data. + * + * @param pkt packet to be initialized. This function will set the data, size, + * buf and destruct fields, all others are left untouched. + * @param data Data allocated by av_malloc() to be used as packet data. If this + * 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. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); + /** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. @@ -3449,6 +3230,66 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size); +/** + * Convenience function to free all the side data stored. + * All the other fields stay untouched. + * + * @param pkt packet + */ +void av_packet_free_side_data(AVPacket *pkt); + +/** + * Setup a new reference to the data described by a given packet + * + * If src is reference-counted, setup dst as a new reference to the + * buffer in src. Otherwise allocate a new buffer in dst and copy the + * data from src into it. + * + * All the other fields are copied from src. + * + * @see av_packet_unref + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_packet_ref(AVPacket *dst, AVPacket *src); + +/** + * Wipe the packet. + * + * Unreference the buffer referenced by the packet and reset the + * remaining packet fields to their default values. + * + * @param pkt The packet to be unreferenced. + */ +void av_packet_unref(AVPacket *pkt); + +/** + * Move every field in src to dst and reset src. + * + * @see av_packet_unref + * + * @param src Source packet, will be reset + * @param dst Destination packet + */ +void av_packet_move_ref(AVPacket *dst, AVPacket *src); + +/** + * Copy only "properties" fields from src to dst. + * + * Properties for the purpose of this function are all the fields + * beside those related to the packet data (buf, data, size) + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success AVERROR on failure. + * + */ +int av_packet_copy_props(AVPacket *dst, const AVPacket *src); + /** * @} */ @@ -3474,9 +3315,18 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); */ AVCodec *avcodec_find_decoder_by_name(const char *name); -int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); -void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); -int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); +#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. + */ +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); /** * Return the amount of padding in pixels which the get_buffer callback must @@ -3510,66 +3360,6 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]); -#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. * @@ -3589,11 +3379,17 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s * * @param avctx the codec context * @param[out] frame The AVFrame in which to store decoded audio samples. - * Decoders request a buffer of a particular size by setting - * AVFrame.nb_samples prior to calling get_buffer(). The - * decoder may, however, only utilize part of the buffer by - * setting AVFrame.nb_samples to a smaller value in the - * output frame. + * The decoder will allocate a buffer for the decoded frame by + * calling the AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is * non-zero. * @param[in] avpkt The input AVPacket containing the input buffer. @@ -3631,12 +3427,18 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, * * @param avctx the codec context * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * Use avcodec_alloc_frame to get an AVFrame, the codec will - * allocate memory for the actual bitmap. - * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit. - * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder - * decodes and the decoder tells the user once it does not need the data anymore, - * the user app can at this point free/reuse/keep the memory as it sees fit. + * Use av_frame_alloc() to get an AVFrame. The codec will + * allocate memory for the actual bitmap by calling the + * AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. * * @param[in] avpkt The input AVpacket containing the input buffer. * You can create such packet with av_init_packet() and by then setting @@ -3676,6 +3478,13 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, * @{ */ +enum AVPictureStructure { + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame +}; + typedef struct AVCodecParserContext { void *priv_data; struct AVCodecParser *parser; @@ -3809,6 +3618,26 @@ typedef struct AVCodecParserContext { * For all other types, this is in units of AVCodecContext.time_base. */ int duration; + + enum AVFieldOrder field_order; + + /** + * Indicate whether a picture is coded as a frame, top field or bottom field. + * + * For example, H.264 field_pic_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag + * equal to 1 and bottom_field_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_TOP_FIELD. + */ + enum AVPictureStructure picture_structure; + + /** + * Picture number incremented in presentation or output order. + * This field may be reinitialized at the first picture of a new sequence. + * + * For example, this corresponds to H.264 PicOrderCnt. + */ + int output_picture_number; } AVCodecParserContext; typedef struct AVCodecParser { @@ -3864,6 +3693,10 @@ int av_parser_parse2(AVCodecParserContext *s, int64_t pts, int64_t dts, int64_t pos); +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitstreamFilter + */ int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, @@ -3896,36 +3729,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. * @@ -3967,26 +3770,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. * @@ -4032,103 +3815,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, * @} */ -#if FF_API_AVCODEC_RESAMPLE -/** - * @defgroup lavc_resample Audio resampling - * @ingroup libavc - * @deprecated use libavresample instead - * - * @{ - */ -struct ReSampleContext; -struct AVResampleContext; - -typedef struct ReSampleContext ReSampleContext; - -/** - * Initialize audio resampling context. - * - * @param output_channels number of output channels - * @param input_channels number of input channels - * @param output_rate output sample rate - * @param input_rate input sample rate - * @param sample_fmt_out requested output sample format - * @param sample_fmt_in input sample format - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency - * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear if 1 then the used FIR filter will be linearly interpolated - between the 2 closest, if 0 the closest will be used - * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate - * @return allocated ReSampleContext, NULL if error occurred - */ -attribute_deprecated -ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate, - enum AVSampleFormat sample_fmt_out, - enum AVSampleFormat sample_fmt_in, - int filter_length, int log2_phase_count, - int linear, double cutoff); - -attribute_deprecated -int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); - -/** - * Free resample context. - * - * @param s a non-NULL pointer to a resample context previously - * created with av_audio_resample_init() - */ -attribute_deprecated -void audio_resample_close(ReSampleContext *s); - - -/** - * Initialize an audio resampler. - * Note, if either rate is not an integer then simply scale both rates up so they are. - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq - * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear If 1 then the used FIR filter will be linearly interpolated - between the 2 closest, if 0 the closest will be used - * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate - */ -attribute_deprecated -struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); - -/** - * Resample an array of samples using a previously configured context. - * @param src an array of unconsumed samples - * @param consumed the number of samples of src which have been consumed are returned here - * @param src_size the number of unconsumed samples available - * @param dst_size the amount of space in samples available in dst - * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. - * @return the number of samples written in dst or -1 if an error occurred - */ -attribute_deprecated -int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); - - -/** - * Compensate samplerate/timestamp drift. The compensation is done by changing - * the resampler parameters, so no audible clicks or similar distortions occur - * @param compensation_distance distance in output samples over which the compensation should be performed - * @param sample_delta number of output samples which should be output less - * - * example: av_resample_compensate(c, 10, 500) - * here instead of 510 samples only 500 samples would be output - * - * note, due to rounding the actual compensation might be slightly different, - * especially if the compensation_distance is large and the in_rate used during init is small - */ -attribute_deprecated -void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); -attribute_deprecated -void av_resample_close(struct AVResampleContext *c); - -/** - * @} - */ -#endif - /** * @addtogroup lavc_picture * @{ @@ -4212,11 +3898,16 @@ int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, */ 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 */ +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_picture_data_copy() above. */ @@ -4255,7 +3946,11 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, * @{ */ -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); +/** + * @deprecated Use av_pix_fmt_get_chroma_sub_sample + */ + +void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); /** * Return a value representing the fourCC code associated to the @@ -4291,36 +3986,6 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha); -#if FF_API_FIND_BEST_PIX_FMT -/** - * @deprecated use avcodec_find_best_pix_fmt2() instead. - * - * Find the best pixel format to convert to given a certain source pixel - * format. When converting from one pixel format to another, information loss - * may occur. For example, when converting from RGB24 to GRAY, the color - * information will be lost. Similarly, other losses occur when converting from - * some formats to other formats. avcodec_find_best_pix_fmt() searches which of - * the given pixel formats should be used to suffer the least amount of loss. - * The pixel formats from which it chooses one, are determined by the - * pix_fmt_mask parameter. - * - * @code - * src_pix_fmt = AV_PIX_FMT_YUV420P; - * pix_fmt_mask = (1 << AV_PIX_FMT_YUV422P) || (1 << AV_PIX_FMT_RGB24); - * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); - * @endcode - * - * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from - * @param[in] src_pix_fmt source pixel format - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. - * @return The best pixel format to convert to or -1 if none was found. - */ -attribute_deprecated -enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt, - int has_alpha, int *loss_ptr); -#endif /* FF_API_FIND_BEST_PIX_FMT */ - /** * Find the best pixel format to convert to given a certain source pixel * format. When converting from one pixel format to another, information loss @@ -4395,12 +4060,16 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, int buf_size, int align); /** - * Flush buffers, should be called when seeking or when switching to a different stream. + * Reset the internal decoder state / flush internal buffers. Should be called + * e.g. when seeking or when switching to a different stream. + * + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0), + * this invalidates the frames previously returned from the decoder. When + * refcounted frames are used, the decoder just releases any references it might + * keep internally, but the caller's reference remains valid. */ void avcodec_flush_buffers(AVCodecContext *avctx); -void avcodec_default_free_buffers(AVCodecContext *s); - /** * Return codec bits per sample. * @@ -4500,6 +4169,7 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); */ unsigned int av_xiphlacing(unsigned char *s, unsigned int v); +#if FF_API_MISSING_SAMPLE /** * Log a generic warning message about a missing feature. This function is * intended to be used internally by Libav (libavcodec, libavformat, etc.) @@ -4511,7 +4181,9 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v); * If want_sample is non-zero, additional verbage will be added to the log * message which tells the user how to report samples to the development * mailing list. + * @deprecated Use avpriv_report_missing_feature() instead. */ +attribute_deprecated void av_log_missing_feature(void *avc, const char *feature, int want_sample); /** @@ -4521,8 +4193,11 @@ void av_log_missing_feature(void *avc, const char *feature, int want_sample); * @param[in] avc a pointer to an arbitrary struct of which the first field is * a pointer to an AVClass struct * @param[in] msg string containing an optional message, or NULL if no message + * @deprecated Use avpriv_request_sample() instead. */ +attribute_deprecated void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); +#endif /* FF_API_MISSING_SAMPLE */ /** * Register the hardware accelerator hwaccel.