Message ID | 20210414001413.4149-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 8b954a727a74c5adaea9d8a1fc490c12cd4e0db8 |
Headers | show |
Series | [FFmpeg-devel] avcodec/libaomdec: export frame pict_type | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On 4/13/2021 9:14 PM, James Almer wrote: > Should fix ticket #9180 > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/libaomdec.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c > index 1fc0a0001d..6de3bcc5c3 100644 > --- a/libavcodec/libaomdec.c > +++ b/libavcodec/libaomdec.c > @@ -161,6 +161,7 @@ static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame, > AVFrame *picture = data; > const void *iter = NULL; > struct aom_image *img; > + aom_codec_frame_flags_t av_unused flags; > int ret; > > if (aom_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL) != > @@ -198,6 +199,19 @@ 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 > + 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, Will apply.
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c index 1fc0a0001d..6de3bcc5c3 100644 --- a/libavcodec/libaomdec.c +++ b/libavcodec/libaomdec.c @@ -161,6 +161,7 @@ static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame, AVFrame *picture = data; const void *iter = NULL; struct aom_image *img; + aom_codec_frame_flags_t av_unused flags; int ret; if (aom_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL) != @@ -198,6 +199,19 @@ 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 + 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,
Should fix ticket #9180 Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/libaomdec.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)