[FFmpeg-devel] [PATCH 1/2] avcodec/rawdec: Support CODEC_CAP_PARAM_CHANGE

Michael Niedermayer michaelni at gmx.at
Tue Sep 2 13:36:59 CEST 2014


On Tue, Sep 02, 2014 at 08:44:47AM +0000, Paul B Mahol wrote:
> On 9/2/14, Michael Niedermayer <michaelni at gmx.at> wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavcodec/rawdec.c |   30 ++++++++++++++++--------------
> >  1 file changed, 16 insertions(+), 14 deletions(-)
> >
> > diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
> > index 305c13e..28792a1 100644
> > --- a/libavcodec/rawdec.c
> > +++ b/libavcodec/rawdec.c
> > @@ -98,19 +98,6 @@ static av_cold int raw_init_decoder(AVCodecContext
> > *avctx)
> >              memset(context->palette->data, 0, AVPALETTE_SIZE);
> >      }
> >
> > -    if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample
> > == 2) &&
> > -        avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
> > -       (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ')))
> > {
> > -        context->is_2_4_bpp = 1;
> > -        context->frame_size = avpicture_get_size(avctx->pix_fmt,
> > -                                                 FFALIGN(avctx->width,
> > 16),
> > -                                                 avctx->height);
> > -    } else {
> > -        context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 &&
> > avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
> > -        context->frame_size = avpicture_get_size(avctx->pix_fmt,
> > avctx->width,
> > -                                                 avctx->height);
> > -    }
> > -
> >      if ((avctx->extradata_size >= 9 &&
> >           !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp",
> > 9)) ||
> >          avctx->codec_tag == MKTAG('c','y','u','v') ||
> > @@ -168,11 +155,25 @@ static int raw_decode(AVCodecContext *avctx, void
> > *data, int *got_frame,
> >      int buf_size                   = avpkt->size;
> >      int linesize_align             = 4;
> >      int res, len;
> > -    int need_copy                  = !avpkt->buf || context->is_2_4_bpp ||
> > context->is_yuv2 || context->is_lt_16bpp;
> > +    int need_copy;
> >
> >      AVFrame   *frame   = data;
> >      AVPicture *picture = data;
> >
> > +    if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample
> > == 2) &&
> > +        avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
> > +       (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ')))
> > {
> > +        context->is_2_4_bpp = 1;
> > +        context->frame_size = avpicture_get_size(avctx->pix_fmt,
> > +                                                 FFALIGN(avctx->width,
> > 16),
> > +                                                 avctx->height);
> > +    } else {
> > +        context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 &&
> > avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
> > +        context->frame_size = avpicture_get_size(avctx->pix_fmt,
> > avctx->width,
> > +                                                 avctx->height);
> > +    }
> > +    need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 ||
> > context->is_lt_16bpp;
> > +
> >      frame->pict_type        = AV_PICTURE_TYPE_I;
> >      frame->key_frame        = 1;
> >
> > @@ -368,4 +369,5 @@ AVCodec ff_rawvideo_decoder = {
> >      .close          = raw_close_decoder,
> >      .decode         = raw_decode,
> >      .priv_class     = &rawdec_class,
> > +    .capabilities   = CODEC_CAP_PARAM_CHANGE,
> >  };
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> lgtm

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140902/9d8b4bc9/attachment.asc>


More information about the ffmpeg-devel mailing list