[FFmpeg-devel] [PATCH 21/28] added: make libavformat expose the FORCED flag from matroska as a disposition

Michael Niedermayer michaelni
Fri Jul 2 00:44:03 CEST 2010


On Thu, Jul 01, 2010 at 11:53:24PM +0200, Aurelien Jacobs wrote:
> On Thu, Jul 01, 2010 at 11:34:20PM +0200, Michael Niedermayer wrote:
> > On Thu, Jul 01, 2010 at 04:35:36PM +0200, Aurelien Jacobs wrote:
> > [...]
> > > Index: libavformat/avformat.h
> > > ===================================================================
> > > --- libavformat/avformat.h	(r?vision 23934)
> > > +++ libavformat/avformat.h	(copie de travail)
> > > @@ -396,6 +396,7 @@
> > >  #define AV_DISPOSITION_COMMENT   0x0008
> > >  #define AV_DISPOSITION_LYRICS    0x0010
> > >  #define AV_DISPOSITION_KARAOKE   0x0020
> > > +#define AV_DISPOSITION_FORCED    0x0040
> > 
> > what does forced mean?
> 
> Useful especially for subtitles.
> For example, you are watching a movie with an english audio track, but
> some short parts of the audio track contain some dialog in another
> (possibly uncommon) language. User can enable english subtitles, to have
> the whole movie subtitled. But if the user don't ask for subtitle, a
> specific subtitle track containing only translation of the parts in
> different language should be displayed. This specific subtitle track
> would have AV_DISPOSITION_FORCED.
> IIRC such a thing also exists on DVDs.
> 
> > this need doxy
> 
> Attached.
> 
> Aurel
>  avformat.h    |    3 +++
>  matroskadec.c |    5 ++++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> b34fef645ba7bc285d19547fdbe08e8b0a302b4e  mkv_forced.diff
> Index: libavformat/matroskadec.c
> ===================================================================
> --- libavformat/matroskadec.c	(r?vision 23934)
> +++ libavformat/matroskadec.c	(copie de travail)
> @@ -139,6 +139,7 @@
>      double time_scale;
>      uint64_t default_duration;
>      uint64_t flag_default;
> +    uint64_t flag_forced;
>      MatroskaTrackVideo video;
>      MatroskaTrackAudio audio;
>      EbmlList encodings;
> @@ -336,11 +337,11 @@
>      { MATROSKA_ID_TRACKDEFAULTDURATION, EBML_UINT, 0, offsetof(MatroskaTrack,default_duration) },
>      { MATROSKA_ID_TRACKTIMECODESCALE,   EBML_FLOAT,0, offsetof(MatroskaTrack,time_scale), {.f=1.0} },
>      { MATROSKA_ID_TRACKFLAGDEFAULT,     EBML_UINT, 0, offsetof(MatroskaTrack,flag_default), {.u=1} },
> +    { MATROSKA_ID_TRACKFLAGFORCED,      EBML_UINT, 0, offsetof(MatroskaTrack,flag_forced), {.u=0} },
>      { MATROSKA_ID_TRACKVIDEO,           EBML_NEST, 0, offsetof(MatroskaTrack,video), {.n=matroska_track_video} },
>      { MATROSKA_ID_TRACKAUDIO,           EBML_NEST, 0, offsetof(MatroskaTrack,audio), {.n=matroska_track_audio} },
>      { MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
>      { MATROSKA_ID_TRACKFLAGENABLED,     EBML_NONE },
> -    { MATROSKA_ID_TRACKFLAGFORCED,      EBML_NONE },
>      { MATROSKA_ID_TRACKFLAGLACING,      EBML_NONE },
>      { MATROSKA_ID_CODECNAME,            EBML_NONE },
>      { MATROSKA_ID_CODECDECODEALL,       EBML_NONE },
> @@ -1391,6 +1392,8 @@
>  
>          if (track->flag_default)
>              st->disposition |= AV_DISPOSITION_DEFAULT;
> +        if (track->flag_forced)
> +            st->disposition |= AV_DISPOSITION_FORCED;
>  
>          if (track->default_duration)
>              av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
> Index: libavformat/avformat.h
> ===================================================================
> --- libavformat/avformat.h	(r?vision 23934)
> +++ libavformat/avformat.h	(copie de travail)
> @@ -396,6 +396,9 @@
>  #define AV_DISPOSITION_COMMENT   0x0008
>  #define AV_DISPOSITION_LYRICS    0x0010
>  #define AV_DISPOSITION_KARAOKE   0x0020
> +#define AV_DISPOSITION_FORCED    0x0040  /**< track MUST be used during playback
> +        useful for subtitle track that should be displayed even when user
> +        didn't explicitely asked for subtitles */

Track should be used during playback by default, id say.

must in an api doc is too strong, thats like
"you must not pass a invalid pointer"

and avformat.h ok with that

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100702/84d60bf4/attachment.pgp>



More information about the ffmpeg-devel mailing list