Browse code

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@gmx.at>

Michael Niedermayer authored on 2015/04/30 10:03:31
Showing 1 changed files
... ...
@@ -32,6 +32,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
32 32
     AVFrame *frame;
33 33
     int frame_decoded, ret = 0;
34 34
     AVPacket pkt;
35
+    AVDictionary *opt=NULL;
35 36
 
36 37
     av_init_packet(&pkt);
37 38
 
... ...
@@ -57,7 +58,8 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
57 57
         goto end;
58 58
     }
59 59
 
60
-    if ((ret = avcodec_open2(codec_ctx, codec, NULL)) < 0) {
60
+    av_dict_set(&opt, "thread_type", "slice", 0);
61
+    if ((ret = avcodec_open2(codec_ctx, codec, &opt)) < 0) {
61 62
         av_log(log_ctx, AV_LOG_ERROR, "Failed to open codec\n");
62 63
         goto end;
63 64
     }
... ...
@@ -97,6 +99,7 @@ end:
97 97
     avcodec_close(codec_ctx);
98 98
     avformat_close_input(&format_ctx);
99 99
     av_frame_free(&frame);
100
+    av_dict_free(&opt);
100 101
 
101 102
     if (ret < 0)
102 103
         av_log(log_ctx, AV_LOG_ERROR, "Error loading image file '%s'\n", filename);