【FFmpeg】解码时refcounted_frames标志的使用
生活随笔
收集整理的這篇文章主要介紹了
【FFmpeg】解码时refcounted_frames标志的使用
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1、refcounted_frames說明
在接口 avcodec_decode_video2 的注釋中,有關(guān)于 refcounted_frames 的詳細(xì)說明:
(1)當(dāng) AVCodecContext.refcounted_frames 被設(shè)置為1,該 AVFrame 被引用計(jì)數(shù),返回的引用屬于調(diào)用者。當(dāng)不再需要 AVFrame 時(shí),調(diào)用者必須使用 av_frame_unref() 來釋放frame。只有在 av_frame_is_writable() 返回1,調(diào)用者才可以向frame中寫入數(shù)據(jù)。
(2)當(dāng) AVCodecContext.refcounted_frames 被設(shè)置為0,返回的引用屬于解碼器,只有在下一次調(diào)用該函數(shù)或關(guān)閉或刷新解碼器之前有效。調(diào)用者不能向 AVFrame 中寫入數(shù)據(jù)。
2、啟動(dòng)該標(biāo)志,
在執(zhí)行打開編解碼器時(shí),用avcodec_open2設(shè)置:
//AVCodecContext *dec_ctx;//AVCodec *dec;AVDictionary *opts = NULL;int refcount
總結(jié)
以上是生活随笔為你收集整理的【FFmpeg】解码时refcounted_frames标志的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【FFmpeg】详解FFmpeg解封装、
- 下一篇: 【经验】如何查看gcc、g++不加-st