X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flibaomdec.c;h=6e7324a832fddaac0a609558d454d0b8ce919a9e;hb=a247ac640df3da573cd661065bf53f37863e2b46;hp=a72ac984e72a9f7ea24227d79c1d9ce9f66e975c;hpb=a024c3ce9a502849013a4aa2c0a6de0c9270261c;p=ffmpeg diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c index a72ac984e72..6e7324a832f 100644 --- a/libavcodec/libaomdec.c +++ b/libavcodec/libaomdec.c @@ -197,6 +197,30 @@ static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame, } if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) return ret; + +#ifdef AOM_CTRL_AOMD_GET_FRAME_FLAGS + { + aom_codec_frame_flags_t flags; + ret = aom_codec_control(&ctx->decoder, AOMD_GET_FRAME_FLAGS, &flags); + if (ret == AOM_CODEC_OK) { + picture->key_frame = !!(flags & AOM_FRAME_IS_KEY); + if (flags & (AOM_FRAME_IS_KEY | AOM_FRAME_IS_INTRAONLY)) + picture->pict_type = AV_PICTURE_TYPE_I; + else if (flags & AOM_FRAME_IS_SWITCH) + picture->pict_type = AV_PICTURE_TYPE_SP; + else + picture->pict_type = AV_PICTURE_TYPE_P; + } + } +#endif + + av_reduce(&picture->sample_aspect_ratio.num, + &picture->sample_aspect_ratio.den, + picture->height * img->r_w, + picture->width * img->r_h, + INT_MAX); + ff_set_sar(avctx, picture->sample_aspect_ratio); + if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8) image_copy_16_to_8(picture, img); else @@ -219,7 +243,7 @@ static av_cold int av1_init(AVCodecContext *avctx) return aom_init(avctx, &aom_codec_av1_dx_algo); } -AVCodec ff_libaom_av1_decoder = { +const AVCodec ff_libaom_av1_decoder = { .name = "libaom-av1", .long_name = NULL_IF_CONFIG_SMALL("libaom AV1"), .type = AVMEDIA_TYPE_VIDEO, @@ -228,7 +252,8 @@ AVCodec ff_libaom_av1_decoder = { .init = av1_init, .close = aom_free, .decode = aom_decode, - .capabilities = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_AUTO_THREADS, .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), .wrapper_name = "libaom", };