【目录】郭老二博文之:图像视频汇总
1、refcounted_frames说明
在接口 avcodec_decode_video2 的注释中,有关于 refcounted_frames 的详细说明:
(1)当 AVCodecContext.refcounted_frames 被设置为1,该 AVFrame 被引用计数,返回的引用属于调用者。当不再需要 AVFrame 时,调用者必须使用 av_frame_unref() 来释放frame。只有在 av_frame_is_writable() 返回1,调用者才可以向frame中写入数据。
(2)当 AVCodecContext.refcounted_frames 被设置为0,返回的引用属于解码器,只有在下一次调用该函数或关闭或刷新解码器之前有效。调用者不能向 AVFrame 中写入数据。
2、启动该标志,
在执行打开编解码器时,用avcodec_open2设置: