diff mbox series

[FFmpeg-devel,02/14] avformat/matroska: clean the structure formatting

Message ID 20200322085933.7532-2-robUx4@ycbcr.xyz
State Accepted
Headers show
Series [FFmpeg-devel,01/14] avformat/matroska: add missing Buttons track type
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Steve Lhomme March 22, 2020, 8:59 a.m. UTC
From: Steve Lhomme <robux4@ycbcr.xyz>

Always use a comma at the end, order elements by value.
---
 libavformat/matroska.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Moritz Barsnick March 24, 2020, 8:47 a.m. UTC | #1
On Sun, Mar 22, 2020 at 09:59:21 +0100, Steve Lhomme wrote:
> Always use a comma at the end, order elements by value.

IIUC, this is strictly a C99(+) "feature", so should probably be
mentioned here:
https://ffmpeg.org/developer.html#C-language-features
in case "all compilers we care about" support this.

(Yes, I am aware that many other enums in said file already are
formatted thus.)

Deeply into nitpick country, ;-)
Moritz
Andreas Rheinhardt March 25, 2020, 10:24 p.m. UTC | #2
Steve Lhomme:
> From: Steve Lhomme <robux4@ycbcr.xyz>
> 
> Always use a comma at the end, order elements by value.
> ---
>  libavformat/matroska.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/matroska.h b/libavformat/matroska.h
> index 9e33e51c94..e177cd027f 100644
> --- a/libavformat/matroska.h
> +++ b/libavformat/matroska.h
> @@ -286,13 +286,13 @@ typedef enum {
>  typedef enum {
>      MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
>      MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
> -    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2
> +    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
>  } MatroskaVideoInterlaceFlag;
>  
>  typedef enum {
>      MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
> -    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
>      MATROSKA_VIDEO_FIELDORDER_TT           = 1,
> +    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
>      MATROSKA_VIDEO_FIELDORDER_BB           = 6,
>      MATROSKA_VIDEO_FIELDORDER_TB           = 9,
>      MATROSKA_VIDEO_FIELDORDER_BT           = 14,
> 
Would it actually be allowed to add new values to the range of
FlagInterlaced (to which the MatroskaVideoInterlaceFlag enum
corresponds)? If no, then we should not add a comma, as this signals
extensibility.
The reordering looks good either way.

- Andreas
Anton Khirnov March 27, 2020, 10:02 a.m. UTC | #3
Quoting Moritz Barsnick (2020-03-24 09:47:14)
> On Sun, Mar 22, 2020 at 09:59:21 +0100, Steve Lhomme wrote:
> > Always use a comma at the end, order elements by value.
> 
> IIUC, this is strictly a C99(+) "feature", so should probably be
> mentioned here:
> https://ffmpeg.org/developer.html#C-language-features
> in case "all compilers we care about" support this.
> 
> (Yes, I am aware that many other enums in said file already are
> formatted thus.)
> 
> Deeply into nitpick country, ;-)

IMO we should stop picking specific C99 features we require and just
say we assume all of it, except some forbidden features (VLA, complex
numbers). We even borderline-depend on a C11 feature (atomics).
Steve Lhomme March 28, 2020, 2:19 p.m. UTC | #4
On 2020-03-25 23:24, Andreas Rheinhardt wrote:
> Steve Lhomme:
>> From: Steve Lhomme <robux4@ycbcr.xyz>
>>
>> Always use a comma at the end, order elements by value.
>> ---
>>   libavformat/matroska.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/matroska.h b/libavformat/matroska.h
>> index 9e33e51c94..e177cd027f 100644
>> --- a/libavformat/matroska.h
>> +++ b/libavformat/matroska.h
>> @@ -286,13 +286,13 @@ typedef enum {
>>   typedef enum {
>>       MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
>>       MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
>> -    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2
>> +    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
>>   } MatroskaVideoInterlaceFlag;
>>   
>>   typedef enum {
>>       MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
>> -    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
>>       MATROSKA_VIDEO_FIELDORDER_TT           = 1,
>> +    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
>>       MATROSKA_VIDEO_FIELDORDER_BB           = 6,
>>       MATROSKA_VIDEO_FIELDORDER_TB           = 9,
>>       MATROSKA_VIDEO_FIELDORDER_BT           = 14,
>>
> Would it actually be allowed to add new values to the range of
> FlagInterlaced (to which the MatroskaVideoInterlaceFlag enum
> corresponds)? If no, then we should not add a comma, as this signals
> extensibility.
> The reordering looks good either way.

Yes, dependending on the DocType version it might be possible that some 
new values are added to enums (not just this one).

Also I'm not sure I can tell an element in the last of an "list" in XSLT 
so that would be more trouble to generate the code.
Andreas Rheinhardt April 3, 2020, 5:18 p.m. UTC | #5
Steve Lhomme:
> On 2020-03-25 23:24, Andreas Rheinhardt wrote:
>> Steve Lhomme:
>>> From: Steve Lhomme <robux4@ycbcr.xyz>
>>>
>>> Always use a comma at the end, order elements by value.
>>> ---
>>>   libavformat/matroska.h | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavformat/matroska.h b/libavformat/matroska.h
>>> index 9e33e51c94..e177cd027f 100644
>>> --- a/libavformat/matroska.h
>>> +++ b/libavformat/matroska.h
>>> @@ -286,13 +286,13 @@ typedef enum {
>>>   typedef enum {
>>>       MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
>>>       MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
>>> -    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2
>>> +    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
>>>   } MatroskaVideoInterlaceFlag;
>>>     typedef enum {
>>>       MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
>>> -    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
>>>       MATROSKA_VIDEO_FIELDORDER_TT           = 1,
>>> +    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
>>>       MATROSKA_VIDEO_FIELDORDER_BB           = 6,
>>>       MATROSKA_VIDEO_FIELDORDER_TB           = 9,
>>>       MATROSKA_VIDEO_FIELDORDER_BT           = 14,
>>>
>> Would it actually be allowed to add new values to the range of
>> FlagInterlaced (to which the MatroskaVideoInterlaceFlag enum
>> corresponds)? If no, then we should not add a comma, as this signals
>> extensibility.
>> The reordering looks good either way.
> 
> Yes, dependending on the DocType version it might be possible that some
> new values are added to enums (not just this one).
> 
> Also I'm not sure I can tell an element in the last of an "list" in XSLT
> so that would be more trouble to generate the code.

Applied.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 9e33e51c94..e177cd027f 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -286,13 +286,13 @@  typedef enum {
 typedef enum {
     MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
     MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
-    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2
+    MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
 } MatroskaVideoInterlaceFlag;
 
 typedef enum {
     MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
-    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
     MATROSKA_VIDEO_FIELDORDER_TT           = 1,
+    MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
     MATROSKA_VIDEO_FIELDORDER_BB           = 6,
     MATROSKA_VIDEO_FIELDORDER_TB           = 9,
     MATROSKA_VIDEO_FIELDORDER_BT           = 14,