[Ffmpeg-devel] [PATCH] wrong use of ff_get_fourcc in mpjg.c

Måns Rullgård mru
Wed Feb 7 14:45:25 CET 2007


Reimar Doeffinger said:
> Hello,
> On Wed, Feb 07, 2007 at 12:08:10PM -0000, M?ns Rullg?rd wrote:
>> Baptiste Coudurier said:
>> > Michael Niedermayer wrote:
>> >> On Wed, Feb 07, 2007 at 11:18:07AM +0100, Reimar Doeffinger wrote:
>> >>> attached patch fixes bug 739 by using the much more obvious to
>> >>> understand MKBETAG.
>> >>
>> >> ok
>> >>
>> >>
>> >>> I think this is not the first bug of this kind caused by this functions,
>> >>> indicating it that it is flawed in so far as it has non-obvious
>> >>> semantics, so may I suggest deprecating it?
>> >>
>> >> what about replacing all
>> >> MK*TAG and ff_get_fourcc by
>> >>
>> >> AV_RB32("ABCD") / AV_RL32("ABCD") ?
>> >>
>> >> assuming of course that the compiler can optimize this into similarely
>> >> simple code ...
>> >>
>> >
>> > I like MKTAG, which illustrates that we are looking for a tag rather
>> > than a serie of bytes. MKTAG("ABCD") would be nice though.
>>
>> The trouble is that such constructs can't be used where a constant expression
>> is required, for instance in case labels.  The MKTAG macros tend to be used
>> quite a lot in such places.
>
> AV_RB32 etc. in general when there are optimized variants maybe not, but a macro
> that expands to
> ("ABCD")[0] | (("ABCD")[1] << 8) ...
> I'd expect to resolve to a constant...

Well, it doesn't.  Believe me, I've tried it.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list