[FFmpeg-devel] [PATCH 3/3] libutvideo: use named struct initializers.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Nov 15 01:15:58 CET 2011


On 15 Nov 2011, at 00:19, Clément Bœsch <ubitux at gmail.com> wrote:
> On Tue, Nov 15, 2011 at 12:17:33AM +0100, Clément Bœsch wrote:
>> ---
>> libavcodec/libutvideo.cpp |   22 ++++++++--------------
>> 1 files changed, 8 insertions(+), 14 deletions(-)
>> 
>> diff --git a/libavcodec/libutvideo.cpp b/libavcodec/libutvideo.cpp
>> index 7126c36..3ba762f 100644
>> --- a/libavcodec/libutvideo.cpp
>> +++ b/libavcodec/libutvideo.cpp
>> @@ -188,18 +188,12 @@ static av_cold int utvideo_decode_close(AVCodecContext *avctx)
>> }
>> 
>> AVCodec ff_libutvideo_decoder = {
>> -    "libutvideo",
>> -    AVMEDIA_TYPE_VIDEO,
>> -    CODEC_ID_UTVIDEO,
>> -    sizeof(UtVideoContext),
>> -    utvideo_decode_init,
>> -    NULL,
>> -    utvideo_decode_close,
>> -    utvideo_decode_frame,
>> -    NULL,
>> -    NULL,
>> -    NULL,
>> -    NULL,
>> -    NULL,
>> -    NULL_IF_CONFIG_SMALL("Ut Video"),
>> +    .name           = "libutvideo",
>> +    .long_name      = NULL_IF_CONFIG_SMALL("Ut Video"),
>> +    .type           = AVMEDIA_TYPE_VIDEO,
>> +    .id             = CODEC_ID_UTVIDEO,
>> +    .priv_data_size = sizeof(UtVideoContext),
>> +    .init           = utvideo_decode_init,
>> +    .close          = utvideo_decode_close,
>> +    .decode         = utvideo_decode_frame,
>> };
> 
> I realized this is common with the other c++ wrapper and wonder if it
> actually works with any c++ compiler. If anyone can test that, that would
> be welcome :)

I can't exclude that gcc might accept it as an extension, but it is definitely invalid C++ (yes, even by the newest, just finished standard, compared to C99 C++ simply sucks for low-level stuff).
So I don't think this should be changed.
> 


More information about the ffmpeg-devel mailing list