Go to the documentation of this file.
66 "changes, but PARAM_CHANGE side data was sent to it.\n");
77 #if FF_API_OLD_CHANNEL_LAYOUT
79 if (
flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
82 val = bytestream_get_le32(&
data);
83 if (val <= 0 || val > INT_MAX) {
88 avctx->channels =
val;
91 if (
flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
94 avctx->channel_layout = bytestream_get_le64(&
data);
102 val = bytestream_get_le32(&
data);
103 if (val <= 0 || val > INT_MAX) {
114 avctx->
width = bytestream_get_le32(&
data);
224 int64_t reordered_pts, int64_t dts)
229 ctx->pts_correction_num_faulty_dts += dts <=
ctx->pts_correction_last_dts;
230 ctx->pts_correction_last_dts = dts;
232 ctx->pts_correction_last_dts = reordered_pts;
235 ctx->pts_correction_num_faulty_pts += reordered_pts <=
ctx->pts_correction_last_pts;
236 ctx->pts_correction_last_pts = reordered_pts;
238 ctx->pts_correction_last_pts = dts;
240 if ((
ctx->pts_correction_num_faulty_pts<=
ctx->pts_correction_num_faulty_dts || dts ==
AV_NOPTS_VALUE)
260 int got_frame, actual_got_frame;
303 actual_got_frame = got_frame;
311 uint32_t discard_padding = 0;
312 uint8_t skip_reason = 0;
313 uint8_t discard_reason = 0;
315 if (
ret >= 0 && got_frame) {
318 if (!
frame->ch_layout.nb_channels) {
325 #if FF_API_OLD_CHANNEL_LAYOUT
327 if (!
frame->channel_layout)
330 if (!
frame->channels)
334 if (!
frame->sample_rate)
339 if(side && side_size>=10) {
342 discard_padding =
AV_RL32(side + 4);
345 skip_reason =
AV_RL8(side + 8);
346 discard_reason =
AV_RL8(side + 9);
353 *discarded_samples +=
frame->nb_samples;
360 *discarded_samples +=
frame->nb_samples;
372 frame->pts += diff_ts;
374 frame->pkt_dts += diff_ts;
375 if (
frame->duration >= diff_ts)
376 frame->duration -= diff_ts;
388 if (discard_padding > 0 && discard_padding <= frame->nb_samples && got_frame &&
390 if (discard_padding ==
frame->nb_samples) {
391 *discarded_samples +=
frame->nb_samples;
398 frame->duration = diff_ts;
403 (
int)discard_padding,
frame->nb_samples);
404 frame->nb_samples -= discard_padding;
435 if (avci->
draining && !actual_got_frame) {
444 "Stop draining and force EOF.\n");
490 if (!sd || !sd->
size)
493 if (!avci->icc.avctx) {
512 frame->color_primaries = prim;
514 frame->color_trc = trc;
527 int64_t discarded_samples = 0;
529 while (!
frame->buf[0]) {
568 #if FF_API_PKT_DURATION
579 if (
frame->private_ref) {
609 if (avpkt && !avpkt->
size && avpkt->
data)
637 if (
frame->crop_left >= INT_MAX -
frame->crop_right ||
638 frame->crop_top >= INT_MAX -
frame->crop_bottom ||
642 "Invalid cropping information set by a decoder: "
644 "(frame size %dx%d). This is a bug, please report it\n",
647 frame->crop_left = 0;
648 frame->crop_right = 0;
650 frame->crop_bottom = 0;
674 frame->sample_rate <= 0)
684 "This is a bug, please report it.\n");
715 #if FF_API_AVCTX_FRAME_NUMBER
758 " drop count: %d \n",
774 memset(
sub, 0,
sizeof(*
sub));
778 #define UTF8_MAX_BYTES 4
783 iconv_t cd = (iconv_t)-1;
812 outb = buf_pkt->
data;
813 outl = buf_pkt->
size;
815 if (iconv(cd, &inb, &inl, &outb, &outl) == (
size_t)-1 ||
816 iconv(cd,
NULL,
NULL, &outb, &outl) == (
size_t)-1 ||
817 outl >= buf_pkt->
size || inl != 0) {
823 buf_pkt->
size -= outl;
824 memset(buf_pkt->
data + buf_pkt->
size, 0, outl);
831 if (cd != (iconv_t)-1)
843 uint32_t codepoint,
min;
847 GET_UTF8(codepoint, *(
byte++),
return 0;);
848 min =
byte -
str == 1 ? 0 :
byte -
str == 2 ? 0x80 :
849 1 << (5 * (
byte -
str) - 4);
850 if (codepoint < min || codepoint >= 0x110000 ||
851 codepoint == 0xFFFE ||
852 codepoint >= 0xD800 && codepoint <= 0xDFFF )
860 int *got_sub_ptr,
const AVPacket *avpkt)
899 if (
sub->num_rects && !
sub->end_display_time && avpkt->
duration &&
911 for (
unsigned i = 0;
i <
sub->num_rects;
i++) {
915 "Invalid UTF-8 in decoded subtitles text; "
916 "maybe missing -sub_charenc option\n");
925 #if FF_API_AVCTX_FRAME_NUMBER
957 if (
config->pix_fmt == fmt[n])
980 if (
config->pix_fmt == fmt[n])
1012 "required for hardware accelerated decoding.\n");
1017 if (device_ctx->
type != dev_type) {
1091 *out_frames_ref = frames_ref;
1120 if (hwaccel->
init) {
1121 err = hwaccel->
init(avctx);
1124 "hwaccel initialisation returned error.\n",
1168 choices =
av_memdup(fmt, (n + 1) *
sizeof(*choices));
1176 user_choice = avctx->
get_format(avctx, choices);
1186 "get_format() callback.\n");
1193 for (
i = 0;
i < n;
i++) {
1194 if (choices[
i] == user_choice)
1199 "%s not in possible list.\n",
desc->name);
1228 if (frames_ctx->
format != user_choice) {
1230 "does not match the format of the provided frames "
1231 "context.\n",
desc->name);
1234 }
else if (
config->methods &
1241 "does not match the type of the provided device "
1242 "context.\n",
desc->name);
1245 }
else if (
config->methods &
1248 }
else if (
config->methods &
1253 "missing configuration.\n",
desc->name);
1258 "initialisation.\n",
desc->name);
1268 "get_format() without it.\n",
desc->name);
1269 for (
i = 0;
i < n;
i++) {
1270 if (choices[
i] == user_choice)
1273 for (;
i + 1 < n;
i++)
1274 choices[
i] = choices[
i + 1];
1285 const uint8_t *side_metadata;
1297 static const struct {
1329 memcpy(frame_sd->
data, packet_sd,
size);
1360 #if FF_API_REORDERED_OPAQUE
1362 frame->reordered_opaque = avctx->reordered_opaque;
1380 if (!
frame->sample_aspect_ratio.num)
1385 frame->sample_aspect_ratio) < 0) {
1387 frame->sample_aspect_ratio.num,
1388 frame->sample_aspect_ratio.den);
1394 if (!
frame->sample_rate)
1396 if (
frame->format < 0)
1398 if (!
frame->ch_layout.nb_channels) {
1403 #if FF_API_OLD_CHANNEL_LAYOUT
1405 frame->channels =
frame->ch_layout.nb_channels;
1407 frame->ch_layout.u.mask : 0;
1424 for (
i = 0;
i < num_planes;
i++) {
1430 av_log(avctx,
AV_LOG_ERROR,
"Buffer returned by get_buffer2() did not zero unused plane pointers\n");
1468 frame->private_ref = fdd_buf;
1476 int override_dimensions = 1;
1489 if (
frame->width <= 0 ||
frame->height <= 0) {
1492 override_dimensions = 0;
1501 #if FF_API_OLD_CHANNEL_LAYOUT
1562 av_log(avctx,
AV_LOG_WARNING,
"Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
1567 if (!
frame->data[0])
1616 "supported with subtitles codecs\n");
1620 "subtitles character encoding will be ignored\n",
1631 iconv_t cd = iconv_open(
"UTF-8", avctx->
sub_charenc);
1632 if (cd == (iconv_t)-1) {
1635 "with input character encoding \"%s\"\n", avctx->
sub_charenc);
1641 "conversion needs a libavcodec built with iconv support "
1642 "for this codec\n");
1657 "gray decoding requested but not enabled at configuration time\n");
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define FF_ENABLE_DEPRECATION_WARNINGS
int(* receive_frame)(struct AVCodecContext *avctx, struct AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
AVCodecParameters * par_in
Parameters of the input stream.
#define AV_LOG_WARNING
Something somehow does not look correct.
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
static enum AVPixelFormat hw_pix_fmt
AVPixelFormat
Pixel format.
#define AV_EF_EXPLODE
abort decoding on minor error detection
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVPixelFormat(* get_format)(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
Callback to negotiate the pixel format.
int ff_icc_profile_read_primaries(FFIccContext *s, cmsHPROFILE profile, AVColorPrimariesDesc *out_primaries)
Read the color primaries and white point coefficients encoded by an ICC profile, and return the raw v...
enum AVColorSpace colorspace
YUV colorspace type.
AVColorTransferCharacteristic
Color Transfer Characteristic.
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
int sample_rate
samples per second
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Struct that contains both white point location and primaries location, providing the complete descrip...
static float sub(float src0, float src1)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AVERROR_EOF
End of file.
uint8_t * data
The data buffer.
#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL
HWAccel is experimental and is thus avoided in favor of non experimental codecs.
@ AV_FRAME_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
@ AV_CODEC_HW_CONFIG_METHOD_INTERNAL
The codec supports this format by some internal method.
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
int skip_samples
Number of audio samples to skip at the start of the next decoded frame.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define AV_CODEC_FLAG_UNALIGNED
Allow decoders to produce frames with data planes that are not aligned to CPU requirements (e....
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
const char * name
Name of the codec described by this descriptor.
static int decode_simple_receive_frame(AVCodecContext *avctx, AVFrame *frame)
@ AV_FRAME_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This struct stores per-frame lavc-internal data and is attached to it via private_ref.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
This structure describes decoded (raw) audio or video data.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
int capabilities
Codec capabilities.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
int capabilities
Hardware accelerated codec capabilities.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
uint8_t * subtitle_header
Header containing style information for text subtitles.
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
void(* hwaccel_priv_free)(void *priv)
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
#define FF_SUB_CHARENC_MODE_PRE_DECODER
the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
enum AVChannelOrder order
Channel order used in this layout.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx, const enum AVPixelFormat *fmt)
int avcodec_is_open(AVCodecContext *s)
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
int nb_channels
Number of channels in this layout.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
#define FF_SUB_CHARENC_MODE_AUTOMATIC
libavcodec will select the mode itself
int av_frame_apply_cropping(AVFrame *frame, int flags)
Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
uint8_t max_lowres
maximum value for lowres supported by the decoder
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
#define AV_CODEC_FLAG_COPY_OPAQUE
const struct AVCodec * codec
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user.
AVChannelLayout ch_layout
Audio channel layout.
int showed_multi_packet_warning
int ff_icc_context_init(FFIccContext *s, void *avctx)
Initializes an FFIccContext.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
#define FF_SUB_CHARENC_MODE_DO_NOTHING
do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for inst...
int flags
AV_CODEC_FLAG_*.
static double val(void *priv, double ch)
void(* post_process_opaque_free)(void *opaque)
int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt)
Set various frame properties from the provided packet.
static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
static int64_t guess_correct_pts(AVCodecContext *ctx, int64_t reordered_pts, int64_t dts)
Attempt to guess proper monotonic timestamps for decoded video frames which might have incorrect time...
int64_t max_samples
The number of samples per frame to maximally accept.
int priv_data_size
Size of the private data to allocate in AVCodecInternal.hwaccel_priv_data.
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
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.
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
Decode a subtitle message.
#define AV_CODEC_FLAG_DROPCHANGED
Don't output frames whose parameters differ from first decoded frame in stream.
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
int64_t pts_correction_num_faulty_pts
Current statistics for PTS correction.
int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
avcodec_receive_frame() implementation for decoders.
static void hwaccel_uninit(AVCodecContext *avctx)
int(* alloc_frame)(AVCodecContext *avctx, AVFrame *frame)
Allocate a custom buffer.
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
int has_b_frames
Size of the frame reordering buffer in the decoder.
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
@ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX
The codec supports this format via the hw_frames_ctx interface.
static void get_subtitle_defaults(AVSubtitle *sub)
void * post_process_opaque
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
AVPacket * buffer_pkt
Temporary buffers for newly received or not yet output packets/frames.
#define AV_CEIL_RSHIFT(a, b)
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AVERROR_INPUT_CHANGED
Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
@ AV_FRAME_DATA_AUDIO_SERVICE_TYPE
This side data must be associated with an audio frame and corresponds to enum AVAudioServiceType defi...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVRational time_base_in
The timebase used for the timestamps of the input packets.
@ AV_PKT_DATA_DYNAMIC_HDR10_PLUS
HDR10+ dynamic metadata associated with a video frame.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
enum AVPixelFormat pix_fmt
For decoders, a hardware pixel format which that decoder may be able to decode to if suitable hardwar...
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm)
Detects which enum AVColorPrimaries constant corresponds to the given complete gamut description.
int64_t max_pixels
The number of pixels per image to maximally accept.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
void * opaque
for some private data of the user
int(* decode)(struct AVCodecContext *avctx, struct AVFrame *frame, int *got_frame_ptr, struct AVPacket *avpkt)
Decode to an AVFrame.
static void decode_data_free(void *opaque, uint8_t *data)
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
int changed_frames_dropped
char * sub_charenc
DTS of the last frame.
#define AV_CODEC_FLAG2_SKIP_MANUAL
Do not skip samples and export skip information as frame side data.
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
static int utf8_check(const uint8_t *str)
@ AV_FRAME_DATA_SPHERICAL
The data represents the AVSphericalMapping structure defined in libavutil/spherical....
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int apply_cropping
Video decoding only.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
Rational number (pair of numerator and denominator).
struct AVCodecInternal * internal
Private context used for internal data.
#define AV_CODEC_PROP_BITMAP_SUB
Subtitle codec is bitmap based Decoded AVSubtitle data can be read from the AVSubtitleRect->pict fiel...
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
#define AV_CODEC_FLAG2_ICC_PROFILES
Generate/parse ICC profiles on encode/decode, as appropriate for the type of file.
int ff_icc_profile_detect_transfer(FFIccContext *s, cmsHPROFILE profile, enum AVColorTransferCharacteristic *out_trc)
Attempt detecting the transfer characteristic that best approximates the transfer function encoded by...
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
@ AVCOL_RANGE_UNSPECIFIED
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
AVPacket * last_pkt_props
Properties (timestamps+side data) extracted from the last packet passed for decoding.
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
int av_codec_is_decoder(const AVCodec *codec)
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
int flags2
AV_CODEC_FLAG2_*.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
@ AV_FRAME_DATA_REPLAYGAIN
ReplayGain information in the form of the AVReplayGain struct.
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)
Submit a new frame to a decoding thread.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
int(* post_process)(void *logctx, AVFrame *frame)
The callback to perform some delayed processing on the frame right before it is returned to the calle...
void * hwaccel_priv_data
hwaccel-specific private data
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define FF_CODEC_CAP_SETS_FRAME_PROPS
Codec handles output frame properties internally instead of letting the internal logic derive them fr...
struct AVBSFContext * bsf
enum AVSampleFormat sample_fmt
audio sample format
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
#define FF_CODEC_CAP_EXPORTS_CROPPING
The decoder sets the cropping fields in the output frames manually.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int frame_validate(AVCodecContext *avctx, AVFrame *frame)
static const av_always_inline FFCodec * ffcodec(const AVCodec *codec)
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
@ AVCHROMA_LOC_UNSPECIFIED
int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict)
Unpack a dictionary from side_data.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int64_t pts_correction_num_faulty_dts
Number of incorrect PTS values so far.
int64_t pts_correction_last_pts
Number of incorrect DTS values so far.
static int hwaccel_init(AVCodecContext *avctx, const AVCodecHWConfigInternal *hw_config)
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
int flags
A combination of AV_PKT_FLAG values.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
const struct AVCodecHWConfigInternal *const * hw_configs
Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported...
static int detect_colorspace(av_unused AVCodecContext *c, av_unused AVFrame *f)
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
#define AV_LOG_INFO
Standard information.
#define FF_THREAD_FRAME
Decode more than one frame at once.
@ AV_FRAME_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
const char * name
Name of the hardware accelerated codec.
int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Copy samples from src to dst.
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt)
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
AVPacket * in_pkt
This packet is used to hold the packet given to decoders implementing the .decode API; it is unused b...
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
@ AV_PKT_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
int64_t pts_correction_last_dts
PTS of the last frame.
int ff_decode_preinit(AVCodecContext *avctx)
Perform decoder initialization and validation.
@ AV_FRAME_DATA_STEREO3D
Stereoscopic 3d metadata.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, int64_t *discarded_samples)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
int(* decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub, int *got_frame_ptr, const struct AVPacket *avpkt)
Decode subtitle data to an AVSubtitle.
int sub_charenc_mode
Subtitles character encoding mode.
This struct describes a set or pool of "hardware" frames (i.e.
int64_t frame_num
Frame counter, set by libavcodec.
int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, AVBufferRef *device_ref, enum AVPixelFormat hw_pix_fmt, AVBufferRef **out_frames_ref)
Create and return a AVHWFramesContext with values adequate for hardware decoding.
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
@ AV_CODEC_HW_CONFIG_METHOD_AD_HOC
The codec supports this format by some ad-hoc method.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
#define AV_CODEC_PROP_TEXT_SUB
Subtitle codec is text based.
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
@ AV_PKT_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1:2014.
#define AV_INPUT_BUFFER_PADDING_SIZE
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
Set various frame properties from the codec context / packet data.
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
main external API structure.
int active_thread_type
Which multithreading methods are in use by the codec.
const AVCodecDescriptor * codec_descriptor
AVCodecDescriptor.
static int recode_subtitle(AVCodecContext *avctx, const AVPacket **outpkt, const AVPacket *inpkt, AVPacket *buf_pkt)
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
@ FF_CODEC_CB_TYPE_RECEIVE_FRAME
unsigned cb_type
This field determines the type of the codec (decoder/encoder) and also the exact callback cb implemen...
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
#define AV_CODEC_CAP_PARAM_CHANGE
Codec supports changed parameters at any point.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
int draining
checks API usage: after codec draining, flush is required to resume operation
const char * bsfs
Decoding only, a comma-separated list of bitstream filters to apply to packets before decoding.
#define FF_DISABLE_DEPRECATION_WARNINGS
int coded_width
Bitstream width / height, may be different from width/height e.g.
int initial_pool_size
Initial size of the frame pool.
enum AVMediaType codec_type
#define AV_FRAME_FLAG_DISCARD
A flag to mark the frames which need to be decoded, but shouldn't be output.
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
A reference to a data buffer.
#define AV_CODEC_EXPORT_DATA_MVS
Export motion vectors through frame side data.
#define AV_CODEC_CAP_SUBFRAMES
Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time,...
int ff_attach_decode_data(AVFrame *frame)
@ AV_FRAME_CROP_UNALIGNED
Apply the maximum possible cropping, even if it requires setting the AVFrame.data[] entries to unalig...
AVChannelLayout initial_ch_layout
Structure to hold side data for an AVFrame.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AV_CODEC_FLAG2_EXPORT_MVS
Export motion vectors through frame side data.
This structure stores compressed data.
int(* frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Fill the given hw_frames context with current codec parameters.
int64_t pos
byte position in stream, -1 if unknown
int width
picture width / height.
void * hwaccel_priv
Per-frame private data for hwaccels.
attribute_deprecated int frame_number
Frame counter, set by libavcodec.
#define flags(name, subs,...)
union AVChannelLayout::@314 u
Details about which channels are present in this layout.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
const AVHWAccel * hwaccel
If this configuration uses a hwaccel, a pointer to it.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
Check if the given sample aspect ratio of an image is valid.
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
Check whether the side-data of src contains a palette of size AVPALETTE_SIZE; if so,...
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
static int decode_bsfs_init(AVCodecContext *avctx)
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
enum AVPixelFormat pix_fmt
Supported pixel format.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
#define FF_REGET_BUFFER_FLAG_READONLY
the returned buffer does not need to be writable
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
#define FF_SUB_CHARENC_MODE_IGNORE
neither convert the subtitles, nor check them for valid UTF-8