[FFmpeg-devel] [PATCH 7/7] Add check in av_write_header() which validates the rawvideo codec tag.

Baptiste Coudurier baptiste.coudurier
Wed Jun 2 00:11:30 CEST 2010


On 06/01/2010 10:59 AM, Michael Niedermayer wrote:
> On Tue, Jun 01, 2010 at 07:29:34PM +0200, Stefano Sabatini wrote:
>> On date Tuesday 2010-06-01 17:53:36 +0200, Michael Niedermayer encoded:
>>> On Tue, Jun 01, 2010 at 12:39:41PM +0200, Stefano Sabatini wrote:
>>>> On date Thursday 2010-05-27 21:59:52 +0200, Michael Niedermayer encoded:
>>>>> On Thu, May 27, 2010 at 12:28:28AM +0200, Stefano Sabatini wrote:
>>>>>> Make the function fail if there is no codec tag associated to that
>>>>>> pixel format.
>>>>>> ---
>>>>>>   libavformat/utils.c |    9 +++++++++
>>>>>>   1 files changed, 9 insertions(+), 0 deletions(-)
>>>>>
>>>>> this patch requires as prereqesite avienc/riff to override codec_tag
>>>>> so its 0 for rgb formats
>>>>
>>>> The problem with the current code is that if
>>>> avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt) in rawenc.c returns 0,
>>>> then av_write_header() does:
>>>> st->codec->codec_tag= av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id);
>>>>
>>>> which sets the codec tag to the first entry with codec id == RAWVIDEO,
>>>> which may have nothing to do with the pixel format of the output
>>>> stream.
>>>
>>> you are confused.
>>> codec_tag must be 0 for rgb in avi. and the first entry is 0
>>> if rgb in avi is stored with non 0 codec_tag currently then you
>>> introduced a very serious bug. And the fix is to override it in
>>> riff.c as i said multiple times.
>>
>> I have not the faintest idea about what "rgb in avi" is, there are
>> tons of RGB pixel formats which can fit in rawvideo, also I have no
>> idea what you mean by "override it in riff.c" and I'm quite tired of
>> playing at mind-guessing.
>
> what is unclear on
> rgb in avi must use codec_tag=0 ?
> the raw rgb format in avi is indicated by the number of bits per pixel
> not by the fourcc which must be set to 0.
>
>
>>
>> What the code currently implements is just wrong for both AVI and NUT,
>> in the case of AVI if the pixel format cannot be mapped to any codec
>> tag, codec_tag is set to 0,
>
> it must be 0 this is as it should be
>
>
>> which when reading it is interpreted as
>> YUV420P,
>
> if so thats a bug and i would suspect a new one
>

Please don't break .mov

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list