[FFmpeg-cvslog] r24003 - in trunk/libavformat: avformat.h matroskadec.c

aurel subversion
Fri Jul 2 18:38:44 CEST 2010


Author: aurel
Date: Fri Jul  2 18:38:44 2010
New Revision: 24003

Log:
add AV_DISPOSITION_FORCED flag and use it in matroska demuxer

Modified:
   trunk/libavformat/avformat.h
   trunk/libavformat/matroskadec.c

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	Fri Jul  2 17:57:56 2010	(r24002)
+++ trunk/libavformat/avformat.h	Fri Jul  2 18:38:44 2010	(r24003)
@@ -396,6 +396,10 @@ typedef struct AVIndexEntry {
 #define AV_DISPOSITION_COMMENT   0x0008
 #define AV_DISPOSITION_LYRICS    0x0010
 #define AV_DISPOSITION_KARAOKE   0x0020
+/** Track should be used during playback by default.
+    Useful for subtitle track that should be displayed
+    even when user did not explicitly ask for subtitles. */
+#define AV_DISPOSITION_FORCED    0x0040
 
 /**
  * Stream structure.

Modified: trunk/libavformat/matroskadec.c
==============================================================================
--- trunk/libavformat/matroskadec.c	Fri Jul  2 17:57:56 2010	(r24002)
+++ trunk/libavformat/matroskadec.c	Fri Jul  2 18:38:44 2010	(r24003)
@@ -139,6 +139,7 @@ typedef struct {
     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 @@ static EbmlSyntax matroska_track[] = {
     { 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 @@ static int matroska_read_header(AVFormat
 
         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,



More information about the ffmpeg-cvslog mailing list