【FFmpeg】解码时refcounted_frames标志的使用
生活随笔
收集整理的這篇文章主要介紹了
【FFmpeg】解码时refcounted_frames标志的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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設置:
//AVCodecContext *dec_ctx;//AVCodec *dec;AVDictionary *opts = NULL;int refcount
總結
以上是生活随笔為你收集整理的【FFmpeg】解码时refcounted_frames标志的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【FFmpeg】详解FFmpeg解封装、
- 下一篇: 【经验】如何查看gcc、g++不加-st