History

avcodec/decode: split ProgressFrame allocator into two functions

James Almer committed 2 years ago

Commit dbbf9a51 parent a48eba02 files · +21 −6Browse files

Unified · Split

2 files
  1. libavcodec/decode.c +7 −4
  2. libavcodec/progressframe.h +14 −2
libavcodec/decode.c+7−4
@@ -1725,7 +1725,7 @@ static void check_progress_consistency(const ProgressFrame *f) · 1724 unmodified lines
1725 av_assert1(!f->progress || f->progress->f == f->f);1725 av_assert1(!f->progress || f->progress->f == f->f);
1726}1726}
1727 1727
1728static int progress_frame_get(AVCodecContext *avctx, ProgressFrame *f)1728int ff_progress_frame_alloc(AVCodecContext *avctx, ProgressFrame *f)
1729{1729{
1730 FFRefStructPool *pool = avctx->internal->progress_frame_pool;1730 FFRefStructPool *pool = avctx->internal->progress_frame_pool;
1731 1731
@@ -1743,9 +1743,12 @@ int ff_progress_frame_get_buffer(AVCodecContext *avctx, ProgressFrame *f, int fl · 11 unmodified lines
1743{1743{
1744 int ret;1744 int ret;
1745 1745
1746 ret = progress_frame_get(avctx, f);1746 check_progress_consistency(f);
1747 if (ret < 0)1747 if (!f->f) {
1748 return ret;1748 ret = ff_progress_frame_alloc(avctx, f);
1749 if (ret < 0)
1750 return ret;
1751 }
1749 1752
1750 ret = ff_thread_get_buffer(avctx, f->progress->f, flags);1753 ret = ff_thread_get_buffer(avctx, f->progress->f, flags);
1751 if (ret < 0) {1754 if (ret < 0) {
libavcodec/progressframe.h+14−2
@@ -102,12 +102,24 @@ void ff_progress_frame_report(ProgressFrame *f, int progress); · 101 unmodified lines
102void ff_progress_frame_await(const ProgressFrame *f, int progress);102void ff_progress_frame_await(const ProgressFrame *f, int progress);
103 103
104/**104/**
105 * This function sets up the ProgressFrame, i.e. gets ProgressFrame.f105 * This function allocates ProgressFrame.f
106 * and also calls ff_thread_get_buffer() on the frame.106 * May be called before ff_progress_frame_get_buffer() in the cases where the
107 * AVFrame needs to be accessed before the ff_thread_get_buffer() call in
108 * ff_progress_frame_alloc().
107 *109 *
108 * @note: This must only be called by codecs with the110 * @note: This must only be called by codecs with the
109 * FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.111 * FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.
110 */112 */
113int ff_progress_frame_alloc(struct AVCodecContext *avctx, ProgressFrame *f);
114
115/**
116 * This function sets up the ProgressFrame, i.e. allocates ProgressFrame.f
117 * if needed, and also calls ff_thread_get_buffer() on the frame.
118 *
119 * @note: This must only be called by codecs with the
120 * FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap.
121 * @see ff_progress_frame_alloc
122 */
111int ff_progress_frame_get_buffer(struct AVCodecContext *avctx,123int ff_progress_frame_get_buffer(struct AVCodecContext *avctx,
112 ProgressFrame *f, int flags);124 ProgressFrame *f, int flags);
113 125

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t