# HG changeset patch # User reimar # Date 1376499251 0 # Node ID d334e70dc707780b71a980e1de2d8b2298b5f9be # Parent 9af6f39eab6122a7c9d289a04927c00b6687510d Leave it to FFmpeg to disable multithreading with hwaccel. This fixes multithreaded software decoding of e.g. H.264 again. diff -r 9af6f39eab61 -r d334e70dc707 libmpcodecs/vd_ffmpeg.c --- a/libmpcodecs/vd_ffmpeg.c Wed Aug 14 10:21:30 2013 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Wed Aug 14 16:54:11 2013 +0000 @@ -277,8 +277,6 @@ avctx->release_buffer = avcodec_default_release_buffer; } avctx->slice_flags = 0; - avctx->thread_count = lavc_param_threads; - avctx->thread_type = FF_THREAD_FRAME | FF_THREAD_SLICE; } static void set_format_params(struct AVCodecContext *avctx, @@ -293,12 +291,6 @@ vd_ffmpeg_ctx *ctx = sh->context; ctx->do_dr1 = 1; ctx->nonref_dr = 0; - // HACK: FFmpeg thread handling is a major mess and - // hinders any attempt to decide on hwaccel after the - // codec is open. We really want this to change, so - // just beat it until it's dead - avctx->thread_count = 1; - avctx->active_thread_type = 0; avctx->get_buffer = get_buffer; avctx->release_buffer = release_buffer; avctx->reget_buffer = get_buffer; @@ -482,6 +474,8 @@ if(lavc_codec->capabilities & CODEC_CAP_HWACCEL) // HACK around badly placed checks in mpeg_mc_decode_init set_format_params(avctx, PIX_FMT_XVMC_MPEG2_IDCT); + avctx->thread_count = lavc_param_threads; + avctx->thread_type = FF_THREAD_FRAME | FF_THREAD_SLICE; /* open it */ if (avcodec_open2(avctx, lavc_codec, &opts) < 0) {