[FFmpeg-devel] [PATCH v2 3/3] lavc/libdavs2: correct frame type setting

Mark Thompson sw at jkqxz.net
Thu Nov 1 00:15:19 EET 2018


On 31/10/18 10:23, hwren wrote:
> Signed-off-by: hwren <hwrenx at 126.com>
> ---
>  libavcodec/libdavs2.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
> index a1815d2..d7bcaa3 100644
> --- a/libavcodec/libdavs2.c
> +++ b/libavcodec/libdavs2.c
> @@ -94,11 +94,26 @@ static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic,
>                     pic->widths[plane] * bytes_per_sample);
>      }
>  
> +    switch (pic->type) {
> +        case DAVS2_PIC_I:
> +            frame->pict_type = AV_PICTURE_TYPE_I;
> +            break;
> +        case DAVS2_PIC_P:
> +            frame->pict_type = AV_PICTURE_TYPE_P;
> +            break;
> +        case DAVS2_PIC_B:
> +        case DAVS2_PIC_F:
> +            frame->pict_type = AV_PICTURE_TYPE_B;
> +            break;
> +        default:
> +            frame->pict_type = AV_PICTURE_TYPE_NONE;

Are there any types which aren't already handled?  If there aren't then this would probably be better as an assert.

> +    }
> +
>      frame->width     = cad->headerset.width;
>      frame->height    = cad->headerset.height;
>      frame->pts       = cad->out_frame.pts;
> -    frame->pict_type = pic->type;
>      frame->format    = avctx->pix_fmt;
> +    frame->key_frame = pic->type == DAVS2_PIC_I ? 1 : 0;

Is an I frame in AVS2 necessarily a random access point?  (That is, not like an I frame in H.264, instead like an IDR frame - it clears the DPB so no previous reference frames can be carried across it.)

>  
>      return 1;
>  }
> 

Thanks

- Mark


More information about the ffmpeg-devel mailing list