diff options
author | James Almer <jamrial@gmail.com> | 2020-09-12 17:39:45 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-09-12 17:39:45 -0300 |
commit | e46f34e85bf2306894fcaf7e3693dac7c29bc1d6 (patch) | |
tree | 2f747d1e168c2dfd7e9ca3b79355a985fd023b00 /libavcodec/av1dec.c | |
parent | 9c6026bc72905d40b6628fdbecba35bb1aceb8ce (diff) | |
download | ffmpeg-e46f34e85bf2306894fcaf7e3693dac7c29bc1d6.tar.gz |
avcodec/av1dec: fix setting pix_fmt
Fill the array with the software pix_fmt and move the avctx->hwaccel
check back to the proper place.
Also remove the avoid probing flag to ensure an external av1 decoder
will not set a pix_fmt we don't want during format probing.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r-- | libavcodec/av1dec.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 4a419d69d6..bd8acdaafe 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -257,18 +257,7 @@ static int get_pixel_format(AVCodecContext *avctx) int ret; enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; #define HWACCEL_MAX (0) - enum AVPixelFormat pix_fmts[HWACCEL_MAX + 1], *fmtp = pix_fmts; - - /** - * check if the HW accel is inited correctly. If not, return un-implemented. - * Since now the av1 decoder doesn't support native decode, if it will be - * implemented in the future, need remove this check. - */ - if (!avctx->hwaccel) { - av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport" - " hardware accelerated AV1 decoding.\n"); - return AVERROR(ENOSYS); - } + enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; if (seq->seq_profile == 2 && seq->color_config.high_bitdepth) bit_depth = seq->color_config.twelve_bit ? 12 : 10; @@ -328,12 +317,24 @@ static int get_pixel_format(AVCodecContext *avctx) return -1; s->pix_fmt = pix_fmt; + *fmtp++ = s->pix_fmt; *fmtp = AV_PIX_FMT_NONE; - avctx->sw_pix_fmt = s->pix_fmt; + ret = ff_thread_get_format(avctx, pix_fmts); if (ret < 0) return ret; + /** + * check if the HW accel is inited correctly. If not, return un-implemented. + * Since now the av1 decoder doesn't support native decode, if it will be + * implemented in the future, need remove this check. + */ + if (!avctx->hwaccel) { + av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport" + " hardware accelerated AV1 decoding.\n"); + return AVERROR(ENOSYS); + } + avctx->pix_fmt = ret; return 0; @@ -858,7 +859,7 @@ AVCodec ff_av1_decoder = { .init = av1_decode_init, .close = av1_decode_free, .decode = av1_decode_frame, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING, + .capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_SETS_PKT_DTS, |