AVFrame *frame;
int frame_decoded, ret = 0;
AVPacket pkt;
+ AVDictionary *opt=NULL;
av_init_packet(&pkt);
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;
}
avcodec_close(codec_ctx);
avformat_close_input(&format_ctx);
av_frame_free(&frame);
+ av_dict_free(&opt);
if (ret < 0)
av_log(log_ctx, AV_LOG_ERROR, "Error loading image file '%s'\n", filename);