[FFmpeg-devel] [PATCH] Add default stream flag

Evgeniy Stepanov eugeni.stepanov
Fri Feb 29 02:00:08 CET 2008


On Friday 29 February 2008 03:39:29 Aurelien Jacobs wrote:
> Evgeniy Stepanov wrote:
> > On Thursday 28 February 2008 23:49:15 Michael Niedermayer wrote:
> > > On Thu, Feb 28, 2008 at 11:24:22PM +0300, Evgeniy Stepanov wrote:
> > > > Hi,
> > > >
> > > > this patch adds 'default_stream' flag to AVStream. Streams marked
> > > > as default are to be selected for playback (or whatever else) if
> > > > the user does not have any other preference (like language, or an
> > > > exact stream id).
> > > >
> > > > This patch adds support for such streams in matroska muxer and
> > > > demuxer. I don't know if there is similar functionality in other
> > > > containers.
> > >
> > > nut of course ...
> > >
> > > > Is there a better place to put this information, without adding a
> > > > new member to AVStream ?
> > > >
> > > > Maybe add an AVStream.flags with one bit of it occupied by
> > > > default_stream flag ?
> > >
> > > This is better, but please call it int disposition; with
> > > AV_DISPOSITION_DEFAULT
> > > AV_DISPOSITION_DUB
> > > AV_DISPOSITION_ORIGINAL
> > > AV_DISPOSITION_COMMENT
> > > AV_DISPOSITION_LYRICS
> > > AV_DISPOSITION_KARAOKE
> >
> > Here. Both matroska and nut supported (I invented new disposition
> > 'default' for nut, it is not in the spec). In ffmpeg.c, disposition
> > is copied from ist to ost.
> >
> > [...]
> >
> > --- a/libavformat/matroskaenc.c
> > +++ b/libavformat/matroskaenc.c
> > @@ -549,6 +549,8 @@ static int mkv_write_tracks(AVFormatContext *s)
> >          else
> >              put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, "und");
> >
> > +        put_ebml_uint(pb,
> > MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition &
> > AV_DISPOSITION_DEFAULT));
>
> IMO, don't write this uint if it's not needed:
>
>     if (st->disposition & AV_DISPOSITION_DEFAULT)
>         put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, 1);
>
> Except that, matroska part is OK.

I considered this, but
- it's written for every track in almost all mkvs out there;
- mkvmerge always writes it.

So, just to be safe, for the sake of all demuxers whose authors did not the 
specification... And 4 bytes per stream is not that much.

And, surprise, the default value, according to spec, is 1.




More information about the ffmpeg-devel mailing list