[FFmpeg-devel] [PATCH 2/5] avformat/ffmdec: replace most codec uses by codecpar

Michael Niedermayer michael at niedermayer.cc
Sat Dec 3 14:37:31 EET 2016


On Sat, Dec 03, 2016 at 12:47:45PM +0100, Andreas Cadhalpun wrote:
> On 03.12.2016 00:52, Michael Niedermayer wrote:
> > @@ -400,16 +398,16 @@ static int ffm2_read_header(AVFormatContext *s)
> >                  ret = AVERROR_INVALIDDATA;
> >                  goto fail;
> >              }
> > -            codec->width = avio_rb16(pb);
> > -            codec->height = avio_rb16(pb);
> > -            ret = av_image_check_size(codec->width, codec->height, 0, s);
> > +            codecpar->width = avio_rb16(pb);
> > +            codecpar->height = avio_rb16(pb);
> > +            ret = av_image_check_size(codecpar->width, codecpar->height, 0, s);
> >              if (ret < 0)
> >                  goto fail;
> >              avio_rb16(pb);
> > -            codec->pix_fmt = avio_rb32(pb);
> > -            if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
> > -                av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
> > -                codec->pix_fmt = AV_PIX_FMT_NONE;
> > +            codecpar->format = avio_rb32(pb);
> 
> This change isn't as simple as it looks, because while the pix_fmt field exclusively
> contains AVPixelFormat values, the format field is shared with AVSampleFormat.
> Thus there now needs to be a check to ensure that codec_type is AVMEDIA_TYPE_VIDEO.

ill add these checks as a seperate patch so it can be backported
easier

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161203/52d35a39/attachment.sig>


More information about the ffmpeg-devel mailing list