42 #define CHECK_CHANNELS_CONSISTENCY(frame) \
43 av_assert2(!(frame)->channel_layout || \
44 (frame)->channels == \
45 av_get_channel_layout_nb_channels((frame)->channel_layout))
75 static const char *
const name[] = {
94 memset(frame, 0,
sizeof(*frame));
150 if (!frame || !*frame)
169 for(i=1; i<=
align; i+=i) {
174 if (!(frame->
linesize[0] & (align-1)))
178 for (i = 0; i < 4 && frame->
linesize[i]; i++)
182 for (i = 0; i < 4 && frame->
linesize[i]; i++) {
184 if (i == 1 || i == 2)
220 planes = planar ? channels : 1;
247 if (!frame->
buf[i]) {
292 #if FF_API_AVFRAME_LAVC
489 memset(src, 0,
sizeof(*src));
521 memset(&tmp, 0,
sizeof(tmp));
572 if (plane < 0 || plane >= planes || !frame->
extended_data[plane])
647 for (i = 0; i < planes; i++)
651 memcpy(src_data, src->
data,
sizeof(src_data));
663 int planes = planar ? channels : 1;
673 for (i = 0; i < planes; i++)
702 if (sd->
type == type) {
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
const char const char void * val
#define AV_NUM_DATA_POINTERS
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
attribute_deprecated int qscale_type
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder Code outside libavutil shou...
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
memory handling functions
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
void * opaque
for some private data of the user
int nb_extended_buf
Number of elements in extended_buf.
int repeat_pict
When decoding, this signals how much the picture must be delayed.
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above ...
int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type)
void av_frame_set_pkt_duration(AVFrame *frame, int64_t val)
static void wipe_side_data(AVFrame *frame)
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void av_frame_set_pkt_size(AVFrame *frame, int val)
int8_t * av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16.
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
attribute_deprecated int8_t * qscale_table
QP table.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
AVColorSpace
YUV colorspace type.
attribute_deprecated int qstride
QP store stride.
enum AVColorRange color_range
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
The data is the AVPanScan struct defined in libavcodec.
Structure to hold side data for an AVFrame.
AVDictionary * metadata
metadata.
int interlaced_frame
The content of the picture is interlaced.
void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val)
AVColorRange
MPEG vs JPEG YUV range.
Metadata relevant to a downmix procedure.
void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
AVFrameSideData ** side_data
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
int width
width and height of the video frame
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#define MAKE_ACCESSORS(str, name, type, field)
static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
ATSC A53 Part 4 Closed Captions.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
enum AVColorSpace colorspace
YUV colorspace type.
simple assert() macros that are a bit more flexible than ISO C assert().
static int get_audio_buffer(AVFrame *frame, int align)
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
reference-counted frame API
uint64_t channel_layout
Channel layout of the audio data.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int channels
number of audio channels, only used for audio.
audio channel layout utility functions
enum AVPictureType pict_type
Picture type of the frame.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
int display_picture_number
picture number in display order
AVBufferRef ** extended_buf
For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf.
#define FF_CEIL_RSHIFT(a, b)
#define AV_PIX_FMT_FLAG_PSEUDOPAL
The pixel format is "pseudo-paletted".
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
void av_frame_set_pkt_pos(AVFrame *frame, int64_t val)
AVBufferRef * qp_table_buf
Not to be accessed directly from outside libavutil.
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
int av_buffer_is_writable(const AVBufferRef *buf)
const char * av_get_colorspace_name(enum AVColorSpace val)
Get the name of a colorspace.
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
#define FF_ARRAY_ELEMS(a)
const AVS_VideoInfo int align
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
int coded_picture_number
picture number in bitstream order
uint64_t error[AV_NUM_DATA_POINTERS]
error
int64_t pkt_duration
duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown...
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
AVDictionary ** avpriv_frame_get_metadatap(AVFrame *frame)
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int get_video_buffer(AVFrame *frame, int align)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t * data
The data buffer.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
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.
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
If side data of the supplied type exists in the frame, free it and remove it from the frame...
int64_t reordered_opaque
reordered opaque 64bit (generally an integer or a double precision float PTS but can be anything)...
int sample_rate
Sample rate of the audio data.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
rational number numerator/denominator
int palette_has_changed
Tell user application that palette has changed from previous frame.
refcounted data buffer API
enum AVChromaLocation chroma_location
int64_t best_effort_timestamp
frame timestamp estimated using various heuristics, in stream time base Code outside libavutil should...
int decode_error_flags
decode error flags of the frame, set to a combination of FF_DECODE_ERROR_xxx flags if the decoder pro...
static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
const char * av_frame_side_data_name(enum AVFrameSideDataType type)
int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
int size
Size of data in bytes.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
enum AVFrameSideDataType type
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
A reference to a data buffer.
GLint GLenum GLboolean GLsizei stride
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal and external API header
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define CHECK_CHANNELS_CONSISTENCY(frame)
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
#define FF_ENABLE_DEPRECATION_WARNINGS
int top_field_first
If the content is interlaced, is top field displayed first.
int key_frame
1 -> keyframe, 0-> not
enum AVColorPrimaries color_primaries
static void * av_mallocz_array(size_t nmemb, size_t size)
static void free_side_data(AVFrameSideData **ptr_sd)
enum AVColorTransferCharacteristic color_trc
#define av_malloc_array(a, b)
enum AVColorSpace colorspace
ReplayGain information in the form of the AVReplayGain struct.
uint8_t ** extended_data
pointers to the data planes/channels.
static void get_frame_defaults(AVFrame *frame)
attribute_deprecated int type
int pkt_size
size of the corresponding packet containing the compressed frame.
Stereoscopic 3d metadata.
int nb_samples
number of audio samples (per channel) described by this frame
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_NOPTS_VALUE
Undefined timestamp value.