Path: blob/a-new-beginning/libavcodec.xcframework/ios-arm64-simulator/libavcodec.framework/Headers/codec_par.h
2 views
/*1* Codec parameters public API2*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_CODEC_PAR_H21#define AVCODEC_CODEC_PAR_H2223#include <stdint.h>2425#include "libavutil/avutil.h"26#include "libavutil/channel_layout.h"27#include "libavutil/rational.h"28#include "libavutil/pixfmt.h"2930#include "codec_id.h"3132/**33* @addtogroup lavc_core34* @{35*/3637enum AVFieldOrder {38AV_FIELD_UNKNOWN,39AV_FIELD_PROGRESSIVE,40AV_FIELD_TT, ///< Top coded_first, top displayed first41AV_FIELD_BB, ///< Bottom coded first, bottom displayed first42AV_FIELD_TB, ///< Top coded first, bottom displayed first43AV_FIELD_BT, ///< Bottom coded first, top displayed first44};4546/**47* This struct describes the properties of an encoded stream.48*49* sizeof(AVCodecParameters) is not a part of the public ABI, this struct must50* be allocated with avcodec_parameters_alloc() and freed with51* avcodec_parameters_free().52*/53typedef struct AVCodecParameters {54/**55* General type of the encoded data.56*/57enum AVMediaType codec_type;58/**59* Specific type of the encoded data (the codec used).60*/61enum AVCodecID codec_id;62/**63* Additional information about the codec (corresponds to the AVI FOURCC).64*/65uint32_t codec_tag;6667/**68* Extra binary data needed for initializing the decoder, codec-dependent.69*70* Must be allocated with av_malloc() and will be freed by71* avcodec_parameters_free(). The allocated size of extradata must be at72* least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding73* bytes zeroed.74*/75uint8_t *extradata;76/**77* Size of the extradata content in bytes.78*/79int extradata_size;8081/**82* - video: the pixel format, the value corresponds to enum AVPixelFormat.83* - audio: the sample format, the value corresponds to enum AVSampleFormat.84*/85int format;8687/**88* The average bitrate of the encoded data (in bits per second).89*/90int64_t bit_rate;9192/**93* The number of bits per sample in the codedwords.94*95* This is basically the bitrate per sample. It is mandatory for a bunch of96* formats to actually decode them. It's the number of bits for one sample in97* the actual coded bitstream.98*99* This could be for example 4 for ADPCM100* For PCM formats this matches bits_per_raw_sample101* Can be 0102*/103int bits_per_coded_sample;104105/**106* This is the number of valid bits in each output sample. If the107* sample format has more bits, the least significant bits are additional108* padding bits, which are always 0. Use right shifts to reduce the sample109* to its actual size. For example, audio formats with 24 bit samples will110* have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.111* To get the original sample use "(int32_t)sample >> 8"."112*113* For ADPCM this might be 12 or 16 or similar114* Can be 0115*/116int bits_per_raw_sample;117118/**119* Codec-specific bitstream restrictions that the stream conforms to.120*/121int profile;122int level;123124/**125* Video only. The dimensions of the video frame in pixels.126*/127int width;128int height;129130/**131* Video only. The aspect ratio (width / height) which a single pixel132* should have when displayed.133*134* When the aspect ratio is unknown / undefined, the numerator should be135* set to 0 (the denominator may have any value).136*/137AVRational sample_aspect_ratio;138139/**140* Video only. The order of the fields in interlaced video.141*/142enum AVFieldOrder field_order;143144/**145* Video only. Additional colorspace characteristics.146*/147enum AVColorRange color_range;148enum AVColorPrimaries color_primaries;149enum AVColorTransferCharacteristic color_trc;150enum AVColorSpace color_space;151enum AVChromaLocation chroma_location;152153/**154* Video only. Number of delayed frames.155*/156int video_delay;157158#if FF_API_OLD_CHANNEL_LAYOUT159/**160* Audio only. The channel layout bitmask. May be 0 if the channel layout is161* unknown or unspecified, otherwise the number of bits set must be equal to162* the channels field.163* @deprecated use ch_layout164*/165attribute_deprecated166uint64_t channel_layout;167/**168* Audio only. The number of audio channels.169* @deprecated use ch_layout.nb_channels170*/171attribute_deprecated172int channels;173#endif174/**175* Audio only. The number of audio samples per second.176*/177int sample_rate;178/**179* Audio only. The number of bytes per coded audio frame, required by some180* formats.181*182* Corresponds to nBlockAlign in WAVEFORMATEX.183*/184int block_align;185/**186* Audio only. Audio frame size, if known. Required by some formats to be static.187*/188int frame_size;189190/**191* Audio only. The amount of padding (in samples) inserted by the encoder at192* the beginning of the audio. I.e. this number of leading decoded samples193* must be discarded by the caller to get the original audio without leading194* padding.195*/196int initial_padding;197/**198* Audio only. The amount of padding (in samples) appended by the encoder to199* the end of the audio. I.e. this number of decoded samples must be200* discarded by the caller from the end of the stream to get the original201* audio without any trailing padding.202*/203int trailing_padding;204/**205* Audio only. Number of samples to skip after a discontinuity.206*/207int seek_preroll;208209/**210* Audio only. The channel layout and number of channels.211*/212AVChannelLayout ch_layout;213} AVCodecParameters;214215/**216* Allocate a new AVCodecParameters and set its fields to default values217* (unknown/invalid/0). The returned struct must be freed with218* avcodec_parameters_free().219*/220AVCodecParameters *avcodec_parameters_alloc(void);221222/**223* Free an AVCodecParameters instance and everything associated with it and224* write NULL to the supplied pointer.225*/226void avcodec_parameters_free(AVCodecParameters **par);227228/**229* Copy the contents of src to dst. Any allocated fields in dst are freed and230* replaced with newly allocated duplicates of the corresponding fields in src.231*232* @return >= 0 on success, a negative AVERROR code on failure.233*/234int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);235236/**237* This function is the same as av_get_audio_frame_duration(), except it works238* with AVCodecParameters instead of an AVCodecContext.239*/240int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);241242/**243* @}244*/245246#endif // AVCODEC_CODEC_PAR_H247248249