[FFmpeg-devel] [PATCH 2/5] avformat/ffmdec: replace most codec uses by codecpar
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Sat Dec 3 15:07:43 EET 2016
On 03.12.2016 13:37, Michael Niedermayer wrote:
> 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
OK.
Best regards,
Andreas
More information about the ffmpeg-devel
mailing list