FFmpeg 7.1.1
|
main external API structure. More...
#include <libavcodec/avcodec.h>
Data Fields | |
const AVClass * | av_class |
information on struct for av_log | |
int | log_level_offset |
enum AVMediaType | codec_type |
const struct AVCodec * | codec |
enum AVCodecID | codec_id |
unsigned int | codec_tag |
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). | |
void * | priv_data |
struct AVCodecInternal * | internal |
Private context used for internal data. | |
void * | opaque |
Private data of the user, can be used to carry app specific stuff. | |
int64_t | bit_rate |
the average bitrate | |
int | flags |
AV_CODEC_FLAG_*. | |
int | flags2 |
AV_CODEC_FLAG2_*. | |
uint8_t * | extradata |
some codecs need / can use extradata like Huffman tables. | |
int | extradata_size |
AVRational | time_base |
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. | |
AVRational | pkt_timebase |
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed. | |
AVRational | framerate |
int | delay |
Codec delay. | |
int | width |
picture width / height. | |
int | height |
int | coded_width |
Bitstream width / height, may be different from width/height e.g. | |
int | coded_height |
AVRational | sample_aspect_ratio |
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel. | |
enum AVPixelFormat | pix_fmt |
Pixel format, see AV_PIX_FMT_xxx. | |
enum AVPixelFormat | sw_pix_fmt |
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx. | |
enum AVColorPrimaries | color_primaries |
Chromaticity coordinates of the source primaries. | |
enum AVColorTransferCharacteristic | color_trc |
Color Transfer Characteristic. | |
enum AVColorSpace | colorspace |
YUV colorspace type. | |
enum AVColorRange | color_range |
MPEG vs JPEG YUV range. | |
enum AVChromaLocation | chroma_sample_location |
This defines the location of chroma samples. | |
enum AVFieldOrder | field_order |
Field order. | |
int | refs |
number of reference frames | |
int | has_b_frames |
Size of the frame reordering buffer in the decoder. | |
int | slice_flags |
slice flags | |
void(* | draw_horiz_band )(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height) |
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band. | |
enum AVPixelFormat(* | get_format )(struct AVCodecContext *s, const enum AVPixelFormat *fmt) |
Callback to negotiate the pixel format. | |
int | max_b_frames |
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 relative to the input. | |
float | b_quant_factor |
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). | |
float | b_quant_offset |
qscale offset between IP and B-frames | |
float | i_quant_factor |
qscale factor between P- and I-frames If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). | |
float | i_quant_offset |
qscale offset between P and I-frames | |
float | lumi_masking |
luminance masking (0-> disabled) | |
float | temporal_cplx_masking |
temporary complexity masking (0-> disabled) | |
float | spatial_cplx_masking |
spatial complexity masking (0-> disabled) | |
float | p_masking |
p block masking (0-> disabled) | |
float | dark_masking |
darkness masking (0-> disabled) | |
int | nsse_weight |
noise vs. | |
int | me_cmp |
motion estimation comparison function | |
int | me_sub_cmp |
subpixel motion estimation comparison function | |
int | mb_cmp |
macroblock comparison function (not supported yet) | |
int | ildct_cmp |
interlaced DCT comparison function | |
int | dia_size |
ME diamond size & shape. | |
int | last_predictor_count |
amount of previous MV predictors (2a+1 x 2a+1 square) | |
int | me_pre_cmp |
motion estimation prepass comparison function | |
int | pre_dia_size |
ME prepass diamond size & shape. | |
int | me_subpel_quality |
subpel ME quality | |
int | me_range |
maximum motion estimation search range in subpel units If 0 then no limit. | |
int | mb_decision |
macroblock decision mode | |
uint16_t * | intra_matrix |
custom intra quantization matrix Must be allocated with the av_malloc() family of functions, and will be freed in avcodec_free_context(). | |
uint16_t * | inter_matrix |
custom inter quantization matrix Must be allocated with the av_malloc() family of functions, and will be freed in avcodec_free_context(). | |
uint16_t * | chroma_intra_matrix |
custom intra quantization matrix | |
int | intra_dc_precision |
precision of the intra DC coefficient - 8 | |
int | mb_lmin |
minimum MB Lagrange multiplier | |
int | mb_lmax |
maximum MB Lagrange multiplier | |
int | bidir_refine |
int | keyint_min |
minimum GOP size | |
int | gop_size |
the number of pictures in a group of pictures, or 0 for intra_only | |
int | mv0_threshold |
Note: Value depends upon the compare function used for fullpel ME. | |
int | slices |
Number of slices. | |
int | sample_rate |
samples per second | |
enum AVSampleFormat | sample_fmt |
audio sample format | |
AVChannelLayout | ch_layout |
Audio channel layout. | |
int | frame_size |
Number of samples per channel in an audio frame. | |
int | block_align |
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs. | |
int | cutoff |
Audio cutoff bandwidth (0 means "automatic") | |
enum AVAudioServiceType | audio_service_type |
Type of service that the audio stream conveys. | |
enum AVSampleFormat | request_sample_fmt |
desired sample format | |
int | initial_padding |
Audio only. | |
int | trailing_padding |
Audio only. | |
int | seek_preroll |
Number of samples to skip after a discontinuity. | |
int(* | get_buffer2 )(struct AVCodecContext *s, AVFrame *frame, int flags) |
This callback is called at the beginning of each frame to get data buffer(s) for it. | |
int | bit_rate_tolerance |
number of bits the bitstream is allowed to diverge from the reference. | |
int | global_quality |
Global quality for codecs which cannot change it per frame. | |
int | compression_level |
float | qcompress |
amount of qscale change between easy & hard scenes (0.0-1.0) | |
float | qblur |
amount of qscale smoothing over time (0.0-1.0) | |
int | qmin |
minimum quantizer | |
int | qmax |
maximum quantizer | |
int | max_qdiff |
maximum quantizer difference between frames | |
int | rc_buffer_size |
decoder bitstream buffer size | |
int | rc_override_count |
ratecontrol override, see RcOverride | |
RcOverride * | rc_override |
int64_t | rc_max_rate |
maximum bitrate | |
int64_t | rc_min_rate |
minimum bitrate | |
float | rc_max_available_vbv_use |
Ratecontrol attempt to use, at maximum, of what can be used without an underflow. | |
float | rc_min_vbv_overflow_use |
Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. | |
int | rc_initial_buffer_occupancy |
Number of bits which should be loaded into the rc buffer before decoding starts. | |
int | trellis |
trellis RD quantization | |
char * | stats_out |
pass1 encoding statistics output buffer | |
char * | stats_in |
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed here. | |
int | workaround_bugs |
Work around bugs in encoders which sometimes cannot be detected automatically. | |
int | strict_std_compliance |
strictly follow the standard (MPEG-4, ...). | |
int | error_concealment |
error concealment flags | |
int | debug |
debug | |
int | err_recognition |
Error recognition; may misdetect some more or less valid parts as errors. | |
const struct AVHWAccel * | hwaccel |
Hardware accelerator in use. | |
void * | hwaccel_context |
Legacy hardware accelerator context. | |
AVBufferRef * | hw_frames_ctx |
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames. | |
AVBufferRef * | hw_device_ctx |
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/decoder. | |
int | hwaccel_flags |
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active). | |
int | extra_hw_frames |
Video decoding only. | |
uint64_t | error [AV_NUM_DATA_POINTERS] |
error | |
int | dct_algo |
DCT algorithm, see FF_DCT_* below. | |
int | idct_algo |
IDCT algorithm, see FF_IDCT_* below. | |
int | bits_per_coded_sample |
bits per sample/pixel from the demuxer (needed for huffyuv). | |
int | bits_per_raw_sample |
Bits per sample/pixel of internal libavcodec pixel/sample format. | |
int | thread_count |
thread count is used to decide how many independent tasks should be passed to execute() | |
int | thread_type |
Which multithreading methods to use. | |
int | active_thread_type |
Which multithreading methods are in use by the codec. | |
int(* | execute )(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size) |
The codec may call this to execute several independent things. | |
int(* | execute2 )(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count) |
The codec may call this to execute several independent things. | |
int | profile |
profile | |
int | level |
Encoding level descriptor. | |
unsigned | properties |
Properties of the stream that gets decoded. | |
enum AVDiscard | skip_loop_filter |
Skip loop filtering for selected frames. | |
enum AVDiscard | skip_idct |
Skip IDCT/dequantization for selected frames. | |
enum AVDiscard | skip_frame |
Skip decoding for selected frames. | |
int | skip_alpha |
Skip processing alpha if supported by codec. | |
int | skip_top |
Number of macroblock rows at the top which are skipped. | |
int | skip_bottom |
Number of macroblock rows at the bottom which are skipped. | |
int | lowres |
low resolution decoding, 1-> 1/2 size, 2->1/4 size | |
const struct AVCodecDescriptor * | codec_descriptor |
AVCodecDescriptor. | |
char * | sub_charenc |
Character encoding of the input subtitles file. | |
int | sub_charenc_mode |
Subtitles character encoding mode. | |
int | subtitle_header_size |
Header containing style information for text subtitles. | |
uint8_t * | subtitle_header |
uint8_t * | dump_separator |
dump format separator. | |
char * | codec_whitelist |
',' separated list of allowed decoders. | |
AVPacketSideData * | coded_side_data |
Additional data associated with the entire coded stream. | |
int | nb_coded_side_data |
int | export_side_data |
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame, packet, or coded stream side data by decoders and encoders. | |
int64_t | max_pixels |
The number of pixels per image to maximally accept. | |
int | apply_cropping |
Video decoding only. | |
int | discard_damaged_percentage |
The percentage of damaged samples to discard a frame. | |
int64_t | max_samples |
The number of samples per frame to maximally accept. | |
int(* | get_encode_buffer )(struct AVCodecContext *s, AVPacket *pkt, int flags) |
This callback is called at the beginning of each packet to get a data buffer for it. | |
int64_t | frame_num |
Frame counter, set by libavcodec. | |
int * | side_data_prefer_packet |
Decoding only. | |
unsigned | nb_side_data_prefer_packet |
Number of entries in side_data_prefer_packet. | |
AVFrameSideData ** | decoded_side_data |
Array containing static side data, such as HDR10 CLL / MDCV structures. | |
int | nb_decoded_side_data |
main external API structure.
New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user applications. The name string for AVOptions options matches the associated command line parameter name and can be found in libavcodec/options_table.h The AVOption/command line parameter names differ in some cases from the C structure field names for historic reasons or brevity. sizeof(AVCodecContext) must not be used outside libav*.
const AVClass* AVCodecContext::av_class |
enum AVMediaType AVCodecContext::codec_type |
Definition at line 459 of file avcodec.h.
Referenced by init_filter(), open_input_file(), and open_output_file().
const struct AVCodec* AVCodecContext::codec |
Definition at line 460 of file avcodec.h.
Referenced by decode_packet(), and open_audio().
enum AVCodecID AVCodecContext::codec_id |
Definition at line 461 of file avcodec.h.
Referenced by add_stream(), main(), and open_output_file().
unsigned int AVCodecContext::codec_tag |
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This is used to work around some encoder bugs. A demuxer should set this to what is stored in the field used to identify the codec. If there are multiple such fields in a container then the demuxer should choose the one which maximizes the information about the used codec. If the codec tag field in a container is larger than 32 bits then the demuxer should remap the longer ID to 32 bits with a table or other structure. Alternatively a new extra_codec_tag + size could be added but for this a clear advantage must be demonstrated first.
void* AVCodecContext::priv_data |
Definition at line 478 of file avcodec.h.
Referenced by dynamic_set_parameter(), and main().
struct AVCodecInternal* AVCodecContext::internal |
void* AVCodecContext::opaque |
int64_t AVCodecContext::bit_rate |
the average bitrate
Definition at line 501 of file avcodec.h.
Referenced by add_stream(), main(), and open_output_file().
int AVCodecContext::flags |
AV_CODEC_FLAG_*.
Definition at line 508 of file avcodec.h.
Referenced by add_stream(), open_output_file(), and open_output_file().
int AVCodecContext::flags2 |
uint8_t* AVCodecContext::extradata |
some codecs need / can use extradata like Huffman tables.
MJPEG: Huffman tables rv10: additional flags MPEG-4: global headers (they can be in the bitstream or here) The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger than extradata_size to avoid problems if it is read with the bitstream reader. The bytewise contents of extradata must not depend on the architecture or CPU endianness. Must be allocated with the av_malloc() family of functions.
Definition at line 529 of file avcodec.h.
Referenced by main().
int AVCodecContext::extradata_size |
AVRational AVCodecContext::time_base |
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
For fixed-fps content, timebase should be 1/framerate and timestamp increments should be identically 1. This often, but not always is the inverse of the frame rate or field rate for video. 1/time_base is not the average frame rate if the frame rate is not constant.
Like containers, elementary streams also can store timestamps, 1/time_base is the unit in which these timestamps are specified. As example of such codec time base see ISO/IEC 14496-2:2001(E) vop_time_increment_resolution and fixed_vop_rate (fixed_vop_rate == 0 implies that it is different from the framerate)
Definition at line 550 of file avcodec.h.
Referenced by add_stream(), dec_enc(), dec_enc(), dynamic_set_parameter(), encode_write(), encode_write_frame(), get_video_frame(), main(), main(), open_output_file(), output_audio_frame(), write_audio_frame(), and write_frame().
AVRational AVCodecContext::pkt_timebase |
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
Definition at line 557 of file avcodec.h.
Referenced by dec_enc(), init_filter(), open_input_file(), open_input_file(), and open_input_file().
AVRational AVCodecContext::framerate |
Definition at line 566 of file avcodec.h.
Referenced by dec_enc(), dec_enc(), dynamic_set_parameter(), main(), main(), open_input_file(), open_input_file(), and open_output_file().
int AVCodecContext::delay |
Codec delay.
Encoding: Number of frames delay there will be from the encoder input to the decoder output. (we assume the decoder matches the spec) Decoding: Number of frames delay in addition to what a standard decoder as specified in the spec would produce.
Video: Number of frames the decoded output will be delayed relative to the encoded input.
Audio: For encoding, this field is unused (see initial_padding).
For decoding, this is the number of samples the decoder needs to output before the decoder's output is valid. When seeking, you should start decoding this many samples prior to your desired seek point.
int AVCodecContext::width |
picture width / height.
Definition at line 624 of file avcodec.h.
Referenced by add_stream(), dec_enc(), dec_enc(), get_video_frame(), init_filter(), init_filters(), main(), main(), open_output_file(), and open_video().
int AVCodecContext::height |
Definition at line 624 of file avcodec.h.
Referenced by add_stream(), dec_enc(), dec_enc(), get_video_frame(), init_filter(), init_filters(), main(), main(), open_output_file(), and open_video().
int AVCodecContext::coded_width |
Bitstream width / height, may be different from width/height e.g.
when the decoded frame is cropped before being output or lowres is enabled.
AVRational AVCodecContext::sample_aspect_ratio |
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
Definition at line 648 of file avcodec.h.
Referenced by init_filter(), init_filters(), main(), and open_output_file().
enum AVPixelFormat AVCodecContext::pix_fmt |
Pixel format, see AV_PIX_FMT_xxx.
May be set by the demuxer if known from headers. May be overridden by the decoder if it knows better.
Definition at line 663 of file avcodec.h.
Referenced by add_stream(), dec_enc(), dec_enc(), get_video_frame(), init_filter(), init_filters(), main(), main(), open_output_file(), and open_video().
enum AVPixelFormat AVCodecContext::sw_pix_fmt |
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
enum AVColorPrimaries AVCodecContext::color_primaries |
enum AVColorTransferCharacteristic AVCodecContext::color_trc |
enum AVColorSpace AVCodecContext::colorspace |
enum AVColorRange AVCodecContext::color_range |
MPEG vs JPEG YUV range.
enum AVChromaLocation AVCodecContext::chroma_sample_location |
enum AVFieldOrder AVCodecContext::field_order |
int AVCodecContext::refs |
int AVCodecContext::has_b_frames |
int AVCodecContext::slice_flags |
void(* AVCodecContext::draw_horiz_band) (struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height) |
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band.
It improves cache usage. Not all codecs can do that. You must check the codec capabilities beforehand. When multithreading is used, it may be called from multiple threads at the same time; threads might draw different parts of the same AVFrame, or multiple AVFrames, and there is no guarantee that slices will be drawn in order. The function is also used by hardware acceleration APIs. It is called at least once during frame decoding to pass the data needed for hardware render. In that mode instead of pixel data, AVFrame points to a structure specific to the acceleration API. The application reads the structure and can change some fields to indicate progress or mark state.
height | the height of the slice |
y | the y position of the slice |
type | 1->top field, 2->bottom field, 3->frame |
offset | offset into the AVFrame.data from which the slice should be read |
enum AVPixelFormat(* AVCodecContext::get_format) (struct AVCodecContext *s, const enum AVPixelFormat *fmt) |
Callback to negotiate the pixel format.
Decoding only, may be set by the caller before avcodec_open2().
Called by some decoders to select the pixel format that will be used for the output frames. This is mainly used to set up hardware acceleration, then the provided format list contains the corresponding hwaccel pixel formats alongside the "software" one. The software pixel format may also be retrieved from sw_pix_fmt.
This callback will be called when the coded frame properties (such as resolution, pixel format, etc.) change and more than one output format is supported for those new properties. If a hardware pixel format is chosen and initialization for it fails, the callback may be called again immediately.
This callback may be called from different threads if the decoder is multi-threaded, but not from more than one thread simultaneously.
fmt | list of formats which may be used in the current configuration, terminated by AV_PIX_FMT_NONE. |
Definition at line 764 of file avcodec.h.
Referenced by main(), main(), open_input_file(), and open_input_file().
int AVCodecContext::max_b_frames |
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 relative to the input.
Definition at line 801 of file avcodec.h.
Referenced by add_stream(), and main().
float AVCodecContext::b_quant_factor |
float AVCodecContext::b_quant_offset |
float AVCodecContext::i_quant_factor |
float AVCodecContext::i_quant_offset |
float AVCodecContext::lumi_masking |
float AVCodecContext::temporal_cplx_masking |
float AVCodecContext::spatial_cplx_masking |
float AVCodecContext::p_masking |
float AVCodecContext::dark_masking |
int AVCodecContext::nsse_weight |
int AVCodecContext::me_cmp |
int AVCodecContext::me_sub_cmp |
int AVCodecContext::mb_cmp |
int AVCodecContext::ildct_cmp |
int AVCodecContext::dia_size |
int AVCodecContext::last_predictor_count |
int AVCodecContext::me_pre_cmp |
int AVCodecContext::pre_dia_size |
int AVCodecContext::me_subpel_quality |
int AVCodecContext::me_range |
int AVCodecContext::mb_decision |
macroblock decision mode
Definition at line 968 of file avcodec.h.
Referenced by add_stream().
uint16_t* AVCodecContext::intra_matrix |
custom intra quantization matrix Must be allocated with the av_malloc() family of functions, and will be freed in avcodec_free_context().
uint16_t* AVCodecContext::inter_matrix |
custom inter quantization matrix Must be allocated with the av_malloc() family of functions, and will be freed in avcodec_free_context().
uint16_t* AVCodecContext::chroma_intra_matrix |
int AVCodecContext::intra_dc_precision |
int AVCodecContext::mb_lmin |
int AVCodecContext::mb_lmax |
int AVCodecContext::bidir_refine |
int AVCodecContext::keyint_min |
int AVCodecContext::gop_size |
the number of pictures in a group of pictures, or 0 for intra_only
Definition at line 1037 of file avcodec.h.
Referenced by add_stream(), and main().
int AVCodecContext::mv0_threshold |
int AVCodecContext::slices |
int AVCodecContext::sample_rate |
samples per second
Definition at line 1056 of file avcodec.h.
Referenced by add_stream(), init_filter(), init_filters(), init_output_frame(), init_resampler(), main(), open_audio(), open_output_file(), open_output_file(), and write_audio_frame().
enum AVSampleFormat AVCodecContext::sample_fmt |
audio sample format
Definition at line 1063 of file avcodec.h.
Referenced by add_stream(), decode(), init_converted_samples(), init_fifo(), init_filter(), init_filters(), init_output_frame(), init_resampler(), main(), open_audio(), open_output_file(), and open_output_file().
AVChannelLayout AVCodecContext::ch_layout |
Audio channel layout.
Definition at line 1071 of file avcodec.h.
Referenced by add_stream(), decode(), init_converted_samples(), init_fifo(), init_filter(), init_filters(), init_output_frame(), init_resampler(), main(), open_audio(), open_output_file(), and open_output_file().
int AVCodecContext::frame_size |
Number of samples per channel in an audio frame.
Definition at line 1083 of file avcodec.h.
Referenced by load_encode_and_write(), main(), and open_audio().
int AVCodecContext::block_align |
int AVCodecContext::cutoff |
enum AVAudioServiceType AVCodecContext::audio_service_type |
enum AVSampleFormat AVCodecContext::request_sample_fmt |
int AVCodecContext::initial_padding |
Audio only.
The number of "priming" samples (padding) inserted by the encoder at the beginning of the audio. I.e. this number of leading decoded samples must be discarded by the caller to get the original audio without leading padding.
int AVCodecContext::trailing_padding |
Audio only.
The amount of padding (in samples) appended by the encoder to the end of the audio. I.e. this number of decoded samples must be discarded by the caller from the end of the stream to get the original audio without any trailing padding.
int AVCodecContext::seek_preroll |
int(* AVCodecContext::get_buffer2) (struct AVCodecContext *s, AVFrame *frame, int flags) |
This callback is called at the beginning of each frame to get data buffer(s) for it.
There may be one contiguous buffer for all the data or there may be a buffer per each data plane or anything in between. What this means is, you may set however many entries in buf[] you feel necessary. Each buffer must be reference-counted using the AVBuffer API (see description of buf[] below).
The following fields will be set in the frame before this callback is called:
This callback must fill the following fields in the frame:
If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call avcodec_default_get_buffer2() instead of providing buffers allocated by some other means.
Each data plane must be aligned to the maximum required by the target CPU.
Video:
If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused (read and/or written to if it is writable) later by libavcodec.
avcodec_align_dimensions2() should be used to find the required width and height, as they normally need to be rounded up to the next multiple of 16.
Some decoders do not support linesizes changing between frames.
If frame multithreading is used, this callback may be called from a different thread, but not from more than one at once. Does not need to be reentrant.
Audio:
Decoders request a buffer of a particular size by setting AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, however, utilize only part of the buffer by setting AVFrame.nb_samples to a smaller value in the output frame.
As a convenience, av_samples_get_buffer_size() and av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() functions to find the required data size and to fill data pointers and linesize. In AVFrame.linesize, only linesize[0] may be set for audio since all planes must be the same size.
int AVCodecContext::bit_rate_tolerance |
int AVCodecContext::global_quality |
int AVCodecContext::compression_level |
float AVCodecContext::qcompress |
float AVCodecContext::qblur |
int AVCodecContext::qmin |
int AVCodecContext::qmax |
int AVCodecContext::max_qdiff |
int AVCodecContext::rc_buffer_size |
int AVCodecContext::rc_override_count |
ratecontrol override, see RcOverride
RcOverride* AVCodecContext::rc_override |
int64_t AVCodecContext::rc_max_rate |
int64_t AVCodecContext::rc_min_rate |
float AVCodecContext::rc_max_available_vbv_use |
float AVCodecContext::rc_min_vbv_overflow_use |
int AVCodecContext::rc_initial_buffer_occupancy |
int AVCodecContext::trellis |
char* AVCodecContext::stats_out |
char* AVCodecContext::stats_in |
int AVCodecContext::workaround_bugs |
int AVCodecContext::strict_std_compliance |
strictly follow the standard (MPEG-4, ...).
int AVCodecContext::error_concealment |
int AVCodecContext::debug |
int AVCodecContext::err_recognition |
const struct AVHWAccel* AVCodecContext::hwaccel |
void* AVCodecContext::hwaccel_context |
Legacy hardware accelerator context.
For some hardware acceleration methods, the caller may use this field to signal hwaccel-specific data to the codec. The struct pointed to by this pointer is hwaccel-dependent and defined in the respective header. Please refer to the FFmpeg HW accelerator documentation to know how to fill this.
In most cases this field is optional - the necessary information may also be provided to libavcodec through hw_frames_ctx or hw_device_ctx (see avcodec_get_hw_config()). However, in some cases it may be the only method of signalling some (optional) information.
The struct and its contents are owned by the caller.
AVBufferRef* AVCodecContext::hw_frames_ctx |
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
The reference is set by the caller and afterwards owned (and freed) by libavcodec - it should never be read by the caller after being set.
decoding: This field should be set by the caller from the get_format() callback. The previous reference (if any) will always be unreffed by libavcodec before the get_format() call.
If the default get_buffer2() is used with a hwaccel pixel format, then this AVHWFramesContext will be used for allocating the frame buffers.
encoding: For hardware encoders configured to use a hwaccel pixel format, this field should be set by the caller to a reference to the AVHWFramesContext describing input frames. AVHWFramesContext.format must be equal to AVCodecContext.pix_fmt.
This field should be set before avcodec_open2() is called.
Definition at line 1485 of file avcodec.h.
Referenced by dec_enc(), dec_enc(), main(), and set_hwframe_ctx().
AVBufferRef* AVCodecContext::hw_device_ctx |
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/decoder.
The reference is set by the caller and afterwards owned (and freed) by libavcodec.
This should be used if either the codec device does not require hardware frames or any that are used are to be allocated internally by libavcodec. If the user wishes to supply any of the frames used as encoder input or decoder output then hw_frames_ctx should be used instead. When hw_frames_ctx is set in get_format() for a decoder, this field will be ignored while decoding the associated stream segment, but may again be used on a following one after another get_format() call.
For both encoders and decoders this field should be set before avcodec_open2() is called and must not be written to thereafter.
Note that some decoders may require this field to be set initially in order to support hw_frames_ctx at all - in that case, all frames contexts used must be created on the same device.
Definition at line 1507 of file avcodec.h.
Referenced by hw_decoder_init(), main(), open_input_file(), and open_input_file().
int AVCodecContext::hwaccel_flags |
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
int AVCodecContext::extra_hw_frames |
Video decoding only.
Sets the number of extra hardware frames which the decoder will allocate for use by the caller. This must be set before avcodec_open2() is called.
Some hardware decoders require all frames that they will use for output to be defined in advance before decoding starts. For such decoders, the hardware frame pool must therefore be of a fixed size. The extra frames set here are on top of any number that the decoder needs internally in order to operate normally (for example, frames used as reference pictures).
uint64_t AVCodecContext::error[AV_NUM_DATA_POINTERS] |
int AVCodecContext::dct_algo |
int AVCodecContext::idct_algo |
int AVCodecContext::bits_per_coded_sample |
int AVCodecContext::bits_per_raw_sample |
int AVCodecContext::thread_count |
int AVCodecContext::thread_type |
Which multithreading methods to use.
Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, so clients which cannot provide future frames should not use it.
int AVCodecContext::active_thread_type |
int(* AVCodecContext::execute) (struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size) |
The codec may call this to execute several independent things.
It will return only after finishing all tasks. The user may replace this with some multithreaded implementation, the default implementation will execute the parts serially.
count | the number of things to execute
|
int(* AVCodecContext::execute2) (struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count) |
The codec may call this to execute several independent things.
It will return only after finishing all tasks. The user may replace this with some multithreaded implementation, the default implementation will execute the parts serially.
c | context passed also to func |
count | the number of things to execute |
arg2 | argument passed unchanged to func |
ret | return values of executed functions, must have space for "count" values. May be NULL. |
func | function that will be called count times, with jobnr from 0 to count-1. threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no two instances of func executing at the same time will have the same threadnr. |
int AVCodecContext::profile |
int AVCodecContext::level |
unsigned AVCodecContext::properties |
enum AVDiscard AVCodecContext::skip_loop_filter |
enum AVDiscard AVCodecContext::skip_idct |
enum AVDiscard AVCodecContext::skip_frame |
int AVCodecContext::skip_alpha |
Skip processing alpha if supported by codec.
Note that if the format uses pre-multiplied alpha (common with VP6, and recommended due to better video quality/compression) the image will look as if alpha-blended onto a black background. However for formats that do not use pre-multiplied alpha there might be serious artefacts (though e.g. libswscale currently assumes pre-multiplied alpha anyway).
int AVCodecContext::skip_top |
int AVCodecContext::skip_bottom |
int AVCodecContext::lowres |
const struct AVCodecDescriptor* AVCodecContext::codec_descriptor |
char* AVCodecContext::sub_charenc |
int AVCodecContext::sub_charenc_mode |
int AVCodecContext::subtitle_header_size |
Header containing style information for text subtitles.
For SUBTITLE_ASS subtitle type, it should contain the whole ASS [Script Info] and [V4+ Styles] section, plus the [Events] line and the Format line following. It shouldn't include any Dialogue line.
uint8_t* AVCodecContext::dump_separator |
char* AVCodecContext::codec_whitelist |
AVPacketSideData* AVCodecContext::coded_side_data |
Additional data associated with the entire coded stream.
int AVCodecContext::export_side_data |
int64_t AVCodecContext::max_pixels |
int AVCodecContext::apply_cropping |
Video decoding only.
Certain video codecs support cropping, meaning that only a sub-rectangle of the decoded frame is intended for display. This option controls how cropping is handled by libavcodec.
When set to 1 (the default), libavcodec will apply cropping internally. I.e. it will modify the output frame width/height fields and offset the data pointers (only by as much as possible while preserving alignment, or by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that the frames output by the decoder refer only to the cropped area. The crop_* fields of the output frames will be zero.
When set to 0, the width/height fields of the output frames will be set to the coded dimensions and the crop_* fields will describe the cropping rectangle. Applying the cropping is left to the caller.
int AVCodecContext::discard_damaged_percentage |
int64_t AVCodecContext::max_samples |
int(* AVCodecContext::get_encode_buffer) (struct AVCodecContext *s, AVPacket *pkt, int flags) |
This callback is called at the beginning of each packet to get a data buffer for it.
The following field will be set in the packet before this callback is called:
In some specific cases, the encoder may not use the entire buffer allocated by this callback. This will be reflected in the size value in the packet once returned by avcodec_receive_packet().
This callback must fill the following fields in the packet:
If AV_CODEC_CAP_DR1 is not set then get_encode_buffer() must call avcodec_default_get_encode_buffer() instead of providing a buffer allocated by some other means.
The flags field may contain a combination of AV_GET_ENCODE_BUFFER_FLAG_ flags. They may be used for example to hint what use the buffer may get after being created. Implementations of this callback may ignore flags they don't understand. If AV_GET_ENCODE_BUFFER_FLAG_REF is set in flags then the packet may be reused (read and/or written to if it is writable) later by libavcodec.
This callback must be thread-safe, as when frame threading is used, it may be called from multiple threads simultaneously.
int64_t AVCodecContext::frame_num |
Frame counter, set by libavcodec.
encoding: total number of frames passed to the encoder so far.
Definition at line 2041 of file avcodec.h.
Referenced by decode().
int* AVCodecContext::side_data_prefer_packet |
Decoding only.
May be set by the caller before avcodec_open2() to an av_malloc()'ed array (or via AVOptions). Owned and freed by the decoder afterwards.
Side data attached to decoded frames may come from several sources:
This array configures decoder behaviour in cases when side data of the same type is present both in the coded bytestream and in the user-supplied side data (items 1. and 2. above). In all cases, at most one instance of each side data type will be attached to output frames. By default it will be the bytestream side data. Adding an AVPacketSideDataType value to this array will flip the preference for this type, thus making the decoder prefer user-supplied side data over bytestream. In case side data of the same type is present both in coded_data and attacked to a packet, the packet instance always has priority.
The array may also contain a single -1, in which case the preference is switched for all side data types.
unsigned AVCodecContext::nb_side_data_prefer_packet |
AVFrameSideData** AVCodecContext::decoded_side_data |
Array containing static side data, such as HDR10 CLL / MDCV structures.
Side data entries should be allocated by usage of helpers defined in libavutil/frame.h.