Path: blob/master/dep/ffmpeg/include/libavcodec/avcodec.h
7420 views
/*1* copyright (c) 2001 Fabrice Bellard2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#ifndef AVCODEC_AVCODEC_H21#define AVCODEC_AVCODEC_H2223/**24* @file25* @ingroup libavc26* Libavcodec external API header27*/2829#include "libavutil/samplefmt.h"30#include "libavutil/attributes.h"31#include "libavutil/avutil.h"32#include "libavutil/buffer.h"33#include "libavutil/channel_layout.h"34#include "libavutil/dict.h"35#include "libavutil/frame.h"36#include "libavutil/log.h"37#include "libavutil/pixfmt.h"38#include "libavutil/rational.h"3940#include "codec.h"41#include "codec_id.h"42#include "defs.h"43#include "packet.h"44#include "version_major.h"45#ifndef HAVE_AV_CONFIG_H46/* When included as part of the ffmpeg build, only include the major version47* to avoid unnecessary rebuilds. When included externally, keep including48* the full version information. */49#include "version.h"5051#include "codec_desc.h"52#include "codec_par.h"53#endif5455struct AVCodecParameters;5657/**58* @defgroup libavc libavcodec59* Encoding/Decoding Library60*61* @{62*63* @defgroup lavc_decoding Decoding64* @{65* @}66*67* @defgroup lavc_encoding Encoding68* @{69* @}70*71* @defgroup lavc_codec Codecs72* @{73* @defgroup lavc_codec_native Native Codecs74* @{75* @}76* @defgroup lavc_codec_wrappers External library wrappers77* @{78* @}79* @defgroup lavc_codec_hwaccel Hardware Accelerators bridge80* @{81* @}82* @}83* @defgroup lavc_internal Internal84* @{85* @}86* @}87*/8889/**90* @ingroup libavc91* @defgroup lavc_encdec send/receive encoding and decoding API overview92* @{93*94* The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/95* avcodec_receive_packet() functions provide an encode/decode API, which96* decouples input and output.97*98* The API is very similar for encoding/decoding and audio/video, and works as99* follows:100* - Set up and open the AVCodecContext as usual.101* - Send valid input:102* - For decoding, call avcodec_send_packet() to give the decoder raw103* compressed data in an AVPacket.104* - For encoding, call avcodec_send_frame() to give the encoder an AVFrame105* containing uncompressed audio or video.106*107* In both cases, it is recommended that AVPackets and AVFrames are108* refcounted, or libavcodec might have to copy the input data. (libavformat109* always returns refcounted AVPackets, and av_frame_get_buffer() allocates110* refcounted AVFrames.)111* - Receive output in a loop. Periodically call one of the avcodec_receive_*()112* functions and process their output:113* - For decoding, call avcodec_receive_frame(). On success, it will return114* an AVFrame containing uncompressed audio or video data.115* - For encoding, call avcodec_receive_packet(). On success, it will return116* an AVPacket with a compressed frame.117*118* Repeat this call until it returns AVERROR(EAGAIN) or an error. The119* AVERROR(EAGAIN) return value means that new input data is required to120* return new output. In this case, continue with sending input. For each121* input frame/packet, the codec will typically return 1 output frame/packet,122* but it can also be 0 or more than 1.123*124* At the beginning of decoding or encoding, the codec might accept multiple125* input frames/packets without returning a frame, until its internal buffers126* are filled. This situation is handled transparently if you follow the steps127* outlined above.128*129* In theory, sending input can result in EAGAIN - this should happen only if130* not all output was received. You can use this to structure alternative decode131* or encode loops other than the one suggested above. For example, you could132* try sending new input on each iteration, and try to receive output if that133* returns EAGAIN.134*135* End of stream situations. These require "flushing" (aka draining) the codec,136* as the codec might buffer multiple frames or packets internally for137* performance or out of necessity (consider B-frames).138* This is handled as follows:139* - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)140* or avcodec_send_frame() (encoding) functions. This will enter draining141* mode.142* - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()143* (encoding) in a loop until AVERROR_EOF is returned. The functions will144* not return AVERROR(EAGAIN), unless you forgot to enter draining mode.145* - Before decoding can be resumed again, the codec has to be reset with146* avcodec_flush_buffers().147*148* Using the API as outlined above is highly recommended. But it is also149* possible to call functions outside of this rigid schema. For example, you can150* call avcodec_send_packet() repeatedly without calling151* avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed152* until the codec's internal buffer has been filled up (which is typically of153* size 1 per output frame, after initial input), and then reject input with154* AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to155* read at least some output.156*157* Not all codecs will follow a rigid and predictable dataflow; the only158* guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on159* one end implies that a receive/send call on the other end will succeed, or160* at least will not fail with AVERROR(EAGAIN). In general, no codec will161* permit unlimited buffering of input or output.162*163* A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This164* would be an invalid state, which could put the codec user into an endless165* loop. The API has no concept of time either: it cannot happen that trying to166* do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second167* later accepts the packet (with no other receive/flush API calls involved).168* The API is a strict state machine, and the passage of time is not supposed169* to influence it. Some timing-dependent behavior might still be deemed170* acceptable in certain cases. But it must never result in both send/receive171* returning EAGAIN at the same time at any point. It must also absolutely be172* avoided that the current state is "unstable" and can "flip-flop" between173* the send/receive APIs allowing progress. For example, it's not allowed that174* the codec randomly decides that it actually wants to consume a packet now175* instead of returning a frame, after it just returned AVERROR(EAGAIN) on an176* avcodec_send_packet() call.177* @}178*/179180/**181* @defgroup lavc_core Core functions/structures.182* @ingroup libavc183*184* Basic definitions, functions for querying libavcodec capabilities,185* allocating core structures, etc.186* @{187*/188189/**190* @ingroup lavc_encoding191*/192typedef struct RcOverride{193int start_frame;194int end_frame;195int qscale; // If this is 0 then quality_factor will be used instead.196float quality_factor;197} RcOverride;198199/* encoding support200These flags can be passed in AVCodecContext.flags before initialization.201Note: Not everything is supported yet.202*/203204/**205* Allow decoders to produce frames with data planes that are not aligned206* to CPU requirements (e.g. due to cropping).207*/208#define AV_CODEC_FLAG_UNALIGNED (1 << 0)209/**210* Use fixed qscale.211*/212#define AV_CODEC_FLAG_QSCALE (1 << 1)213/**214* 4 MV per MB allowed / advanced prediction for H.263.215*/216#define AV_CODEC_FLAG_4MV (1 << 2)217/**218* Output even those frames that might be corrupted.219*/220#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3)221/**222* Use qpel MC.223*/224#define AV_CODEC_FLAG_QPEL (1 << 4)225/**226* Request the encoder to output reconstructed frames, i.e.\ frames that would227* be produced by decoding the encoded bitstream. These frames may be retrieved228* by calling avcodec_receive_frame() immediately after a successful call to229* avcodec_receive_packet().230*231* Should only be used with encoders flagged with the232* @ref AV_CODEC_CAP_ENCODER_RECON_FRAME capability.233*234* @note235* Each reconstructed frame returned by the encoder corresponds to the last236* encoded packet, i.e. the frames are returned in coded order rather than237* presentation order.238*239* @note240* Frame parameters (like pixel format or dimensions) do not have to match the241* AVCodecContext values. Make sure to use the values from the returned frame.242*/243#define AV_CODEC_FLAG_RECON_FRAME (1 << 6)244/**245* @par decoding246* Request the decoder to propagate each packet's AVPacket.opaque and247* AVPacket.opaque_ref to its corresponding output AVFrame.248*249* @par encoding:250* Request the encoder to propagate each frame's AVFrame.opaque and251* AVFrame.opaque_ref values to its corresponding output AVPacket.252*253* @par254* May only be set on encoders that have the255* @ref AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability flag.256*257* @note258* While in typical cases one input frame produces exactly one output packet259* (perhaps after a delay), in general the mapping of frames to packets is260* M-to-N, so261* - Any number of input frames may be associated with any given output packet.262* This includes zero - e.g. some encoders may output packets that carry only263* metadata about the whole stream.264* - A given input frame may be associated with any number of output packets.265* Again this includes zero - e.g. some encoders may drop frames under certain266* conditions.267* .268* This implies that when using this flag, the caller must NOT assume that269* - a given input frame's opaques will necessarily appear on some output packet;270* - every output packet will have some non-NULL opaque value.271* .272* When an output packet contains multiple frames, the opaque values will be273* taken from the first of those.274*275* @note276* The converse holds for decoders, with frames and packets switched.277*/278#define AV_CODEC_FLAG_COPY_OPAQUE (1 << 7)279/**280* Signal to the encoder that the values of AVFrame.duration are valid and281* should be used (typically for transferring them to output packets).282*283* If this flag is not set, frame durations are ignored.284*/285#define AV_CODEC_FLAG_FRAME_DURATION (1 << 8)286/**287* Use internal 2pass ratecontrol in first pass mode.288*/289#define AV_CODEC_FLAG_PASS1 (1 << 9)290/**291* Use internal 2pass ratecontrol in second pass mode.292*/293#define AV_CODEC_FLAG_PASS2 (1 << 10)294/**295* loop filter.296*/297#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11)298/**299* Only decode/encode grayscale.300*/301#define AV_CODEC_FLAG_GRAY (1 << 13)302/**303* error[?] variables will be set during encoding.304*/305#define AV_CODEC_FLAG_PSNR (1 << 15)306/**307* Use interlaced DCT.308*/309#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18)310/**311* Force low delay.312*/313#define AV_CODEC_FLAG_LOW_DELAY (1 << 19)314/**315* Place global headers in extradata instead of every keyframe.316*/317#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)318/**319* Use only bitexact stuff (except (I)DCT).320*/321#define AV_CODEC_FLAG_BITEXACT (1 << 23)322/* Fx : Flag for H.263+ extra options */323/**324* H.263 advanced intra coding / MPEG-4 AC prediction325*/326#define AV_CODEC_FLAG_AC_PRED (1 << 24)327/**328* interlaced motion estimation329*/330#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29)331#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31)332333/**334* Allow non spec compliant speedup tricks.335*/336#define AV_CODEC_FLAG2_FAST (1 << 0)337/**338* Skip bitstream encoding.339*/340#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2)341/**342* Place global headers at every keyframe instead of in extradata.343*/344#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)345346/**347* Input bitstream might be truncated at a packet boundaries348* instead of only at frame boundaries.349*/350#define AV_CODEC_FLAG2_CHUNKS (1 << 15)351/**352* Discard cropping information from SPS.353*/354#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16)355356/**357* Show all frames before the first keyframe358*/359#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22)360/**361* Export motion vectors through frame side data362*/363#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28)364/**365* Do not skip samples and export skip information as frame side data366*/367#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29)368/**369* Do not reset ASS ReadOrder field on flush (subtitles decoding)370*/371#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)372/**373* Generate/parse ICC profiles on encode/decode, as appropriate for the type of374* file. No effect on codecs which cannot contain embedded ICC profiles, or375* when compiled without support for lcms2.376*/377#define AV_CODEC_FLAG2_ICC_PROFILES (1U << 31)378379/* Exported side data.380These flags can be passed in AVCodecContext.export_side_data before initialization.381*/382/**383* Export motion vectors through frame side data384*/385#define AV_CODEC_EXPORT_DATA_MVS (1 << 0)386/**387* Export encoder Producer Reference Time through packet side data388*/389#define AV_CODEC_EXPORT_DATA_PRFT (1 << 1)390/**391* Decoding only.392* Export the AVVideoEncParams structure through frame side data.393*/394#define AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS (1 << 2)395/**396* Decoding only.397* Do not apply film grain, export it instead.398*/399#define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3)400401/**402* Decoding only.403* Do not apply picture enhancement layers, export them instead.404*/405#define AV_CODEC_EXPORT_DATA_ENHANCEMENTS (1 << 4)406407/**408* The decoder will keep a reference to the frame and may reuse it later.409*/410#define AV_GET_BUFFER_FLAG_REF (1 << 0)411412/**413* The encoder will keep a reference to the packet and may reuse it later.414*/415#define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0)416417/**418* main external API structure.419* New fields can be added to the end with minor version bumps.420* Removal, reordering and changes to existing fields require a major421* version bump.422* You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user423* applications.424* The name string for AVOptions options matches the associated command line425* parameter name and can be found in libavcodec/options_table.h426* The AVOption/command line parameter names differ in some cases from the C427* structure field names for historic reasons or brevity.428* sizeof(AVCodecContext) must not be used outside libav*.429*/430typedef struct AVCodecContext {431/**432* information on struct for av_log433* - set by avcodec_alloc_context3434*/435const AVClass *av_class;436int log_level_offset;437438enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */439const struct AVCodec *codec;440enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */441442/**443* fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').444* This is used to work around some encoder bugs.445* A demuxer should set this to what is stored in the field used to identify the codec.446* If there are multiple such fields in a container then the demuxer should choose the one447* which maximizes the information about the used codec.448* If the codec tag field in a container is larger than 32 bits then the demuxer should449* remap the longer ID to 32 bits with a table or other structure. Alternatively a new450* extra_codec_tag + size could be added but for this a clear advantage must be demonstrated451* first.452* - encoding: Set by user, if not then the default based on codec_id will be used.453* - decoding: Set by user, will be converted to uppercase by libavcodec during init.454*/455unsigned int codec_tag;456457void *priv_data;458459/**460* Private context used for internal data.461*462* Unlike priv_data, this is not codec-specific. It is used in general463* libavcodec functions.464*/465struct AVCodecInternal *internal;466467/**468* Private data of the user, can be used to carry app specific stuff.469* - encoding: Set by user.470* - decoding: Set by user.471*/472void *opaque;473474/**475* the average bitrate476* - encoding: Set by user; unused for constant quantizer encoding.477* - decoding: Set by user, may be overwritten by libavcodec478* if this info is available in the stream479*/480int64_t bit_rate;481482/**483* AV_CODEC_FLAG_*.484* - encoding: Set by user.485* - decoding: Set by user.486*/487int flags;488489/**490* AV_CODEC_FLAG2_*491* - encoding: Set by user.492* - decoding: Set by user.493*/494int flags2;495496/**497* Out-of-band global headers that may be used by some codecs.498*499* - decoding: Should be set by the caller when available (typically from a500* demuxer) before opening the decoder; some decoders require this to be501* set and will fail to initialize otherwise.502*503* The array must be allocated with the av_malloc() family of functions;504* allocated size must be at least AV_INPUT_BUFFER_PADDING_SIZE bytes505* larger than extradata_size.506*507* - encoding: May be set by the encoder in avcodec_open2() (possibly508* depending on whether the AV_CODEC_FLAG_GLOBAL_HEADER flag is set).509*510* After being set, the array is owned by the codec and freed in511* avcodec_free_context().512*/513uint8_t *extradata;514int extradata_size;515516/**517* This is the fundamental unit of time (in seconds) in terms518* of which frame timestamps are represented. For fixed-fps content,519* timebase should be 1/framerate and timestamp increments should be520* identically 1.521* This often, but not always is the inverse of the frame rate or field rate522* for video. 1/time_base is not the average frame rate if the frame rate is not523* constant.524*525* Like containers, elementary streams also can store timestamps, 1/time_base526* is the unit in which these timestamps are specified.527* As example of such codec time base see ISO/IEC 14496-2:2001(E)528* vop_time_increment_resolution and fixed_vop_rate529* (fixed_vop_rate == 0 implies that it is different from the framerate)530*531* - encoding: MUST be set by user.532* - decoding: unused.533*/534AVRational time_base;535536/**537* Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.538* - encoding: unused.539* - decoding: set by user.540*/541AVRational pkt_timebase;542543/**544* - decoding: For codecs that store a framerate value in the compressed545* bitstream, the decoder may export it here. { 0, 1} when546* unknown.547* - encoding: May be used to signal the framerate of CFR content to an548* encoder.549*/550AVRational framerate;551552/**553* Codec delay.554*555* Encoding: Number of frames delay there will be from the encoder input to556* the decoder output. (we assume the decoder matches the spec)557* Decoding: Number of frames delay in addition to what a standard decoder558* as specified in the spec would produce.559*560* Video:561* Number of frames the decoded output will be delayed relative to the562* encoded input.563*564* Audio:565* For encoding, this field is unused (see initial_padding).566*567* For decoding, this is the number of samples the decoder needs to568* output before the decoder's output is valid. When seeking, you should569* start decoding this many samples prior to your desired seek point.570*571* - encoding: Set by libavcodec.572* - decoding: Set by libavcodec.573*/574int delay;575576577/* video only */578/**579* picture width / height.580*581* @note Those fields may not match the values of the last582* AVFrame output by avcodec_receive_frame() due frame583* reordering.584*585* - encoding: MUST be set by user.586* - decoding: May be set by the user before opening the decoder if known e.g.587* from the container. Some decoders will require the dimensions588* to be set by the caller. During decoding, the decoder may589* overwrite those values as required while parsing the data.590*/591int width, height;592593/**594* Bitstream width / height, may be different from width/height e.g. when595* the decoded frame is cropped before being output or lowres is enabled.596*597* @note Those field may not match the value of the last598* AVFrame output by avcodec_receive_frame() due frame599* reordering.600*601* - encoding: unused602* - decoding: May be set by the user before opening the decoder if known603* e.g. from the container. During decoding, the decoder may604* overwrite those values as required while parsing the data.605*/606int coded_width, coded_height;607608/**609* sample aspect ratio (0 if unknown)610* That is the width of a pixel divided by the height of the pixel.611* Numerator and denominator must be relatively prime and smaller than 256 for some video standards.612* - encoding: Set by user.613* - decoding: Set by libavcodec.614*/615AVRational sample_aspect_ratio;616617/**618* Pixel format, see AV_PIX_FMT_xxx.619* May be set by the demuxer if known from headers.620* May be overridden by the decoder if it knows better.621*622* @note This field may not match the value of the last623* AVFrame output by avcodec_receive_frame() due frame624* reordering.625*626* - encoding: Set by user.627* - decoding: Set by user if known, overridden by libavcodec while628* parsing the data.629*/630enum AVPixelFormat pix_fmt;631632/**633* Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.634* - encoding: unused.635* - decoding: Set by libavcodec before calling get_format()636*/637enum AVPixelFormat sw_pix_fmt;638639/**640* Chromaticity coordinates of the source primaries.641* - encoding: Set by user642* - decoding: Set by libavcodec643*/644enum AVColorPrimaries color_primaries;645646/**647* Color Transfer Characteristic.648* - encoding: Set by user649* - decoding: Set by libavcodec650*/651enum AVColorTransferCharacteristic color_trc;652653/**654* YUV colorspace type.655* - encoding: Set by user656* - decoding: Set by libavcodec657*/658enum AVColorSpace colorspace;659660/**661* MPEG vs JPEG YUV range.662* - encoding: Set by user to override the default output color range value,663* If not specified, libavcodec sets the color range depending on the664* output format.665* - decoding: Set by libavcodec, can be set by the user to propagate the666* color range to components reading from the decoder context.667*/668enum AVColorRange color_range;669670/**671* This defines the location of chroma samples.672* - encoding: Set by user673* - decoding: Set by libavcodec674*/675enum AVChromaLocation chroma_sample_location;676677/** Field order678* - encoding: set by libavcodec679* - decoding: Set by user.680*/681enum AVFieldOrder field_order;682683/**684* number of reference frames685* - encoding: Set by user.686* - decoding: Set by lavc.687*/688int refs;689690/**691* Size of the frame reordering buffer in the decoder.692* For MPEG-2 it is 1 IPB or 0 low delay IP.693* - encoding: Set by libavcodec.694* - decoding: Set by libavcodec.695*/696int has_b_frames;697698/**699* slice flags700* - encoding: unused701* - decoding: Set by user.702*/703int slice_flags;704#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display705#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)706#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)707708/**709* If non NULL, 'draw_horiz_band' is called by the libavcodec710* decoder to draw a horizontal band. It improves cache usage. Not711* all codecs can do that. You must check the codec capabilities712* beforehand.713* When multithreading is used, it may be called from multiple threads714* at the same time; threads might draw different parts of the same AVFrame,715* or multiple AVFrames, and there is no guarantee that slices will be drawn716* in order.717* The function is also used by hardware acceleration APIs.718* It is called at least once during frame decoding to pass719* the data needed for hardware render.720* In that mode instead of pixel data, AVFrame points to721* a structure specific to the acceleration API. The application722* reads the structure and can change some fields to indicate progress723* or mark state.724* - encoding: unused725* - decoding: Set by user.726* @param height the height of the slice727* @param y the y position of the slice728* @param type 1->top field, 2->bottom field, 3->frame729* @param offset offset into the AVFrame.data from which the slice should be read730*/731void (*draw_horiz_band)(struct AVCodecContext *s,732const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],733int y, int type, int height);734735/**736* Callback to negotiate the pixel format. Decoding only, may be set by the737* caller before avcodec_open2().738*739* Called by some decoders to select the pixel format that will be used for740* the output frames. This is mainly used to set up hardware acceleration,741* then the provided format list contains the corresponding hwaccel pixel742* formats alongside the "software" one. The software pixel format may also743* be retrieved from \ref sw_pix_fmt.744*745* This callback will be called when the coded frame properties (such as746* resolution, pixel format, etc.) change and more than one output format is747* supported for those new properties. If a hardware pixel format is chosen748* and initialization for it fails, the callback may be called again749* immediately.750*751* This callback may be called from different threads if the decoder is752* multi-threaded, but not from more than one thread simultaneously.753*754* @param fmt list of formats which may be used in the current755* configuration, terminated by AV_PIX_FMT_NONE.756* @warning Behavior is undefined if the callback returns a value other757* than one of the formats in fmt or AV_PIX_FMT_NONE.758* @return the chosen format or AV_PIX_FMT_NONE759*/760enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);761762/**763* maximum number of B-frames between non-B-frames764* Note: The output will be delayed by max_b_frames+1 relative to the input.765* - encoding: Set by user.766* - decoding: unused767*/768int max_b_frames;769770/**771* qscale factor between IP and B-frames772* If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).773* If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).774* - encoding: Set by user.775* - decoding: unused776*/777float b_quant_factor;778779/**780* qscale offset between IP and B-frames781* - encoding: Set by user.782* - decoding: unused783*/784float b_quant_offset;785786/**787* qscale factor between P- and I-frames788* If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).789* If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).790* - encoding: Set by user.791* - decoding: unused792*/793float i_quant_factor;794795/**796* qscale offset between P and I-frames797* - encoding: Set by user.798* - decoding: unused799*/800float i_quant_offset;801802/**803* luminance masking (0-> disabled)804* - encoding: Set by user.805* - decoding: unused806*/807float lumi_masking;808809/**810* temporary complexity masking (0-> disabled)811* - encoding: Set by user.812* - decoding: unused813*/814float temporal_cplx_masking;815816/**817* spatial complexity masking (0-> disabled)818* - encoding: Set by user.819* - decoding: unused820*/821float spatial_cplx_masking;822823/**824* p block masking (0-> disabled)825* - encoding: Set by user.826* - decoding: unused827*/828float p_masking;829830/**831* darkness masking (0-> disabled)832* - encoding: Set by user.833* - decoding: unused834*/835float dark_masking;836837/**838* noise vs. sse weight for the nsse comparison function839* - encoding: Set by user.840* - decoding: unused841*/842int nsse_weight;843844/**845* motion estimation comparison function846* - encoding: Set by user.847* - decoding: unused848*/849int me_cmp;850/**851* subpixel motion estimation comparison function852* - encoding: Set by user.853* - decoding: unused854*/855int me_sub_cmp;856/**857* macroblock comparison function (not supported yet)858* - encoding: Set by user.859* - decoding: unused860*/861int mb_cmp;862/**863* interlaced DCT comparison function864* - encoding: Set by user.865* - decoding: unused866*/867int ildct_cmp;868#define FF_CMP_SAD 0869#define FF_CMP_SSE 1870#define FF_CMP_SATD 2871#define FF_CMP_DCT 3872#define FF_CMP_PSNR 4873#define FF_CMP_BIT 5874#define FF_CMP_RD 6875#define FF_CMP_ZERO 7876#define FF_CMP_VSAD 8877#define FF_CMP_VSSE 9878#define FF_CMP_NSSE 10879#define FF_CMP_W53 11880#define FF_CMP_W97 12881#define FF_CMP_DCTMAX 13882#define FF_CMP_DCT264 14883#define FF_CMP_MEDIAN_SAD 15884#define FF_CMP_CHROMA 256885886/**887* ME diamond size & shape888* - encoding: Set by user.889* - decoding: unused890*/891int dia_size;892893/**894* amount of previous MV predictors (2a+1 x 2a+1 square)895* - encoding: Set by user.896* - decoding: unused897*/898int last_predictor_count;899900/**901* motion estimation prepass comparison function902* - encoding: Set by user.903* - decoding: unused904*/905int me_pre_cmp;906907/**908* ME prepass diamond size & shape909* - encoding: Set by user.910* - decoding: unused911*/912int pre_dia_size;913914/**915* subpel ME quality916* - encoding: Set by user.917* - decoding: unused918*/919int me_subpel_quality;920921/**922* maximum motion estimation search range in subpel units923* If 0 then no limit.924*925* - encoding: Set by user.926* - decoding: unused927*/928int me_range;929930/**931* macroblock decision mode932* - encoding: Set by user.933* - decoding: unused934*/935int mb_decision;936#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp937#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits938#define FF_MB_DECISION_RD 2 ///< rate distortion939940/**941* custom intra quantization matrix942* Must be allocated with the av_malloc() family of functions, and will be freed in943* avcodec_free_context().944* - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.945* - decoding: Set/allocated/freed by libavcodec.946*/947uint16_t *intra_matrix;948949/**950* custom inter quantization matrix951* Must be allocated with the av_malloc() family of functions, and will be freed in952* avcodec_free_context().953* - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.954* - decoding: Set/allocated/freed by libavcodec.955*/956uint16_t *inter_matrix;957958/**959* custom intra quantization matrix960* - encoding: Set by user, can be NULL.961* - decoding: unused.962*/963uint16_t *chroma_intra_matrix;964965/**966* precision of the intra DC coefficient - 8967* - encoding: Set by user.968* - decoding: Set by libavcodec969*/970int intra_dc_precision;971972/**973* minimum MB Lagrange multiplier974* - encoding: Set by user.975* - decoding: unused976*/977int mb_lmin;978979/**980* maximum MB Lagrange multiplier981* - encoding: Set by user.982* - decoding: unused983*/984int mb_lmax;985986/**987* - encoding: Set by user.988* - decoding: unused989*/990int bidir_refine;991992/**993* minimum GOP size994* - encoding: Set by user.995* - decoding: unused996*/997int keyint_min;998999/**1000* the number of pictures in a group of pictures, or 0 for intra_only1001* - encoding: Set by user.1002* - decoding: unused1003*/1004int gop_size;10051006/**1007* Note: Value depends upon the compare function used for fullpel ME.1008* - encoding: Set by user.1009* - decoding: unused1010*/1011int mv0_threshold;10121013/**1014* Number of slices.1015* Indicates number of picture subdivisions. Used for parallelized1016* decoding.1017* - encoding: Set by user1018* - decoding: unused1019*/1020int slices;10211022/* audio only */1023int sample_rate; ///< samples per second10241025/**1026* audio sample format1027* - encoding: Set by user.1028* - decoding: Set by libavcodec.1029*/1030enum AVSampleFormat sample_fmt; ///< sample format10311032/**1033* Audio channel layout.1034* - encoding: must be set by the caller, to one of AVCodec.ch_layouts.1035* - decoding: may be set by the caller if known e.g. from the container.1036* The decoder can then override during decoding as needed.1037*/1038AVChannelLayout ch_layout;10391040/* The following data should not be initialized. */1041/**1042* Number of samples per channel in an audio frame.1043*1044* - encoding: set by libavcodec in avcodec_open2(). Each submitted frame1045* except the last must contain exactly frame_size samples per channel.1046* May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the1047* frame size is not restricted.1048* - decoding: may be set by some decoders to indicate constant frame size1049*/1050int frame_size;10511052/**1053* number of bytes per packet if constant and known or 01054* Used by some WAV based audio codecs.1055*/1056int block_align;10571058/**1059* Audio cutoff bandwidth (0 means "automatic")1060* - encoding: Set by user.1061* - decoding: unused1062*/1063int cutoff;10641065/**1066* Type of service that the audio stream conveys.1067* - encoding: Set by user.1068* - decoding: Set by libavcodec.1069*/1070enum AVAudioServiceType audio_service_type;10711072/**1073* desired sample format1074* - encoding: Not used.1075* - decoding: Set by user.1076* Decoder will decode to this format if it can.1077*/1078enum AVSampleFormat request_sample_fmt;10791080/**1081* Audio only. The number of "priming" samples (padding) inserted by the1082* encoder at the beginning of the audio. I.e. this number of leading1083* decoded samples must be discarded by the caller to get the original audio1084* without leading padding.1085*1086* - decoding: unused1087* - encoding: Set by libavcodec. The timestamps on the output packets are1088* adjusted by the encoder so that they always refer to the1089* first sample of the data actually contained in the packet,1090* including any added padding. E.g. if the timebase is1091* 1/samplerate and the timestamp of the first input sample is1092* 0, the timestamp of the first output packet will be1093* -initial_padding.1094*/1095int initial_padding;10961097/**1098* Audio only. The amount of padding (in samples) appended by the encoder to1099* the end of the audio. I.e. this number of decoded samples must be1100* discarded by the caller from the end of the stream to get the original1101* audio without any trailing padding.1102*1103* - decoding: unused1104* - encoding: unused1105*/1106int trailing_padding;11071108/**1109* Number of samples to skip after a discontinuity1110* - decoding: unused1111* - encoding: set by libavcodec1112*/1113int seek_preroll;11141115/**1116* This callback is called at the beginning of each frame to get data1117* buffer(s) for it. There may be one contiguous buffer for all the data or1118* there may be a buffer per each data plane or anything in between. What1119* this means is, you may set however many entries in buf[] you feel necessary.1120* Each buffer must be reference-counted using the AVBuffer API (see description1121* of buf[] below).1122*1123* The following fields will be set in the frame before this callback is1124* called:1125* - format1126* - width, height (video only)1127* - sample_rate, channel_layout, nb_samples (audio only)1128* Their values may differ from the corresponding values in1129* AVCodecContext. This callback must use the frame values, not the codec1130* context values, to calculate the required buffer size.1131*1132* This callback must fill the following fields in the frame:1133* - data[]1134* - linesize[]1135* - extended_data:1136* * if the data is planar audio with more than 8 channels, then this1137* callback must allocate and fill extended_data to contain all pointers1138* to all data planes. data[] must hold as many pointers as it can.1139* extended_data must be allocated with av_malloc() and will be freed in1140* av_frame_unref().1141* * otherwise extended_data must point to data1142* - buf[] must contain one or more pointers to AVBufferRef structures. Each of1143* the frame's data and extended_data pointers must be contained in these. That1144* is, one AVBufferRef for each allocated chunk of memory, not necessarily one1145* AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),1146* and av_buffer_ref().1147* - extended_buf and nb_extended_buf must be allocated with av_malloc() by1148* this callback and filled with the extra buffers if there are more1149* buffers than buf[] can hold. extended_buf will be freed in1150* av_frame_unref().1151* Decoders will generally initialize the whole buffer before it is output1152* but it can in rare error conditions happen that uninitialized data is passed1153* through. \important The buffers returned by get_buffer* should thus not contain sensitive1154* data.1155*1156* If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call1157* avcodec_default_get_buffer2() instead of providing buffers allocated by1158* some other means.1159*1160* Each data plane must be aligned to the maximum required by the target1161* CPU.1162*1163* @see avcodec_default_get_buffer2()1164*1165* Video:1166*1167* If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused1168* (read and/or written to if it is writable) later by libavcodec.1169*1170* avcodec_align_dimensions2() should be used to find the required width and1171* height, as they normally need to be rounded up to the next multiple of 16.1172*1173* Some decoders do not support linesizes changing between frames.1174*1175* If frame multithreading is used, this callback may be called from a1176* different thread, but not from more than one at once. Does not need to be1177* reentrant.1178*1179* @see avcodec_align_dimensions2()1180*1181* Audio:1182*1183* Decoders request a buffer of a particular size by setting1184* AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,1185* however, utilize only part of the buffer by setting AVFrame.nb_samples1186* to a smaller value in the output frame.1187*1188* As a convenience, av_samples_get_buffer_size() and1189* av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()1190* functions to find the required data size and to fill data pointers and1191* linesize. In AVFrame.linesize, only linesize[0] may be set for audio1192* since all planes must be the same size.1193*1194* @see av_samples_get_buffer_size(), av_samples_fill_arrays()1195*1196* - encoding: unused1197* - decoding: Set by libavcodec, user can override.1198*/1199int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);12001201/* - encoding parameters */1202/**1203* number of bits the bitstream is allowed to diverge from the reference.1204* the reference can be CBR (for CBR pass1) or VBR (for pass2)1205* - encoding: Set by user; unused for constant quantizer encoding.1206* - decoding: unused1207*/1208int bit_rate_tolerance;12091210/**1211* Global quality for codecs which cannot change it per frame.1212* This should be proportional to MPEG-1/2/4 qscale.1213* - encoding: Set by user.1214* - decoding: unused1215*/1216int global_quality;12171218/**1219* - encoding: Set by user.1220* - decoding: unused1221*/1222int compression_level;1223#define FF_COMPRESSION_DEFAULT -112241225float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)1226float qblur; ///< amount of qscale smoothing over time (0.0-1.0)12271228/**1229* minimum quantizer1230* - encoding: Set by user.1231* - decoding: unused1232*/1233int qmin;12341235/**1236* maximum quantizer1237* - encoding: Set by user.1238* - decoding: unused1239*/1240int qmax;12411242/**1243* maximum quantizer difference between frames1244* - encoding: Set by user.1245* - decoding: unused1246*/1247int max_qdiff;12481249/**1250* decoder bitstream buffer size1251* - encoding: Set by user.1252* - decoding: May be set by libavcodec.1253*/1254int rc_buffer_size;12551256/**1257* ratecontrol override, see RcOverride1258* - encoding: Allocated/set/freed by user.1259* - decoding: unused1260*/1261int rc_override_count;1262RcOverride *rc_override;12631264/**1265* maximum bitrate1266* - encoding: Set by user.1267* - decoding: Set by user, may be overwritten by libavcodec.1268*/1269int64_t rc_max_rate;12701271/**1272* minimum bitrate1273* - encoding: Set by user.1274* - decoding: unused1275*/1276int64_t rc_min_rate;12771278/**1279* Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.1280* - encoding: Set by user.1281* - decoding: unused.1282*/1283float rc_max_available_vbv_use;12841285/**1286* Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.1287* - encoding: Set by user.1288* - decoding: unused.1289*/1290float rc_min_vbv_overflow_use;12911292/**1293* Number of bits which should be loaded into the rc buffer before decoding starts.1294* - encoding: Set by user.1295* - decoding: unused1296*/1297int rc_initial_buffer_occupancy;12981299/**1300* trellis RD quantization1301* - encoding: Set by user.1302* - decoding: unused1303*/1304int trellis;13051306/**1307* pass1 encoding statistics output buffer1308* - encoding: Set by libavcodec.1309* - decoding: unused1310*/1311char *stats_out;13121313/**1314* pass2 encoding statistics input buffer1315* Concatenated stuff from stats_out of pass1 should be placed here.1316* - encoding: Allocated/set/freed by user.1317* - decoding: unused1318*/1319char *stats_in;13201321/**1322* Work around bugs in encoders which sometimes cannot be detected automatically.1323* - encoding: Set by user1324* - decoding: Set by user1325*/1326int workaround_bugs;1327#define FF_BUG_AUTODETECT 1 ///< autodetection1328#define FF_BUG_XVID_ILACE 41329#define FF_BUG_UMP4 81330#define FF_BUG_NO_PADDING 161331#define FF_BUG_AMV 321332#define FF_BUG_QPEL_CHROMA 641333#define FF_BUG_STD_QPEL 1281334#define FF_BUG_QPEL_CHROMA2 2561335#define FF_BUG_DIRECT_BLOCKSIZE 5121336#define FF_BUG_EDGE 10241337#define FF_BUG_HPEL_CHROMA 20481338#define FF_BUG_DC_CLIP 40961339#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.1340#define FF_BUG_TRUNCATED 163841341#define FF_BUG_IEDGE 3276813421343/**1344* strictly follow the standard (MPEG-4, ...).1345* - encoding: Set by user.1346* - decoding: Set by user.1347* Setting this to STRICT or higher means the encoder and decoder will1348* generally do stupid things, whereas setting it to unofficial or lower1349* will mean the encoder might produce output that is not supported by all1350* spec-compliant decoders. Decoders don't differentiate between normal,1351* unofficial and experimental (that is, they always try to decode things1352* when they can) unless they are explicitly asked to behave stupidly1353* (=strictly conform to the specs)1354* This may only be set to one of the FF_COMPLIANCE_* values in defs.h.1355*/1356int strict_std_compliance;13571358/**1359* error concealment flags1360* - encoding: unused1361* - decoding: Set by user.1362*/1363int error_concealment;1364#define FF_EC_GUESS_MVS 11365#define FF_EC_DEBLOCK 21366#define FF_EC_FAVOR_INTER 25613671368/**1369* debug1370* - encoding: Set by user.1371* - decoding: Set by user.1372*/1373int debug;1374#define FF_DEBUG_PICT_INFO 11375#define FF_DEBUG_RC 21376#define FF_DEBUG_BITSTREAM 41377#define FF_DEBUG_MB_TYPE 81378#define FF_DEBUG_QP 161379#define FF_DEBUG_DCT_COEFF 0x000000401380#define FF_DEBUG_SKIP 0x000000801381#define FF_DEBUG_STARTCODE 0x000001001382#define FF_DEBUG_ER 0x000004001383#define FF_DEBUG_MMCO 0x000008001384#define FF_DEBUG_BUGS 0x000010001385#define FF_DEBUG_BUFFERS 0x000080001386#define FF_DEBUG_THREADS 0x000100001387#define FF_DEBUG_GREEN_MD 0x008000001388#define FF_DEBUG_NOMC 0x0100000013891390/**1391* Error recognition; may misdetect some more or less valid parts as errors.1392* This is a bitfield of the AV_EF_* values defined in defs.h.1393*1394* - encoding: Set by user.1395* - decoding: Set by user.1396*/1397int err_recognition;13981399/**1400* Hardware accelerator in use1401* - encoding: unused.1402* - decoding: Set by libavcodec1403*/1404const struct AVHWAccel *hwaccel;14051406/**1407* Legacy hardware accelerator context.1408*1409* For some hardware acceleration methods, the caller may use this field to1410* signal hwaccel-specific data to the codec. The struct pointed to by this1411* pointer is hwaccel-dependent and defined in the respective header. Please1412* refer to the FFmpeg HW accelerator documentation to know how to fill1413* this.1414*1415* In most cases this field is optional - the necessary information may also1416* be provided to libavcodec through @ref hw_frames_ctx or @ref1417* hw_device_ctx (see avcodec_get_hw_config()). However, in some cases it1418* may be the only method of signalling some (optional) information.1419*1420* The struct and its contents are owned by the caller.1421*1422* - encoding: May be set by the caller before avcodec_open2(). Must remain1423* valid until avcodec_free_context().1424* - decoding: May be set by the caller in the get_format() callback.1425* Must remain valid until the next get_format() call,1426* or avcodec_free_context() (whichever comes first).1427*/1428void *hwaccel_context;14291430/**1431* A reference to the AVHWFramesContext describing the input (for encoding)1432* or output (decoding) frames. The reference is set by the caller and1433* afterwards owned (and freed) by libavcodec - it should never be read by1434* the caller after being set.1435*1436* - decoding: This field should be set by the caller from the get_format()1437* callback. The previous reference (if any) will always be1438* unreffed by libavcodec before the get_format() call.1439*1440* If the default get_buffer2() is used with a hwaccel pixel1441* format, then this AVHWFramesContext will be used for1442* allocating the frame buffers.1443*1444* - encoding: For hardware encoders configured to use a hwaccel pixel1445* format, this field should be set by the caller to a reference1446* to the AVHWFramesContext describing input frames.1447* AVHWFramesContext.format must be equal to1448* AVCodecContext.pix_fmt.1449*1450* This field should be set before avcodec_open2() is called.1451*/1452AVBufferRef *hw_frames_ctx;14531454/**1455* A reference to the AVHWDeviceContext describing the device which will1456* be used by a hardware encoder/decoder. The reference is set by the1457* caller and afterwards owned (and freed) by libavcodec.1458*1459* This should be used if either the codec device does not require1460* hardware frames or any that are used are to be allocated internally by1461* libavcodec. If the user wishes to supply any of the frames used as1462* encoder input or decoder output then hw_frames_ctx should be used1463* instead. When hw_frames_ctx is set in get_format() for a decoder, this1464* field will be ignored while decoding the associated stream segment, but1465* may again be used on a following one after another get_format() call.1466*1467* For both encoders and decoders this field should be set before1468* avcodec_open2() is called and must not be written to thereafter.1469*1470* Note that some decoders may require this field to be set initially in1471* order to support hw_frames_ctx at all - in that case, all frames1472* contexts used must be created on the same device.1473*/1474AVBufferRef *hw_device_ctx;14751476/**1477* Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated1478* decoding (if active).1479* - encoding: unused1480* - decoding: Set by user (either before avcodec_open2(), or in the1481* AVCodecContext.get_format callback)1482*/1483int hwaccel_flags;14841485/**1486* Video decoding only. Sets the number of extra hardware frames which1487* the decoder will allocate for use by the caller. This must be set1488* before avcodec_open2() is called.1489*1490* Some hardware decoders require all frames that they will use for1491* output to be defined in advance before decoding starts. For such1492* decoders, the hardware frame pool must therefore be of a fixed size.1493* The extra frames set here are on top of any number that the decoder1494* needs internally in order to operate normally (for example, frames1495* used as reference pictures).1496*/1497int extra_hw_frames;14981499/**1500* error1501* - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.1502* - decoding: unused1503*/1504uint64_t error[AV_NUM_DATA_POINTERS];15051506/**1507* DCT algorithm, see FF_DCT_* below1508* - encoding: Set by user.1509* - decoding: unused1510*/1511int dct_algo;1512#define FF_DCT_AUTO 01513#define FF_DCT_FASTINT 11514#define FF_DCT_INT 21515#define FF_DCT_MMX 31516#define FF_DCT_ALTIVEC 51517#define FF_DCT_FAAN 61518#define FF_DCT_NEON 715191520/**1521* IDCT algorithm, see FF_IDCT_* below.1522* - encoding: Set by user.1523* - decoding: Set by user.1524*/1525int idct_algo;1526#define FF_IDCT_AUTO 01527#define FF_IDCT_INT 11528#define FF_IDCT_SIMPLE 21529#define FF_IDCT_SIMPLEMMX 31530#define FF_IDCT_ARM 71531#define FF_IDCT_ALTIVEC 81532#define FF_IDCT_SIMPLEARM 101533#define FF_IDCT_XVID 141534#define FF_IDCT_SIMPLEARMV5TE 161535#define FF_IDCT_SIMPLEARMV6 171536#define FF_IDCT_FAAN 201537#define FF_IDCT_SIMPLENEON 221538#define FF_IDCT_SIMPLEAUTO 12815391540/**1541* bits per sample/pixel from the demuxer (needed for huffyuv).1542* - encoding: Set by libavcodec.1543* - decoding: Set by user.1544*/1545int bits_per_coded_sample;15461547/**1548* Bits per sample/pixel of internal libavcodec pixel/sample format.1549* - encoding: set by user.1550* - decoding: set by libavcodec.1551*/1552int bits_per_raw_sample;15531554/**1555* thread count1556* is used to decide how many independent tasks should be passed to execute()1557* - encoding: Set by user.1558* - decoding: Set by user.1559*/1560int thread_count;15611562/**1563* Which multithreading methods to use.1564* Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,1565* so clients which cannot provide future frames should not use it.1566*1567* - encoding: Set by user, otherwise the default is used.1568* - decoding: Set by user, otherwise the default is used.1569*/1570int thread_type;1571#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once1572#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once15731574/**1575* Which multithreading methods are in use by the codec.1576* - encoding: Set by libavcodec.1577* - decoding: Set by libavcodec.1578*/1579int active_thread_type;15801581/**1582* The codec may call this to execute several independent things.1583* It will return only after finishing all tasks.1584* The user may replace this with some multithreaded implementation,1585* the default implementation will execute the parts serially.1586* @param count the number of things to execute1587* - encoding: Set by libavcodec, user can override.1588* - decoding: Set by libavcodec, user can override.1589*/1590int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);15911592/**1593* The codec may call this to execute several independent things.1594* It will return only after finishing all tasks.1595* The user may replace this with some multithreaded implementation,1596* the default implementation will execute the parts serially.1597* @param c context passed also to func1598* @param count the number of things to execute1599* @param arg2 argument passed unchanged to func1600* @param ret return values of executed functions, must have space for "count" values. May be NULL.1601* @param func function that will be called count times, with jobnr from 0 to count-1.1602* threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no1603* two instances of func executing at the same time will have the same threadnr.1604* @return always 0 currently, but code should handle a future improvement where when any call to func1605* returns < 0 no further calls to func may be done and < 0 is returned.1606* - encoding: Set by libavcodec, user can override.1607* - decoding: Set by libavcodec, user can override.1608*/1609int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);16101611/**1612* profile1613* - encoding: Set by user.1614* - decoding: Set by libavcodec.1615* See the AV_PROFILE_* defines in defs.h.1616*/1617int profile;16181619/**1620* Encoding level descriptor.1621* - encoding: Set by user, corresponds to a specific level defined by the1622* codec, usually corresponding to the profile level, if not specified it1623* is set to AV_LEVEL_UNKNOWN.1624* - decoding: Set by libavcodec.1625* See AV_LEVEL_* in defs.h.1626*/1627int level;16281629#if FF_API_CODEC_PROPS1630/**1631* Properties of the stream that gets decoded1632* - encoding: unused1633* - decoding: set by libavcodec1634*/1635attribute_deprecated1636unsigned properties;1637#define FF_CODEC_PROPERTY_LOSSLESS 0x000000011638#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x000000021639#define FF_CODEC_PROPERTY_FILM_GRAIN 0x000000041640#endif16411642/**1643* Skip loop filtering for selected frames.1644* - encoding: unused1645* - decoding: Set by user.1646*/1647enum AVDiscard skip_loop_filter;16481649/**1650* Skip IDCT/dequantization for selected frames.1651* - encoding: unused1652* - decoding: Set by user.1653*/1654enum AVDiscard skip_idct;16551656/**1657* Skip decoding for selected frames.1658* - encoding: unused1659* - decoding: Set by user.1660*/1661enum AVDiscard skip_frame;16621663/**1664* Skip processing alpha if supported by codec.1665* Note that if the format uses pre-multiplied alpha (common with VP6,1666* and recommended due to better video quality/compression)1667* the image will look as if alpha-blended onto a black background.1668* However for formats that do not use pre-multiplied alpha1669* there might be serious artefacts (though e.g. libswscale currently1670* assumes pre-multiplied alpha anyway).1671*1672* - decoding: set by user1673* - encoding: unused1674*/1675int skip_alpha;16761677/**1678* Number of macroblock rows at the top which are skipped.1679* - encoding: unused1680* - decoding: Set by user.1681*/1682int skip_top;16831684/**1685* Number of macroblock rows at the bottom which are skipped.1686* - encoding: unused1687* - decoding: Set by user.1688*/1689int skip_bottom;16901691/**1692* low resolution decoding, 1-> 1/2 size, 2->1/4 size1693* - encoding: unused1694* - decoding: Set by user.1695*/1696int lowres;16971698/**1699* AVCodecDescriptor1700* - encoding: unused.1701* - decoding: set by libavcodec.1702*/1703const struct AVCodecDescriptor *codec_descriptor;17041705/**1706* Character encoding of the input subtitles file.1707* - decoding: set by user1708* - encoding: unused1709*/1710char *sub_charenc;17111712/**1713* Subtitles character encoding mode. Formats or codecs might be adjusting1714* this setting (if they are doing the conversion themselves for instance).1715* - decoding: set by libavcodec1716* - encoding: unused1717*/1718int sub_charenc_mode;1719#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)1720#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself1721#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv1722#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-817231724/**1725* Header containing style information for text subtitles.1726* For SUBTITLE_ASS subtitle type, it should contain the whole ASS1727* [Script Info] and [V4+ Styles] section, plus the [Events] line and1728* the Format line following. It shouldn't include any Dialogue line.1729*1730* - encoding: May be set by the caller before avcodec_open2() to an array1731* allocated with the av_malloc() family of functions.1732* - decoding: May be set by libavcodec in avcodec_open2().1733*1734* After being set, the array is owned by the codec and freed in1735* avcodec_free_context().1736*/1737int subtitle_header_size;1738uint8_t *subtitle_header;17391740/**1741* dump format separator.1742* can be ", " or "\n " or anything else1743* - encoding: Set by user.1744* - decoding: Set by user.1745*/1746uint8_t *dump_separator;17471748/**1749* ',' separated list of allowed decoders.1750* If NULL then all are allowed1751* - encoding: unused1752* - decoding: set by user1753*/1754char *codec_whitelist;17551756/**1757* Additional data associated with the entire coded stream.1758*1759* - decoding: may be set by user before calling avcodec_open2().1760* - encoding: may be set by libavcodec after avcodec_open2().1761*/1762AVPacketSideData *coded_side_data;1763int nb_coded_side_data;17641765/**1766* Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of1767* metadata exported in frame, packet, or coded stream side data by1768* decoders and encoders.1769*1770* - decoding: set by user1771* - encoding: set by user1772*/1773int export_side_data;17741775/**1776* The number of pixels per image to maximally accept.1777*1778* - decoding: set by user1779* - encoding: set by user1780*/1781int64_t max_pixels;17821783/**1784* Video decoding only. Certain video codecs support cropping, meaning that1785* only a sub-rectangle of the decoded frame is intended for display. This1786* option controls how cropping is handled by libavcodec.1787*1788* When set to 1 (the default), libavcodec will apply cropping internally.1789* I.e. it will modify the output frame width/height fields and offset the1790* data pointers (only by as much as possible while preserving alignment, or1791* by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that1792* the frames output by the decoder refer only to the cropped area. The1793* crop_* fields of the output frames will be zero.1794*1795* When set to 0, the width/height fields of the output frames will be set1796* to the coded dimensions and the crop_* fields will describe the cropping1797* rectangle. Applying the cropping is left to the caller.1798*1799* @warning When hardware acceleration with opaque output frames is used,1800* libavcodec is unable to apply cropping from the top/left border.1801*1802* @note when this option is set to zero, the width/height fields of the1803* AVCodecContext and output AVFrames have different meanings. The codec1804* context fields store display dimensions (with the coded dimensions in1805* coded_width/height), while the frame fields store the coded dimensions1806* (with the display dimensions being determined by the crop_* fields).1807*/1808int apply_cropping;18091810/**1811* The percentage of damaged samples to discard a frame.1812*1813* - decoding: set by user1814* - encoding: unused1815*/1816int discard_damaged_percentage;18171818/**1819* The number of samples per frame to maximally accept.1820*1821* - decoding: set by user1822* - encoding: set by user1823*/1824int64_t max_samples;18251826/**1827* This callback is called at the beginning of each packet to get a data1828* buffer for it.1829*1830* The following field will be set in the packet before this callback is1831* called:1832* - size1833* This callback must use the above value to calculate the required buffer size,1834* which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes.1835*1836* In some specific cases, the encoder may not use the entire buffer allocated by this1837* callback. This will be reflected in the size value in the packet once returned by1838* avcodec_receive_packet().1839*1840* This callback must fill the following fields in the packet:1841* - data: alignment requirements for AVPacket apply, if any. Some architectures and1842* encoders may benefit from having aligned data.1843* - buf: must contain a pointer to an AVBufferRef structure. The packet's1844* data pointer must be contained in it. See: av_buffer_create(), av_buffer_alloc(),1845* and av_buffer_ref().1846*1847* If AV_CODEC_CAP_DR1 is not set then get_encode_buffer() must call1848* avcodec_default_get_encode_buffer() instead of providing a buffer allocated by1849* some other means.1850*1851* The flags field may contain a combination of AV_GET_ENCODE_BUFFER_FLAG_ flags.1852* They may be used for example to hint what use the buffer may get after being1853* created.1854* Implementations of this callback may ignore flags they don't understand.1855* If AV_GET_ENCODE_BUFFER_FLAG_REF is set in flags then the packet may be reused1856* (read and/or written to if it is writable) later by libavcodec.1857*1858* This callback must be thread-safe, as when frame threading is used, it may1859* be called from multiple threads simultaneously.1860*1861* @see avcodec_default_get_encode_buffer()1862*1863* - encoding: Set by libavcodec, user can override.1864* - decoding: unused1865*/1866int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags);18671868/**1869* Frame counter, set by libavcodec.1870*1871* - decoding: total number of frames returned from the decoder so far.1872* - encoding: total number of frames passed to the encoder so far.1873*1874* @note the counter is not incremented if encoding/decoding resulted in1875* an error.1876*/1877int64_t frame_num;18781879/**1880* Decoding only. May be set by the caller before avcodec_open2() to an1881* av_malloc()'ed array (or via AVOptions). Owned and freed by the decoder1882* afterwards.1883*1884* Side data attached to decoded frames may come from several sources:1885* 1. coded_side_data, which the decoder will for certain types translate1886* from packet-type to frame-type and attach to frames;1887* 2. side data attached to an AVPacket sent for decoding (same1888* considerations as above);1889* 3. extracted from the coded bytestream.1890* The first two cases are supplied by the caller and typically come from a1891* container.1892*1893* This array configures decoder behaviour in cases when side data of the1894* same type is present both in the coded bytestream and in the1895* user-supplied side data (items 1. and 2. above). In all cases, at most1896* one instance of each side data type will be attached to output frames. By1897* default it will be the bytestream side data. Adding an1898* AVPacketSideDataType value to this array will flip the preference for1899* this type, thus making the decoder prefer user-supplied side data over1900* bytestream. In case side data of the same type is present both in1901* coded_data and attacked to a packet, the packet instance always has1902* priority.1903*1904* The array may also contain a single -1, in which case the preference is1905* switched for all side data types.1906*/1907int *side_data_prefer_packet;1908/**1909* Number of entries in side_data_prefer_packet.1910*/1911unsigned nb_side_data_prefer_packet;19121913/**1914* Array containing static side data, such as HDR10 CLL / MDCV structures.1915* Side data entries should be allocated by usage of helpers defined in1916* libavutil/frame.h.1917*1918* - encoding: may be set by user before calling avcodec_open2() for1919* encoder configuration. Afterwards owned and freed by the1920* encoder.1921* - decoding: may be set by libavcodec in avcodec_open2().1922*/1923AVFrameSideData **decoded_side_data;1924int nb_decoded_side_data;1925} AVCodecContext;19261927/**1928* @defgroup lavc_hwaccel AVHWAccel1929*1930* @note Nothing in this structure should be accessed by the user. At some1931* point in future it will not be externally visible at all.1932*1933* @{1934*/1935typedef struct AVHWAccel {1936/**1937* Name of the hardware accelerated codec.1938* The name is globally unique among encoders and among decoders (but an1939* encoder and a decoder can share the same name).1940*/1941const char *name;19421943/**1944* Type of codec implemented by the hardware accelerator.1945*1946* See AVMEDIA_TYPE_xxx1947*/1948enum AVMediaType type;19491950/**1951* Codec implemented by the hardware accelerator.1952*1953* See AV_CODEC_ID_xxx1954*/1955enum AVCodecID id;19561957/**1958* Supported pixel format.1959*1960* Only hardware accelerated formats are supported here.1961*/1962enum AVPixelFormat pix_fmt;19631964/**1965* Hardware accelerated codec capabilities.1966* see AV_HWACCEL_CODEC_CAP_*1967*/1968int capabilities;1969} AVHWAccel;19701971/**1972* HWAccel is experimental and is thus avoided in favor of non experimental1973* codecs1974*/1975#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x020019761977/**1978* Hardware acceleration should be used for decoding even if the codec level1979* used is unknown or higher than the maximum supported level reported by the1980* hardware driver.1981*1982* It's generally a good idea to pass this flag unless you have a specific1983* reason not to, as hardware tends to under-report supported levels.1984*/1985#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)19861987/**1988* Hardware acceleration can output YUV pixel formats with a different chroma1989* sampling than 4:2:0 and/or other than 8 bits per component.1990*/1991#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)19921993/**1994* Hardware acceleration should still be attempted for decoding when the1995* codec profile does not match the reported capabilities of the hardware.1996*1997* For example, this can be used to try to decode baseline profile H.2641998* streams in hardware - it will often succeed, because many streams marked1999* as baseline profile actually conform to constrained baseline profile.2000*2001* @warning If the stream is actually not supported then the behaviour is2002* undefined, and may include returning entirely incorrect output2003* while indicating success.2004*/2005#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)20062007/**2008* Some hardware decoders (namely nvdec) can either output direct decoder2009* surfaces, or make an on-device copy and return said copy.2010* There is a hard limit on how many decoder surfaces there can be, and it2011* cannot be accurately guessed ahead of time.2012* For some processing chains, this can be okay, but others will run into the2013* limit and in turn produce very confusing errors that require fine tuning of2014* more or less obscure options by the user, or in extreme cases cannot be2015* resolved at all without inserting an avfilter that forces a copy.2016*2017* Thus, the hwaccel will by default make a copy for safety and resilience.2018* If a users really wants to minimize the amount of copies, they can set this2019* flag and ensure their processing chain does not exhaust the surface pool.2020*/2021#define AV_HWACCEL_FLAG_UNSAFE_OUTPUT (1 << 3)20222023/**2024* @}2025*/20262027enum AVSubtitleType {2028SUBTITLE_NONE,20292030SUBTITLE_BITMAP, ///< A bitmap, pict will be set20312032/**2033* Plain text, the text field must be set by the decoder and is2034* authoritative. ass and pict fields may contain approximations.2035*/2036SUBTITLE_TEXT,20372038/**2039* Formatted text, the ass field must be set by the decoder and is2040* authoritative. pict and text fields may contain approximations.2041*/2042SUBTITLE_ASS,2043};20442045#define AV_SUBTITLE_FLAG_FORCED 0x0000000120462047typedef struct AVSubtitleRect {2048int x; ///< top left corner of pict, undefined when pict is not set2049int y; ///< top left corner of pict, undefined when pict is not set2050int w; ///< width of pict, undefined when pict is not set2051int h; ///< height of pict, undefined when pict is not set2052int nb_colors; ///< number of colors in pict, undefined when pict is not set20532054/**2055* data+linesize for the bitmap of this subtitle.2056* Can be set for text/ass as well once they are rendered.2057*/2058uint8_t *data[4];2059int linesize[4];20602061int flags;2062enum AVSubtitleType type;20632064char *text; ///< 0 terminated plain UTF-8 text20652066/**2067* 0 terminated ASS/SSA compatible event line.2068* The presentation of this is unaffected by the other values in this2069* struct.2070*/2071char *ass;2072} AVSubtitleRect;20732074typedef struct AVSubtitle {2075uint16_t format; /* 0 = graphics */2076uint32_t start_display_time; /* relative to packet pts, in ms */2077uint32_t end_display_time; /* relative to packet pts, in ms */2078unsigned num_rects;2079AVSubtitleRect **rects;2080int64_t pts; ///< Same as packet pts, in AV_TIME_BASE2081} AVSubtitle;20822083/**2084* Return the LIBAVCODEC_VERSION_INT constant.2085*/2086unsigned avcodec_version(void);20872088/**2089* Return the libavcodec build-time configuration.2090*/2091const char *avcodec_configuration(void);20922093/**2094* Return the libavcodec license.2095*/2096const char *avcodec_license(void);20972098/**2099* Allocate an AVCodecContext and set its fields to default values. The2100* resulting struct should be freed with avcodec_free_context().2101*2102* @param codec if non-NULL, allocate private data and initialize defaults2103* for the given codec. It is illegal to then call avcodec_open2()2104* with a different codec.2105* If NULL, then the codec-specific defaults won't be initialized,2106* which may result in suboptimal default settings (this is2107* important mainly for encoders, e.g. libx264).2108*2109* @return An AVCodecContext filled with default values or NULL on failure.2110*/2111AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);21122113/**2114* Free the codec context and everything associated with it and write NULL to2115* the provided pointer.2116*/2117void avcodec_free_context(AVCodecContext **avctx);21182119/**2120* Get the AVClass for AVCodecContext. It can be used in combination with2121* AV_OPT_SEARCH_FAKE_OBJ for examining options.2122*2123* @see av_opt_find().2124*/2125const AVClass *avcodec_get_class(void);21262127/**2128* Get the AVClass for AVSubtitleRect. It can be used in combination with2129* AV_OPT_SEARCH_FAKE_OBJ for examining options.2130*2131* @see av_opt_find().2132*/2133const AVClass *avcodec_get_subtitle_rect_class(void);21342135/**2136* Fill the parameters struct based on the values from the supplied codec2137* context. Any allocated fields in par are freed and replaced with duplicates2138* of the corresponding fields in codec.2139*2140* @return >= 0 on success, a negative AVERROR code on failure2141*/2142int avcodec_parameters_from_context(struct AVCodecParameters *par,2143const AVCodecContext *codec);21442145/**2146* Fill the codec context based on the values from the supplied codec2147* parameters. Any allocated fields in codec that have a corresponding field in2148* par are freed and replaced with duplicates of the corresponding field in par.2149* Fields in codec that do not have a counterpart in par are not touched.2150*2151* @return >= 0 on success, a negative AVERROR code on failure.2152*/2153int avcodec_parameters_to_context(AVCodecContext *codec,2154const struct AVCodecParameters *par);21552156/**2157* Initialize the AVCodecContext to use the given AVCodec. Prior to using this2158* function the context has to be allocated with avcodec_alloc_context3().2159*2160* The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),2161* avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for2162* retrieving a codec.2163*2164* Depending on the codec, you might need to set options in the codec context2165* also for decoding (e.g. width, height, or the pixel or audio sample format in2166* the case the information is not available in the bitstream, as when decoding2167* raw audio or video).2168*2169* Options in the codec context can be set either by setting them in the options2170* AVDictionary, or by setting the values in the context itself, directly or by2171* using the av_opt_set() API before calling this function.2172*2173* Example:2174* @code2175* av_dict_set(&opts, "b", "2.5M", 0);2176* codec = avcodec_find_decoder(AV_CODEC_ID_H264);2177* if (!codec)2178* exit(1);2179*2180* context = avcodec_alloc_context3(codec);2181*2182* if (avcodec_open2(context, codec, opts) < 0)2183* exit(1);2184* @endcode2185*2186* In the case AVCodecParameters are available (e.g. when demuxing a stream2187* using libavformat, and accessing the AVStream contained in the demuxer), the2188* codec parameters can be copied to the codec context using2189* avcodec_parameters_to_context(), as in the following example:2190*2191* @code2192* AVStream *stream = ...;2193* context = avcodec_alloc_context3(codec);2194* if (avcodec_parameters_to_context(context, stream->codecpar) < 0)2195* exit(1);2196* if (avcodec_open2(context, codec, NULL) < 0)2197* exit(1);2198* @endcode2199*2200* @note Always call this function before using decoding routines (such as2201* @ref avcodec_receive_frame()).2202*2203* @param avctx The context to initialize.2204* @param codec The codec to open this context for. If a non-NULL codec has been2205* previously passed to avcodec_alloc_context3() or2206* for this context, then this parameter MUST be either NULL or2207* equal to the previously passed codec.2208* @param options A dictionary filled with AVCodecContext and codec-private2209* options, which are set on top of the options already set in2210* avctx, can be NULL. On return this object will be filled with2211* options that were not found in the avctx codec context.2212*2213* @return zero on success, a negative value on error2214* @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),2215* av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()2216*/2217int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);22182219/**2220* Free all allocated data in the given subtitle struct.2221*2222* @param sub AVSubtitle to free.2223*/2224void avsubtitle_free(AVSubtitle *sub);22252226/**2227* @}2228*/22292230/**2231* @addtogroup lavc_decoding2232* @{2233*/22342235/**2236* The default callback for AVCodecContext.get_buffer2(). It is made public so2237* it can be called by custom get_buffer2() implementations for decoders without2238* AV_CODEC_CAP_DR1 set.2239*/2240int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);22412242/**2243* The default callback for AVCodecContext.get_encode_buffer(). It is made public so2244* it can be called by custom get_encode_buffer() implementations for encoders without2245* AV_CODEC_CAP_DR1 set.2246*/2247int avcodec_default_get_encode_buffer(AVCodecContext *s, AVPacket *pkt, int flags);22482249/**2250* Modify width and height values so that they will result in a memory2251* buffer that is acceptable for the codec if you do not use any horizontal2252* padding.2253*2254* May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.2255*/2256void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);22572258/**2259* Modify width and height values so that they will result in a memory2260* buffer that is acceptable for the codec if you also ensure that all2261* line sizes are a multiple of the respective linesize_align[i].2262*2263* May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.2264*/2265void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,2266int linesize_align[AV_NUM_DATA_POINTERS]);22672268/**2269* Decode a subtitle message.2270* Return a negative value on error, otherwise return the number of bytes used.2271* If no subtitle could be decompressed, got_sub_ptr is zero.2272* Otherwise, the subtitle is stored in *sub.2273* Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for2274* simplicity, because the performance difference is expected to be negligible2275* and reusing a get_buffer written for video codecs would probably perform badly2276* due to a potentially very different allocation pattern.2277*2278* Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input2279* and output. This means that for some packets they will not immediately2280* produce decoded output and need to be flushed at the end of decoding to get2281* all the decoded data. Flushing is done by calling this function with packets2282* with avpkt->data set to NULL and avpkt->size set to 0 until it stops2283* returning subtitles. It is safe to flush even those decoders that are not2284* marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.2285*2286* @note The AVCodecContext MUST have been opened with @ref avcodec_open2()2287* before packets may be fed to the decoder.2288*2289* @param avctx the codec context2290* @param[out] sub The preallocated AVSubtitle in which the decoded subtitle will be stored,2291* must be freed with avsubtitle_free if *got_sub_ptr is set.2292* @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.2293* @param[in] avpkt The input AVPacket containing the input buffer.2294*/2295int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,2296int *got_sub_ptr, const AVPacket *avpkt);22972298/**2299* Supply raw packet data as input to a decoder.2300*2301* Internally, this call will copy relevant AVCodecContext fields, which can2302* influence decoding per-packet, and apply them when the packet is actually2303* decoded. (For example AVCodecContext.skip_frame, which might direct the2304* decoder to drop the frame contained by the packet sent with this function.)2305*2306* @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE2307* larger than the actual read bytes because some optimized bitstream2308* readers read 32 or 64 bits at once and could read over the end.2309*2310* @note The AVCodecContext MUST have been opened with @ref avcodec_open2()2311* before packets may be fed to the decoder.2312*2313* @param avctx codec context2314* @param[in] avpkt The input AVPacket. Usually, this will be a single video2315* frame, or several complete audio frames.2316* Ownership of the packet remains with the caller, and the2317* decoder will not write to the packet. The decoder may create2318* a reference to the packet data (or copy it if the packet is2319* not reference-counted).2320* Unlike with older APIs, the packet is always fully consumed,2321* and if it contains multiple frames (e.g. some audio codecs),2322* will require you to call avcodec_receive_frame() multiple2323* times afterwards before you can send a new packet.2324* It can be NULL (or an AVPacket with data set to NULL and2325* size set to 0); in this case, it is considered a flush2326* packet, which signals the end of the stream. Sending the2327* first flush packet will return success. Subsequent ones are2328* unnecessary and will return AVERROR_EOF. If the decoder2329* still has frames buffered, it will return them after sending2330* a flush packet.2331*2332* @retval 0 success2333* @retval AVERROR(EAGAIN) input is not accepted in the current state - user2334* must read output with avcodec_receive_frame() (once2335* all output is read, the packet should be resent,2336* and the call will not fail with EAGAIN).2337* @retval AVERROR_EOF the decoder has been flushed, and no new packets can be2338* sent to it (also returned if more than 1 flush2339* packet is sent)2340* @retval AVERROR(EINVAL) codec not opened, it is an encoder, or requires flush2341* @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar2342* @retval "another negative error code" legitimate decoding errors2343*/2344int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);23452346/**2347* Return decoded output data from a decoder or encoder (when the2348* @ref AV_CODEC_FLAG_RECON_FRAME flag is used).2349*2350* @param avctx codec context2351* @param frame This will be set to a reference-counted video or audio2352* frame (depending on the decoder type) allocated by the2353* codec. Note that the function will always call2354* av_frame_unref(frame) before doing anything else.2355*2356* @retval 0 success, a frame was returned2357* @retval AVERROR(EAGAIN) output is not available in this state - user must2358* try to send new input2359* @retval AVERROR_EOF the codec has been fully flushed, and there will be2360* no more output frames2361* @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the2362* @ref AV_CODEC_FLAG_RECON_FRAME flag enabled2363* @retval "other negative error code" legitimate decoding errors2364*/2365int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);23662367/**2368* Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()2369* to retrieve buffered output packets.2370*2371* @param avctx codec context2372* @param[in] frame AVFrame containing the raw audio or video frame to be encoded.2373* Ownership of the frame remains with the caller, and the2374* encoder will not write to the frame. The encoder may create2375* a reference to the frame data (or copy it if the frame is2376* not reference-counted).2377* It can be NULL, in which case it is considered a flush2378* packet. This signals the end of the stream. If the encoder2379* still has packets buffered, it will return them after this2380* call. Once flushing mode has been entered, additional flush2381* packets are ignored, and sending frames will return2382* AVERROR_EOF.2383*2384* For audio:2385* If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame2386* can have any number of samples.2387* If it is not set, frame->nb_samples must be equal to2388* avctx->frame_size for all frames except the last.2389* The final frame may be smaller than avctx->frame_size.2390* @retval 0 success2391* @retval AVERROR(EAGAIN) input is not accepted in the current state - user must2392* read output with avcodec_receive_packet() (once all2393* output is read, the packet should be resent, and the2394* call will not fail with EAGAIN).2395* @retval AVERROR_EOF the encoder has been flushed, and no new frames can2396* be sent to it2397* @retval AVERROR(EINVAL) codec not opened, it is a decoder, or requires flush2398* @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar2399* @retval "another negative error code" legitimate encoding errors2400*/2401int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);24022403/**2404* Read encoded data from the encoder.2405*2406* @param avctx codec context2407* @param avpkt This will be set to a reference-counted packet allocated by the2408* encoder. Note that the function will always call2409* av_packet_unref(avpkt) before doing anything else.2410* @retval 0 success2411* @retval AVERROR(EAGAIN) output is not available in the current state - user must2412* try to send input2413* @retval AVERROR_EOF the encoder has been fully flushed, and there will be no2414* more output packets2415* @retval AVERROR(EINVAL) codec not opened, or it is a decoder2416* @retval "another negative error code" legitimate encoding errors2417*/2418int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);24192420/**2421* Create and return a AVHWFramesContext with values adequate for hardware2422* decoding. This is meant to get called from the get_format callback, and is2423* a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.2424* This API is for decoding with certain hardware acceleration modes/APIs only.2425*2426* The returned AVHWFramesContext is not initialized. The caller must do this2427* with av_hwframe_ctx_init().2428*2429* Calling this function is not a requirement, but makes it simpler to avoid2430* codec or hardware API specific details when manually allocating frames.2431*2432* Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,2433* which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes2434* it unnecessary to call this function or having to care about2435* AVHWFramesContext initialization at all.2436*2437* There are a number of requirements for calling this function:2438*2439* - It must be called from get_format with the same avctx parameter that was2440* passed to get_format. Calling it outside of get_format is not allowed, and2441* can trigger undefined behavior.2442* - The function is not always supported (see description of return values).2443* Even if this function returns successfully, hwaccel initialization could2444* fail later. (The degree to which implementations check whether the stream2445* is actually supported varies. Some do this check only after the user's2446* get_format callback returns.)2447* - The hw_pix_fmt must be one of the choices suggested by get_format. If the2448* user decides to use a AVHWFramesContext prepared with this API function,2449* the user must return the same hw_pix_fmt from get_format.2450* - The device_ref passed to this function must support the given hw_pix_fmt.2451* - After calling this API function, it is the user's responsibility to2452* initialize the AVHWFramesContext (returned by the out_frames_ref parameter),2453* and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done2454* before returning from get_format (this is implied by the normal2455* AVCodecContext.hw_frames_ctx API rules).2456* - The AVHWFramesContext parameters may change every time time get_format is2457* called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So2458* you are inherently required to go through this process again on every2459* get_format call.2460* - It is perfectly possible to call this function without actually using2461* the resulting AVHWFramesContext. One use-case might be trying to reuse a2462* previously initialized AVHWFramesContext, and calling this API function2463* only to test whether the required frame parameters have changed.2464* - Fields that use dynamically allocated values of any kind must not be set2465* by the user unless setting them is explicitly allowed by the documentation.2466* If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,2467* the new free callback must call the potentially set previous free callback.2468* This API call may set any dynamically allocated fields, including the free2469* callback.2470*2471* The function will set at least the following fields on AVHWFramesContext2472* (potentially more, depending on hwaccel API):2473*2474* - All fields set by av_hwframe_ctx_alloc().2475* - Set the format field to hw_pix_fmt.2476* - Set the sw_format field to the most suited and most versatile format. (An2477* implication is that this will prefer generic formats over opaque formats2478* with arbitrary restrictions, if possible.)2479* - Set the width/height fields to the coded frame size, rounded up to the2480* API-specific minimum alignment.2481* - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size2482* field to the number of maximum reference surfaces possible with the codec,2483* plus 1 surface for the user to work (meaning the user can safely reference2484* at most 1 decoded surface at a time), plus additional buffering introduced2485* by frame threading. If the hwaccel does not require pre-allocation, the2486* field is left to 0, and the decoder will allocate new surfaces on demand2487* during decoding.2488* - Possibly AVHWFramesContext.hwctx fields, depending on the underlying2489* hardware API.2490*2491* Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but2492* with basic frame parameters set.2493*2494* The function is stateless, and does not change the AVCodecContext or the2495* device_ref AVHWDeviceContext.2496*2497* @param avctx The context which is currently calling get_format, and which2498* implicitly contains all state needed for filling the returned2499* AVHWFramesContext properly.2500* @param device_ref A reference to the AVHWDeviceContext describing the device2501* which will be used by the hardware decoder.2502* @param hw_pix_fmt The hwaccel format you are going to return from get_format.2503* @param out_frames_ref On success, set to a reference to an _uninitialized_2504* AVHWFramesContext, created from the given device_ref.2505* Fields will be set to values required for decoding.2506* Not changed if an error is returned.2507* @return zero on success, a negative value on error. The following error codes2508* have special semantics:2509* AVERROR(ENOENT): the decoder does not support this functionality. Setup2510* is always manual, or it is a decoder which does not2511* support setting AVCodecContext.hw_frames_ctx at all,2512* or it is a software format.2513* AVERROR(EINVAL): it is known that hardware decoding is not supported for2514* this configuration, or the device_ref is not supported2515* for the hwaccel referenced by hw_pix_fmt.2516*/2517int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,2518AVBufferRef *device_ref,2519enum AVPixelFormat hw_pix_fmt,2520AVBufferRef **out_frames_ref);25212522enum AVCodecConfig {2523AV_CODEC_CONFIG_PIX_FORMAT, ///< AVPixelFormat, terminated by AV_PIX_FMT_NONE2524AV_CODEC_CONFIG_FRAME_RATE, ///< AVRational, terminated by {0, 0}2525AV_CODEC_CONFIG_SAMPLE_RATE, ///< int, terminated by 02526AV_CODEC_CONFIG_SAMPLE_FORMAT, ///< AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE2527AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0}2528AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED2529AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED2530};25312532/**2533* Retrieve a list of all supported values for a given configuration type.2534*2535* @param avctx An optional context to use. Values such as2536* `strict_std_compliance` may affect the result. If NULL,2537* default values are used.2538* @param codec The codec to query, or NULL to use avctx->codec.2539* @param config The configuration to query.2540* @param flags Currently unused; should be set to zero.2541* @param out_configs On success, set to a list of configurations, terminated2542* by a config-specific terminator, or NULL if all2543* possible values are supported.2544* @param out_num_configs On success, set to the number of elements in2545*out_configs, excluding the terminator. Optional.2546*/2547int avcodec_get_supported_config(const AVCodecContext *avctx,2548const AVCodec *codec, enum AVCodecConfig config,2549unsigned flags, const void **out_configs,2550int *out_num_configs);2551255225532554/**2555* @defgroup lavc_parsing Frame parsing2556* @{2557*/25582559enum AVPictureStructure {2560AV_PICTURE_STRUCTURE_UNKNOWN, ///< unknown2561AV_PICTURE_STRUCTURE_TOP_FIELD, ///< coded as top field2562AV_PICTURE_STRUCTURE_BOTTOM_FIELD, ///< coded as bottom field2563AV_PICTURE_STRUCTURE_FRAME, ///< coded as frame2564};25652566typedef struct AVCodecParserContext {2567void *priv_data;2568const struct AVCodecParser *parser;2569int64_t frame_offset; /* offset of the current frame */2570int64_t cur_offset; /* current offset2571(incremented by each av_parser_parse()) */2572int64_t next_frame_offset; /* offset of the next frame */2573/* video info */2574int pict_type; /* XXX: Put it back in AVCodecContext. */2575/**2576* This field is used for proper frame duration computation in lavf.2577* It signals, how much longer the frame duration of the current frame2578* is compared to normal frame duration.2579*2580* frame_duration = (1 + repeat_pict) * time_base2581*2582* It is used by codecs like H.264 to display telecined material.2583*/2584int repeat_pict; /* XXX: Put it back in AVCodecContext. */2585int64_t pts; /* pts of the current frame */2586int64_t dts; /* dts of the current frame */25872588/* private data */2589int64_t last_pts;2590int64_t last_dts;2591int fetch_timestamp;25922593#define AV_PARSER_PTS_NB 42594int cur_frame_start_index;2595int64_t cur_frame_offset[AV_PARSER_PTS_NB];2596int64_t cur_frame_pts[AV_PARSER_PTS_NB];2597int64_t cur_frame_dts[AV_PARSER_PTS_NB];25982599int flags;2600#define PARSER_FLAG_COMPLETE_FRAMES 0x00012601#define PARSER_FLAG_ONCE 0x00022602/// Set if the parser has a valid file offset2603#define PARSER_FLAG_FETCHED_OFFSET 0x00042604#define PARSER_FLAG_USE_CODEC_TS 0x100026052606int64_t offset; ///< byte offset from starting packet start2607int64_t cur_frame_end[AV_PARSER_PTS_NB];26082609/**2610* Set by parser to 1 for key frames and 0 for non-key frames.2611* It is initialized to -1, so if the parser doesn't set this flag,2612* old-style fallback using AV_PICTURE_TYPE_I picture type as key frames2613* will be used.2614*/2615int key_frame;26162617// Timestamp generation support:2618/**2619* Synchronization point for start of timestamp generation.2620*2621* Set to >0 for sync point, 0 for no sync point and <0 for undefined2622* (default).2623*2624* For example, this corresponds to presence of H.264 buffering period2625* SEI message.2626*/2627int dts_sync_point;26282629/**2630* Offset of the current timestamp against last timestamp sync point in2631* units of AVCodecContext.time_base.2632*2633* Set to INT_MIN when dts_sync_point unused. Otherwise, it must2634* contain a valid timestamp offset.2635*2636* Note that the timestamp of sync point has usually a nonzero2637* dts_ref_dts_delta, which refers to the previous sync point. Offset of2638* the next frame after timestamp sync point will be usually 1.2639*2640* For example, this corresponds to H.264 cpb_removal_delay.2641*/2642int dts_ref_dts_delta;26432644/**2645* Presentation delay of current frame in units of AVCodecContext.time_base.2646*2647* Set to INT_MIN when dts_sync_point unused. Otherwise, it must2648* contain valid non-negative timestamp delta (presentation time of a frame2649* must not lie in the past).2650*2651* This delay represents the difference between decoding and presentation2652* time of the frame.2653*2654* For example, this corresponds to H.264 dpb_output_delay.2655*/2656int pts_dts_delta;26572658/**2659* Position of the packet in file.2660*2661* Analogous to cur_frame_pts/dts2662*/2663int64_t cur_frame_pos[AV_PARSER_PTS_NB];26642665/**2666* Byte position of currently parsed frame in stream.2667*/2668int64_t pos;26692670/**2671* Previous frame byte position.2672*/2673int64_t last_pos;26742675/**2676* Duration of the current frame.2677* For audio, this is in units of 1 / AVCodecContext.sample_rate.2678* For all other types, this is in units of AVCodecContext.time_base.2679*/2680int duration;26812682enum AVFieldOrder field_order;26832684/**2685* Indicate whether a picture is coded as a frame, top field or bottom field.2686*2687* For example, H.264 field_pic_flag equal to 0 corresponds to2688* AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag2689* equal to 1 and bottom_field_flag equal to 0 corresponds to2690* AV_PICTURE_STRUCTURE_TOP_FIELD.2691*/2692enum AVPictureStructure picture_structure;26932694/**2695* Picture number incremented in presentation or output order.2696* This field may be reinitialized at the first picture of a new sequence.2697*2698* For example, this corresponds to H.264 PicOrderCnt.2699*/2700int output_picture_number;27012702/**2703* Dimensions of the decoded video intended for presentation.2704*/2705int width;2706int height;27072708/**2709* Dimensions of the coded video.2710*/2711int coded_width;2712int coded_height;27132714/**2715* The format of the coded data, corresponds to enum AVPixelFormat for video2716* and for enum AVSampleFormat for audio.2717*2718* Note that a decoder can have considerable freedom in how exactly it2719* decodes the data, so the format reported here might be different from the2720* one returned by a decoder.2721*/2722int format;2723} AVCodecParserContext;27242725typedef struct AVCodecParser {2726int codec_ids[7]; /* several codec IDs are permitted */2727int priv_data_size;2728int (*parser_init)(AVCodecParserContext *s);2729/* This callback never returns an error, a negative value means that2730* the frame start was in a previous packet. */2731int (*parser_parse)(AVCodecParserContext *s,2732AVCodecContext *avctx,2733const uint8_t **poutbuf, int *poutbuf_size,2734const uint8_t *buf, int buf_size);2735void (*parser_close)(AVCodecParserContext *s);2736int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);2737} AVCodecParser;27382739/**2740* Iterate over all registered codec parsers.2741*2742* @param opaque a pointer where libavcodec will store the iteration state. Must2743* point to NULL to start the iteration.2744*2745* @return the next registered codec parser or NULL when the iteration is2746* finished2747*/2748const AVCodecParser *av_parser_iterate(void **opaque);27492750AVCodecParserContext *av_parser_init(int codec_id);27512752/**2753* Parse a packet.2754*2755* @param s parser context.2756* @param avctx codec context.2757* @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.2758* @param poutbuf_size set to size of parsed buffer or zero if not yet finished.2759* @param buf input buffer.2760* @param buf_size buffer size in bytes without the padding. I.e. the full buffer2761size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.2762To signal EOF, this should be 0 (so that the last frame2763can be output).2764* @param pts input presentation timestamp.2765* @param dts input decoding timestamp.2766* @param pos input byte position in stream.2767* @return the number of bytes of the input bitstream used.2768*2769* Example:2770* @code2771* while(in_len){2772* len = av_parser_parse2(myparser, AVCodecContext, &data, &size,2773* in_data, in_len,2774* pts, dts, pos);2775* in_data += len;2776* in_len -= len;2777*2778* if(size)2779* decode_frame(data, size);2780* }2781* @endcode2782*/2783int av_parser_parse2(AVCodecParserContext *s,2784AVCodecContext *avctx,2785uint8_t **poutbuf, int *poutbuf_size,2786const uint8_t *buf, int buf_size,2787int64_t pts, int64_t dts,2788int64_t pos);27892790void av_parser_close(AVCodecParserContext *s);27912792/**2793* @}2794* @}2795*/27962797/**2798* @addtogroup lavc_encoding2799* @{2800*/28012802int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,2803const AVSubtitle *sub);280428052806/**2807* @}2808*/28092810/**2811* @defgroup lavc_misc Utility functions2812* @ingroup libavc2813*2814* Miscellaneous utility functions related to both encoding and decoding2815* (or neither).2816* @{2817*/28182819/**2820* @defgroup lavc_misc_pixfmt Pixel formats2821*2822* Functions for working with pixel formats.2823* @{2824*/28252826/**2827* Return a value representing the fourCC code associated to the2828* pixel format pix_fmt, or 0 if no associated fourCC code can be2829* found.2830*/2831unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);28322833/**2834* Find the best pixel format to convert to given a certain source pixel2835* format. When converting from one pixel format to another, information loss2836* may occur. For example, when converting from RGB24 to GRAY, the color2837* information will be lost. Similarly, other losses occur when converting from2838* some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of2839* the given pixel formats should be used to suffer the least amount of loss.2840* The pixel formats from which it chooses one, are determined by the2841* pix_fmt_list parameter.2842*2843*2844* @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from2845* @param[in] src_pix_fmt source pixel format2846* @param[in] has_alpha Whether the source pixel format alpha channel is used.2847* @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.2848* @return The best pixel format to convert to or -1 if none was found.2849*/2850enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,2851enum AVPixelFormat src_pix_fmt,2852int has_alpha, int *loss_ptr);28532854enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);28552856/**2857* @}2858*/28592860void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);28612862int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);2863int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);2864//FIXME func typedef28652866/**2867* Fill AVFrame audio data and linesize pointers.2868*2869* The buffer buf must be a preallocated buffer with a size big enough2870* to contain the specified samples amount. The filled AVFrame data2871* pointers will point to this buffer.2872*2873* AVFrame extended_data channel pointers are allocated if necessary for2874* planar audio.2875*2876* @param frame the AVFrame2877* frame->nb_samples must be set prior to calling the2878* function. This function fills in frame->data,2879* frame->extended_data, frame->linesize[0].2880* @param nb_channels channel count2881* @param sample_fmt sample format2882* @param buf buffer to use for frame data2883* @param buf_size size of buffer2884* @param align plane size sample alignment (0 = default)2885* @return >=0 on success, negative error code on failure2886* @todo return the size in bytes required to store the samples in2887* case of success, at the next libavutil bump2888*/2889int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,2890enum AVSampleFormat sample_fmt, const uint8_t *buf,2891int buf_size, int align);28922893/**2894* Reset the internal codec state / flush internal buffers. Should be called2895* e.g. when seeking or when switching to a different stream.2896*2897* @note for decoders, this function just releases any references the decoder2898* might keep internally, but the caller's references remain valid.2899*2900* @note for encoders, this function will only do something if the encoder2901* declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder2902* will drain any remaining packets, and can then be reused for a different2903* stream (as opposed to sending a null frame which will leave the encoder2904* in a permanent EOF state after draining). This can be desirable if the2905* cost of tearing down and replacing the encoder instance is high.2906*/2907void avcodec_flush_buffers(AVCodecContext *avctx);29082909/**2910* Return audio frame duration.2911*2912* @param avctx codec context2913* @param frame_bytes size of the frame, or 0 if unknown2914* @return frame duration, in samples, if known. 0 if not able to2915* determine.2916*/2917int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);29182919/* memory */29202921/**2922* Same behaviour av_fast_malloc but the buffer has additional2923* AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.2924*2925* In addition the whole buffer will initially and after resizes2926* be 0-initialized so that no uninitialized data will ever appear.2927*/2928void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);29292930/**2931* Same behaviour av_fast_padded_malloc except that buffer will always2932* be 0-initialized after call.2933*/2934void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);29352936/**2937* @return a positive value if s is open (i.e. avcodec_open2() was called on it),2938* 0 otherwise.2939*/2940int avcodec_is_open(AVCodecContext *s);29412942/**2943* @}2944*/29452946#endif /* AVCODEC_AVCODEC_H */294729482949