[FFmpeg-cvslog] avfilter/lavfutils: disable frame threads when decoding a single image

Michael Niedermayer git at videolan.org
Thu May 21 21:25:50 CEST 2015


ffmpeg | branch: release/2.5 | Michael Niedermayer <michaelni at gmx.at> | Thu Apr 30 03:03:31 2015 +0200| [69f122abd9be9e0b51f81a061f4ae5fbe2bd021e] | committer: Michael Niedermayer

avfilter/lavfutils: disable frame threads when decoding a single image

The image decoding code does expect the image to be decoded immedeatly

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit d2184bf3b65354e44c177e226a6c59c5d6fdbad4)

Conflicts:

	libavfilter/lavfutils.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69f122abd9be9e0b51f81a061f4ae5fbe2bd021e
---

 libavfilter/lavfutils.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c
index 80310d2..095f84b 100644
--- a/libavfilter/lavfutils.c
+++ b/libavfilter/lavfutils.c
@@ -32,6 +32,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
     AVFrame *frame;
     int frame_decoded, ret = 0;
     AVPacket pkt;
+    AVDictionary *opt=NULL;
 
     av_init_packet(&pkt);
 
@@ -57,7 +58,8 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
         goto end;
     }
 
-    if ((ret = avcodec_open2(codec_ctx, codec, NULL)) < 0) {
+    av_dict_set(&opt, "thread_type", "slice", 0);
+    if ((ret = avcodec_open2(codec_ctx, codec, &opt)) < 0) {
         av_log(log_ctx, AV_LOG_ERROR, "Failed to open codec\n");
         goto end;
     }
@@ -97,6 +99,7 @@ end:
     avcodec_close(codec_ctx);
     avformat_close_input(&format_ctx);
     av_freep(&frame);
+    av_dict_free(&opt);
 
     if (ret < 0)
         av_log(log_ctx, AV_LOG_ERROR, "Error loading image file '%s'\n", filename);



More information about the ffmpeg-cvslog mailing list