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 *
name[] = {
94 memset(frame, 0,
sizeof(*frame));
125 if (!frame || !*frame)
144 for(i=1; i<=
align; i+=i) {
149 if (!(frame->
linesize[0] & (align-1)))
153 for (i = 0; i < 4 && frame->
linesize[i]; i++)
157 for (i = 0; i < 4 && frame->
linesize[i]; i++) {
159 if (i == 1 || i == 2)
188 int planes = planar ? channels : 1;
216 if (!frame->
buf[i]) {
378 memset(src, 0,
sizeof(*src));
410 memset(&tmp, 0,
sizeof(tmp));
460 #if FF_API_AVFRAME_LAVC
527 if (plane < 0 || plane >= planes || !frame->
extended_data[plane])
533 if (data >= buf->
data && data < buf->data + buf->
size)
538 if (data >= buf->
data && data < buf->data + buf->
size)
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
const char const char void * val
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 av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video 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 libavcodec sho...
int nb_extended_buf
Number of elements in extended_buf.
int repeat_pict
When decoding, this signals how much the picture must be delayed.
int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type)
uint8_t ** extended_data
pointers to the data planes/channels.
void av_frame_set_pkt_duration(AVFrame *frame, int64_t val)
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
simple assert() macros that are a bit more flexible than ISO C assert().
attribute_deprecated int qstride
QP store stride.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
enum AVColorRange color_range
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.
int av_frame_ref(AVFrame *dst, AVFrame *src)
Setup a new reference to the data described by a given frame.
#define FF_CEIL_RSHIFT(a, b)
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.
AVFrameSideData ** side_data
int interlaced_frame
The content of the picture is interlaced.
#define AV_NUM_DATA_POINTERS
#define AV_PIX_FMT_FLAG_PSEUDOPAL
The pixel format is "pseudo-paletted".
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
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
#define MAKE_ACCESSORS(str, name, type, field)
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above ...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void av_dict_free(AVDictionary **m)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
enum AVColorSpace colorspace
YUV colorspace type.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static int get_audio_buffer(AVFrame *frame, int align)
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_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.
uint64_t channel_layout
Channel layout of the audio data.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
#define FF_ARRAY_ELEMS(a)
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
int channels
number of audio channels, only used for audio.
enum AVPictureType pict_type
Picture type of the frame.
uint8_t * data
The data buffer.
refcounted data buffer API
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
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_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val)
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 ...
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.
Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
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
AVBufferRef * qp_table_buf
Not to be accessed directly from outside libavutil.
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
int64_t pkt_duration
duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown...
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...
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everythnig contained in src to dst and reset src.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
void av_frame_set_pkt_pos(AVFrame *frame, int64_t val)
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.
rational number numerator/denominator
int palette_has_changed
Tell user application that palette has changed from previous frame.
int8_t * av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
AVDictionary ** avpriv_frame_get_metadatap(AVFrame *frame)
const char * av_get_colorspace_name(enum AVColorSpace val)
Get the name of a colorspace.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int64_t best_effort_timestamp
frame timestamp estimated using various heuristics, in stream time base Code outside libavcodec shoul...
int decode_error_flags
decode error flags of the frame, set to a combination of FF_DECODE_ERROR_xxx flags if the decoder pro...
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
int size
Size of data in bytes.
enum AVFrameSideDataType type
AVFrame * av_frame_clone(AVFrame *src)
Create a new frame that references the same data as src.
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
A reference to a data buffer.
#define CHECK_CHANNELS_CONSISTENCY(frame)
AVDictionary * metadata
metadata.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
attribute_deprecated int8_t * qscale_table
QP table.
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
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
void av_frame_set_pkt_size(AVFrame *frame, int val)
enum AVColorSpace colorspace
common internal and external API header
static void get_frame_defaults(AVFrame *frame)
attribute_deprecated int type
int pkt_size
size of the corresponding packet containing the compressed 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.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
#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 ...