[FFmpeg-devel] [PATCH 2/3] avformat/matroskaenc: write the FieldOrder element for non-interlaced video

Hendrik Leppkes h.leppkes at gmail.com
Wed Sep 28 00:36:05 EEST 2016


On Tue, Sep 27, 2016 at 11:14 PM, James Almer <jamrial at gmail.com> wrote:
> On 9/27/2016 5:56 PM, Hendrik Leppkes wrote:
>> On Tue, Sep 27, 2016 at 8:03 PM, James Almer <jamrial at gmail.com> wrote:
>>> It's listed as mandatory in https://matroska.org/technical/specs/index.html
>>>
>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>> ---
>>> The spec also mentions FieldOrder "MUST be ignored if FlagInterlaced is not
>>> set to interlaced". Since it's a mandatory element, i interpreted that as a
>>> demuxer guideline.
>>>
>>
>> Its a mandatory field with a default value - that kind of definition
>> is a bit weird, but the general consensus is that it does not have to
>> be written if it would write the default anyway.
>>
>> - Hendrik
>
> I find it weird it was defined this way, considering the precedent set by
> BlockDuration which is not tagged as mandatory but its description
> explicitly says "This Element is mandatory when DefaultDuration is set for
> the track".
>
> Alright then, patch dropped from the set.
>

For the record, its written here:
https://matroska.org/technical/specs/notes.html

4. Mandatory
- This element is mandatory in the file.
- Mandatory elements with a default value may be left out of the file.
In the absence of a mandatory element, the element's default value is
used.
- A mandatory element is not written if its parent is not in the file.

The BlockDuration is a bit weird, but the same concept applies. If
DefaultDuration is set, it becomes mandatory, but it still has a
default value (ie. the DefaultDuration), so it doesn't have to be
written if it matches this value.
This whole concept of mandatory with default can be very confusing,
but it is what it is.

And you conveniently left out the good part "This Element is mandatory
when DefaultDuration is set for the track (but can be omitted as other
default values).", specifically mentioning this case =)

- Hendrik


More information about the ffmpeg-devel mailing list