lavc: set avctx->hwaccel before init

So a hwaccel can access avctx->hwaccel in init for whatever reason. This
is for the new d3d hwaccel API. We could create separate entrypoints for
each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this
seems nicer.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
This commit is contained in:
wm4 2017-06-06 18:51:08 +02:00 committed by Diego Biurrun
parent fff90422d1
commit bd747b9226

View File

@ -746,16 +746,16 @@ static int setup_hwaccel(AVCodecContext *avctx,
return AVERROR(ENOMEM);
}
avctx->hwaccel = hwa;
if (hwa->init) {
ret = hwa->init(avctx);
if (ret < 0) {
av_freep(&avctx->internal->hwaccel_priv_data);
avctx->hwaccel = NULL;
return ret;
}
}
avctx->hwaccel = hwa;
return 0;
}