/**该结构描述了解码的(原始)音频或视频数据。
*必须使用av_frame_alloc()(旧接口:avcodec_alloc_frame(),新接口:av_frame_alloc())分配AVFrame。请注意,这只是
*分配AVFrame本身,必须通过其他方式(见下文)管理数据的缓冲区;
*必须使用av_frame_free()释放AVFrame。
*
* AVFrame通常分配一次,然后多次重复使用以保存
*不同的数据(例如,单个AVFrame用于保存从一个解码器接收的帧)
*av_frame_unref()再次重复使用前将释放由其持有的任何引用框架并将其重置为之前的原始清洁状态
*一个AVFrame所描述的数据通常是通过参考AVBuffer API计算。内部的buffer引用存储在AVFrame.buf /AVFrame.extended_buf。
*AVFrame将用于引用计数,当至少一个引用被set时,如果AVFrame.buf[0] != NULL, 每个单个数据至少包含一个AVFrame.buf */AVFrame.extended_buf.可能会有一个缓冲的数据,或一个单独的缓冲对每个plane, 或介于两者之间的任何东西。
*sizeof(AVFrame)不是一个public的API,因此新的成员将被添加到末尾。同样字段标记为只访问av_opt_ptr()可以重新排序
*/
typedef struct AVFrame {
#define AV_NUM_DATA_POINTERS 8
/**
* pointer to the picture/channel planes.
* This might be different from the first allocated byte
*
* Some decoders access areas outside 0,0 - width,height, please
* see avcodec_align_dimensions2(). Some filters and swscale can read
* up to 16 bytes beyond the planes, if these filters are to be used,
* then 16 extra bytes must be allocated.
*/
uint8_t *data[AV_NUM_DATA_POINTERS];
/**
* For video, size in bytes of each picture line.
* For audio, size in bytes of each plane.
*
* For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size.
*
* For video the linesizes should be multiples of the CPUs alignment
* preference, this is 16 or 32 for modern desktop CPUs.
* Some code requires such alignment other code can be slower without
* correct alignment, for yet other it makes no difference.
*
* @note The linesize may be larger than the size of usable data -- there
* may be extra padding present for performance reasons.
*/
int linesize[AV_NUM_DATA_POINTERS];
/**
* pointers to the data planes/channels.
*
* For video, this should simply point to data[].
*
* For planar audio, each channel has a separate data pointer, and
* linesize[0] contains the size of each channel buffer.
* For packed audio, there is just one data pointer, and linesize[0]
* contains the total size of the buffer for all channels.
*
* Note: Both data and extended_data should always be set in a valid frame,
* but for planar audio with more channels that can fit in data,
* extended_data must be used in order to access all channels.
*/
uint8_t **extended_data;
/**
* width and height of the video frame
*/
int width, h

FFmpeg中的AVFrame是一个结构体,用于描述解码后的音频或视频数据。它包含了数据指针、行大小、宽高、样本数量、格式等信息。AVFrame通常分配一次并重复使用,用于保存不同解码器接收的帧。通过AVBuffer API进行内存管理,并通过av_frame_unref重置以备重复使用。对于视频,AVFrame包含宽度、高度、行大小和像素格式,对于音频,它包含样本数和声道布局。
最低0.47元/天 解锁文章
1129

被折叠的 条评论
为什么被折叠?



