[FFmpeg-cvslog] avcodec/av1dec: fix setting pix_fmt
James Almer
git at videolan.org
Sat Sep 12 23:55:10 EEST 2020
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Sep 12 17:39:45 2020 -0300| [e46f34e85bf2306894fcaf7e3693dac7c29bc1d6] | committer: James Almer
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 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e46f34e85bf2306894fcaf7e3693dac7c29bc1d6
---
libavcodec/av1dec.c | 29 +++++++++++++++--------------
1 file 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,
More information about the ffmpeg-cvslog
mailing list