34 memset(frame, 0,
sizeof(*frame));
71 if (!frame || !*frame)
95 for (i = 0; i < 4 && frame->
linesize[i]; i++)
99 for (i = 0; i < 4 && frame->
linesize[i]; i++) {
101 if (i == 1 || i == 2)
130 int planes = planar ? channels : 1;
157 if (!frame->
buf[i]) {
305 memset(src, 0,
sizeof(*src));
336 memset(&tmp, 0,
sizeof(tmp));
427 if (plane < 0 || plane >= planes || !frame->
extended_data[plane])
433 if (data >= buf->
data && data < buf->data + buf->
size)
438 if (data >= buf->
data && data < buf->data + buf->
size)
499 for (i = 0; i < planes; i++)
503 memcpy(src_data, src->
data,
sizeof(src_data));
515 int planes = planar ? channels : 1;
522 for (i = 0; i < planes; i++)
551 if (sd->
type == type) {
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video data.
int nb_extended_buf
Number of elements in extended_buf.
int repeat_pict
When decoding, this signals how much the picture must be delayed.
uint8_t ** extended_data
pointers to the data planes/channels.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everythnig contained in src to dst and reset src.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
reference-counted frame API
static int frame_copy_video(AVFrame *dst, const AVFrame *src)
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
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).
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
AVFrameSideData ** side_data
int interlaced_frame
The content of the picture is interlaced.
#define AV_NUM_DATA_POINTERS
void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
#define AV_PIX_FMT_FLAG_PSEUDOPAL
The pixel format is "pseudo-paletted".
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.
void * opaque
for some private data of the user
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
enum AVColorRange color_range
void av_dict_free(AVDictionary **m)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
enum AVColorSpace colorspace
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.
uint64_t channel_layout
Channel layout of the audio data.
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
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...
audio channel layout utility functions
enum AVPictureType pict_type
Picture type of the frame.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
uint8_t * data
The data buffer.
refcounted data buffer API
int display_picture_number
picture number in display order
void * av_realloc(void *ptr, size_t size) 1(2)
Allocate or reallocate a block of memory.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define FF_ARRAY_ELEMS(a)
uint64_t error[AV_NUM_DATA_POINTERS]
error
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
int av_buffer_is_writable(const AVBufferRef *buf)
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.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
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
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
memory handling functions
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...
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...
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this 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.
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.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
enum AVChromaLocation chroma_location
static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
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.
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
A reference to a data buffer.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
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 free_side_data(AVFrameSideData **ptr_sd)
enum AVColorTransferCharacteristic color_trc
common internal and external API header
static void get_frame_defaults(AVFrame *frame)
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...