[vlc-devel] [PATCH 5/7] vlc_fourcc: add a macro to get the string for a FOURCC

Steve Lhomme robux4 at gmail.com
Fri May 12 17:32:21 CEST 2017


On Fri, May 12, 2017 at 4:31 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le torstaina 11. toukokuuta 2017, 9.36.07 EEST Steve Lhomme a écrit :
>> ---
>>  include/vlc_fourcc.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/include/vlc_fourcc.h b/include/vlc_fourcc.h
>> index b950b0622b..d6a2c5085e 100644
>> --- a/include/vlc_fourcc.h
>> +++ b/include/vlc_fourcc.h
>> @@ -24,6 +24,8 @@
>>  #ifndef VLC_FOURCC_H
>>  #define VLC_FOURCC_H 1
>>
>> +#define FOURCC_STR(fc) ((const char *)&(fc))
>> +
>>  /* Video codec */
>>  #define VLC_CODEC_MPGV            VLC_FOURCC('m','p','g','v')
>>  #define VLC_CODEC_MP4V            VLC_FOURCC('m','p','4','v')
>
> This is hugely misleading as the result is not nul-terminated. Nack.

I have a less misleading one:

/* use this macro with a %4.4s string formating */
#define FOURCC_44S(fc) ((fc) ? (const char *)&(fc) : "NULL")

That avoids the ugly logs wherever we use %4.4s for a chroma/codec
that may be 0.

> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list