FFmpeg 5.1.6
|
main external API structure. More...
#include <libavcodec/avcodec.h>
Data Fields | |
const AVClass * | av_class |
information on struct for av_log More... | |
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'). More... | |
void * | priv_data |
struct AVCodecInternal * | internal |
Private context used for internal data. More... | |
void * | opaque |
Private data of the user, can be used to carry app specific stuff. More... | |
int64_t | bit_rate |
the average bitrate More... | |
int | bit_rate_tolerance |
number of bits the bitstream is allowed to diverge from the reference. More... | |
int | global_quality |
Global quality for codecs which cannot change it per frame. More... | |
int | compression_level |
int | flags |
AV_CODEC_FLAG_*. More... | |
int | flags2 |
AV_CODEC_FLAG2_*. More... | |
uint8_t * | extradata |
some codecs need / can use extradata like Huffman tables. More... | |
int | extradata_size |
AVRational | time_base |
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. More... | |
int | ticks_per_frame |
For some codecs, the time base is closer to the field rate than the frame rate. More... | |
int | delay |
Codec delay. More... | |
int | width |
picture width / height. More... | |
int | height |
int | coded_width |
Bitstream width / height, may be different from width/height e.g. More... | |
int | coded_height |
int | gop_size |
the number of pictures in a group of pictures, or 0 for intra_only More... | |
enum AVPixelFormat | pix_fmt |
Pixel format, see AV_PIX_FMT_xxx. More... | |
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. More... | |
enum AVPixelFormat(* | get_format )(struct AVCodecContext *s, const enum AVPixelFormat *fmt) |
Callback to negotiate the pixel format. More... | |
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. More... | |
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). More... | |
float | b_quant_offset |
qscale offset between IP and B-frames More... | |
int | has_b_frames |
Size of the frame reordering buffer in the decoder. More... | |
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). More... | |
float | i_quant_offset |
qscale offset between P and I-frames More... | |
float | lumi_masking |
luminance masking (0-> disabled) More... | |
float | temporal_cplx_masking |
temporary complexity masking (0-> disabled) More... | |
float | spatial_cplx_masking |
spatial complexity masking (0-> disabled) More... | |
float | p_masking |
p block masking (0-> disabled) More... | |
float | dark_masking |
darkness masking (0-> disabled) More... | |
int | slice_count |
slice count More... | |
int * | slice_offset |
slice offsets in the frame in bytes More... | |
AVRational | sample_aspect_ratio |
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel. More... | |
int | me_cmp |
motion estimation comparison function More... | |
int | me_sub_cmp |
subpixel motion estimation comparison function More... | |
int | mb_cmp |
macroblock comparison function (not supported yet) More... | |
int | ildct_cmp |
interlaced DCT comparison function More... | |
int | dia_size |
ME diamond size & shape. More... | |
int | last_predictor_count |
amount of previous MV predictors (2a+1 x 2a+1 square) More... | |
int | me_pre_cmp |
motion estimation prepass comparison function More... | |
int | pre_dia_size |
ME prepass diamond size & shape. More... | |
int | me_subpel_quality |
subpel ME quality More... | |
int | me_range |
maximum motion estimation search range in subpel units If 0 then no limit. More... | |
int | slice_flags |
slice flags More... | |
int | mb_decision |
macroblock decision mode More... | |
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(). More... | |
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(). More... | |
int | intra_dc_precision |
precision of the intra DC coefficient - 8 More... | |
int | skip_top |
Number of macroblock rows at the top which are skipped. More... | |
int | skip_bottom |
Number of macroblock rows at the bottom which are skipped. More... | |
int | mb_lmin |
minimum MB Lagrange multiplier More... | |
int | mb_lmax |
maximum MB Lagrange multiplier More... | |
int | bidir_refine |
int | keyint_min |
minimum GOP size More... | |
int | refs |
number of reference frames More... | |
int | mv0_threshold |
Note: Value depends upon the compare function used for fullpel ME. More... | |
enum AVColorPrimaries | color_primaries |
Chromaticity coordinates of the source primaries. More... | |
enum AVColorTransferCharacteristic | color_trc |
Color Transfer Characteristic. More... | |
enum AVColorSpace | colorspace |
YUV colorspace type. More... | |
enum AVColorRange | color_range |
MPEG vs JPEG YUV range. More... | |
enum AVChromaLocation | chroma_sample_location |
This defines the location of chroma samples. More... | |
int | slices |
Number of slices. More... | |
enum AVFieldOrder | field_order |
Field order. More... | |
int | sample_rate |
samples per second More... | |
attribute_deprecated int | channels |
number of audio channels More... | |
enum AVSampleFormat | sample_fmt |
audio sample format More... | |
int | frame_size |
Number of samples per channel in an audio frame. More... | |
int | frame_number |
Frame counter, set by libavcodec. More... | |
int | block_align |
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs. More... | |
int | cutoff |
Audio cutoff bandwidth (0 means "automatic") More... | |
attribute_deprecated uint64_t | channel_layout |
Audio channel layout. More... | |
attribute_deprecated uint64_t | request_channel_layout |
Request decoder to use this channel layout if it can (0 for default) More... | |
enum AVAudioServiceType | audio_service_type |
Type of service that the audio stream conveys. More... | |
enum AVSampleFormat | request_sample_fmt |
desired sample format More... | |
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. More... | |
float | qcompress |
amount of qscale change between easy & hard scenes (0.0-1.0) More... | |
float | qblur |
amount of qscale smoothing over time (0.0-1.0) More... | |
int | qmin |
minimum quantizer More... | |
int | qmax |
maximum quantizer More... | |
int | max_qdiff |
maximum quantizer difference between frames More... | |
int | rc_buffer_size |
decoder bitstream buffer size More... | |
int | rc_override_count |
ratecontrol override, see RcOverride More... | |
RcOverride * | rc_override |
int64_t | rc_max_rate |
maximum bitrate More... | |
int64_t | rc_min_rate |
minimum bitrate More... | |
float | rc_max_available_vbv_use |
Ratecontrol attempt to use, at maximum, of what can be used without an underflow. More... | |
float | rc_min_vbv_overflow_use |
Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. More... | |
int | rc_initial_buffer_occupancy |
Number of bits which should be loaded into the rc buffer before decoding starts. More... | |
int | trellis |
trellis RD quantization More... | |
char * | stats_out |
pass1 encoding statistics output buffer More... | |
char * | stats_in |
pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed here. More... | |
int | workaround_bugs |
Work around bugs in encoders which sometimes cannot be detected automatically. More... | |
int | strict_std_compliance |
strictly follow the standard (MPEG-4, ...). More... | |
int | error_concealment |
error concealment flags More... | |
int | debug |
debug More... | |
int | err_recognition |
Error recognition; may misdetect some more or less valid parts as errors. More... | |
int64_t | reordered_opaque |
opaque 64-bit number (generally a PTS) that will be reordered and output in AVFrame.reordered_opaque More... | |
const struct AVHWAccel * | hwaccel |
Hardware accelerator in use. More... | |
void * | hwaccel_context |
Hardware accelerator context. More... | |
uint64_t | error [AV_NUM_DATA_POINTERS] |
error More... | |
int | dct_algo |
DCT algorithm, see FF_DCT_* below. More... | |
int | idct_algo |
IDCT algorithm, see FF_IDCT_* below. More... | |
int | bits_per_coded_sample |
bits per sample/pixel from the demuxer (needed for huffyuv). More... | |
int | bits_per_raw_sample |
Bits per sample/pixel of internal libavcodec pixel/sample format. More... | |
int | lowres |
low resolution decoding, 1-> 1/2 size, 2->1/4 size More... | |
int | thread_count |
thread count is used to decide how many independent tasks should be passed to execute() More... | |
int | thread_type |
Which multithreading methods to use. More... | |
int | active_thread_type |
Which multithreading methods are in use by the codec. More... | |
attribute_deprecated int | thread_safe_callbacks |
Set by the client if its custom get_buffer() callback can be called synchronously from another thread, which allows faster multithreaded decoding. More... | |
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. More... | |
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. More... | |
int | nsse_weight |
noise vs. More... | |
int | profile |
profile More... | |
int | level |
level More... | |
enum AVDiscard | skip_loop_filter |
Skip loop filtering for selected frames. More... | |
enum AVDiscard | skip_idct |
Skip IDCT/dequantization for selected frames. More... | |
enum AVDiscard | skip_frame |
Skip decoding for selected frames. More... | |
uint8_t * | subtitle_header |
Header containing style information for text subtitles. More... | |
int | subtitle_header_size |
int | initial_padding |
Audio only. More... | |
AVRational | framerate |
enum AVPixelFormat | sw_pix_fmt |
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx. More... | |
AVRational | pkt_timebase |
Timebase in which pkt_dts/pts and AVPacket.dts/pts are. More... | |
const AVCodecDescriptor * | codec_descriptor |
AVCodecDescriptor. More... | |
int64_t | pts_correction_num_faulty_pts |
Current statistics for PTS correction. More... | |
int64_t | pts_correction_num_faulty_dts |
Number of incorrect PTS values so far. More... | |
int64_t | pts_correction_last_pts |
Number of incorrect DTS values so far. More... | |
int64_t | pts_correction_last_dts |
PTS of the last frame. More... | |
char * | sub_charenc |
DTS of the last frame. More... | |
int | sub_charenc_mode |
Subtitles character encoding mode. More... | |
int | skip_alpha |
Skip processing alpha if supported by codec. More... | |
int | seek_preroll |
Number of samples to skip after a discontinuity. More... | |
attribute_deprecated int | debug_mv |
uint16_t * | chroma_intra_matrix |
custom intra quantization matrix More... | |
uint8_t * | dump_separator |
dump format separator. More... | |
char * | codec_whitelist |
',' separated list of allowed decoders. More... | |
unsigned | properties |
Properties of the stream that gets decoded. More... | |
AVPacketSideData * | coded_side_data |
Additional data associated with the entire coded stream. More... | |
int | nb_coded_side_data |
AVBufferRef * | hw_frames_ctx |
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames. More... | |
attribute_deprecated int | sub_text_format |
int | trailing_padding |
Audio only. More... | |
int64_t | max_pixels |
The number of pixels per image to maximally accept. More... | |
AVBufferRef * | hw_device_ctx |
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/decoder. More... | |
int | hwaccel_flags |
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active). More... | |
int | apply_cropping |
Video decoding only. More... | |
int | extra_hw_frames |
int | discard_damaged_percentage |
The percentage of damaged samples to discard a frame. More... | |
int64_t | max_samples |
The number of samples per frame to maximally accept. More... | |
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. More... | |
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. More... | |
AVChannelLayout | ch_layout |
Audio channel layout. More... | |
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 397 of file avcodec.h.
Referenced by init_filter(), open_input_file(), and open_output_file().
const struct AVCodec* AVCodecContext::codec |
Definition at line 398 of file avcodec.h.
Referenced by decode_packet(), and open_audio().
enum AVCodecID AVCodecContext::codec_id |
Definition at line 399 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 |
struct AVCodecInternal* AVCodecContext::internal |
void* AVCodecContext::opaque |
int64_t AVCodecContext::bit_rate |
the average bitrate
Definition at line 439 of file avcodec.h.
Referenced by add_stream(), main(), and open_output_file().
int AVCodecContext::bit_rate_tolerance |
int AVCodecContext::global_quality |
int AVCodecContext::compression_level |
int AVCodecContext::flags |
AV_CODEC_FLAG_*.
Definition at line 469 of file avcodec.h.
Referenced by add_stream(), 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 490 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 512 of file avcodec.h.
Referenced by add_stream(), dec_enc(), encode_write_frame(), get_video_frame(), init_filter(), main(), open_output_file(), output_audio_frame(), write_audio_frame(), and write_frame().
int AVCodecContext::ticks_per_frame |
For some codecs, the time base is closer to the field rate than the frame rate.
Most notably, H.264 and MPEG-2 specify time_base as half of frame duration if no telecine is used ...
Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
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 562 of file avcodec.h.
Referenced by add_stream(), dec_enc(), get_video_frame(), init_filter(), init_filters(), main(), open_output_file(), and open_video().
int AVCodecContext::height |
Definition at line 562 of file avcodec.h.
Referenced by add_stream(), dec_enc(), get_video_frame(), init_filter(), init_filters(), 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.
int AVCodecContext::gop_size |
the number of pictures in a group of pictures, or 0 for intra_only
Definition at line 584 of file avcodec.h.
Referenced by add_stream(), and main().
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 599 of file avcodec.h.
Referenced by add_stream(), dec_enc(), get_video_frame(), init_filter(), init_filters(), main(), open_output_file(), and open_video().
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 624 of file avcodec.h.
Referenced by main(), 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 661 of file avcodec.h.
Referenced by add_stream(), and main().
float AVCodecContext::b_quant_factor |
float AVCodecContext::b_quant_offset |
int AVCodecContext::has_b_frames |
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::slice_count |
int* AVCodecContext::slice_offset |
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 759 of file avcodec.h.
Referenced by init_filter(), init_filters(), main(), and open_output_file().
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::slice_flags |
int AVCodecContext::mb_decision |
macroblock decision mode
Definition at line 862 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().
int AVCodecContext::intra_dc_precision |
int AVCodecContext::skip_top |
int AVCodecContext::skip_bottom |
int AVCodecContext::mb_lmin |
int AVCodecContext::mb_lmax |
int AVCodecContext::bidir_refine |
int AVCodecContext::keyint_min |
int AVCodecContext::refs |
int AVCodecContext::mv0_threshold |
enum AVColorPrimaries AVCodecContext::color_primaries |
enum AVColorTransferCharacteristic AVCodecContext::color_trc |
enum AVColorSpace AVCodecContext::colorspace |
enum AVColorRange AVCodecContext::color_range |
enum AVChromaLocation AVCodecContext::chroma_sample_location |
int AVCodecContext::slices |
enum AVFieldOrder AVCodecContext::field_order |
int AVCodecContext::sample_rate |
samples per second
Definition at line 998 of file avcodec.h.
Referenced by add_stream(), init_filter(), init_filters(), init_output_frame(), init_resampler(), main(), open_audio(), open_output_file(), and write_audio_frame().
attribute_deprecated int AVCodecContext::channels |
number of audio channels
enum AVSampleFormat AVCodecContext::sample_fmt |
audio sample format
Definition at line 1014 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(), and open_output_file().
int AVCodecContext::frame_size |
Number of samples per channel in an audio frame.
Definition at line 1026 of file avcodec.h.
Referenced by load_encode_and_write(), main(), and open_audio().
int AVCodecContext::frame_number |
Frame counter, set by libavcodec.
encoding: total number of frames passed to the encoder so far.
Definition at line 1037 of file avcodec.h.
Referenced by decode().
int AVCodecContext::block_align |
int AVCodecContext::cutoff |
attribute_deprecated uint64_t AVCodecContext::channel_layout |
Audio channel layout.
attribute_deprecated uint64_t AVCodecContext::request_channel_layout |
Request decoder to use this channel layout if it can (0 for default)
enum AVAudioServiceType AVCodecContext::audio_service_type |
enum AVSampleFormat AVCodecContext::request_sample_fmt |
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.
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 |
int64_t AVCodecContext::reordered_opaque |
opaque 64-bit number (generally a PTS) that will be reordered and output in AVFrame.reordered_opaque
const struct AVHWAccel* AVCodecContext::hwaccel |
void* AVCodecContext::hwaccel_context |
Hardware accelerator context.
For some hardware accelerators, a global context needs to be provided by the user. In that case, this holds display-dependent data FFmpeg cannot instantiate itself. Please refer to the FFmpeg HW accelerator documentation to know how to fill this.
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::lowres |
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 |
attribute_deprecated int AVCodecContext::thread_safe_callbacks |
Set by the client if its custom get_buffer() callback can be called synchronously from another thread, which allows faster multithreaded decoding.
draw_horiz_band() will be called from other threads regardless of this setting. Ignored if the default get_buffer() is used.
decoding: Set by user.
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::nsse_weight |
int AVCodecContext::profile |
int AVCodecContext::level |
enum AVDiscard AVCodecContext::skip_loop_filter |
enum AVDiscard AVCodecContext::skip_idct |
enum AVDiscard AVCodecContext::skip_frame |
uint8_t* AVCodecContext::subtitle_header |
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.
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.
AVRational AVCodecContext::framerate |
Definition at line 1732 of file avcodec.h.
Referenced by dec_enc(), main(), open_input_file(), and open_output_file().
enum AVPixelFormat AVCodecContext::sw_pix_fmt |
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
AVRational AVCodecContext::pkt_timebase |
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
Definition at line 1746 of file avcodec.h.
Referenced by open_input_file().
const AVCodecDescriptor* AVCodecContext::codec_descriptor |
int64_t AVCodecContext::pts_correction_num_faulty_pts |
int64_t AVCodecContext::pts_correction_num_faulty_dts |
int64_t AVCodecContext::pts_correction_last_pts |
int64_t AVCodecContext::pts_correction_last_dts |
char* AVCodecContext::sub_charenc |
int AVCodecContext::sub_charenc_mode |
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::seek_preroll |
attribute_deprecated int AVCodecContext::debug_mv |
uint16_t* AVCodecContext::chroma_intra_matrix |
uint8_t* AVCodecContext::dump_separator |
char* AVCodecContext::codec_whitelist |
unsigned AVCodecContext::properties |
AVPacketSideData* AVCodecContext::coded_side_data |
Additional data associated with the entire coded stream.
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 1880 of file avcodec.h.
Referenced by dec_enc(), main(), and set_hwframe_ctx().
attribute_deprecated int AVCodecContext::sub_text_format |
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.
int64_t AVCodecContext::max_pixels |
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 1930 of file avcodec.h.
Referenced by hw_decoder_init(), main(), and open_input_file().
int AVCodecContext::hwaccel_flags |
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
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::export_side_data |
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.
AVChannelLayout AVCodecContext::ch_layout |
Audio channel layout.
Definition at line 2056 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(), and open_output_file().