[vlc-devel] [PATCH] Regression fix for non-SPU tracks in MKV containers (corrected resubmit).

Ago Allikmaa maxorator at gmail.com
Thu Nov 21 22:10:04 CET 2013


Fixes track duration not being set for non-SPU tracks in MKV containers.
---
 modules/demux/mkv/matroska_segment_parse.cpp |  1 +
 modules/demux/mkv/mkv.cpp                    | 14 +++++++++-----
 modules/demux/mkv/mkv.hpp                    |  1 +
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 8845823..672cd77 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -222,6 +222,7 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
     tk->psz_codec              = NULL;
     tk->b_dts_only             = false;
     tk->i_default_duration     = 0;
+    tk->b_no_duration          = false;
     tk->f_timecodescale        = 1.0;
 
     tk->b_inited               = false;
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 42f3334..7c0c541 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -602,11 +602,6 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
                 VLC_TS_INVALID;
             continue;
          }
-         case VLC_CODEC_SPU:
-            if( strcmp( tk->psz_codec, "S_VOBSUB" ) )
-                p_block->i_length = i_duration * tk-> f_timecodescale *
-                    (double) p_segment->i_timescale / 1000.0;
-            break;
          case VLC_CODEC_OPUS:
             if( i_duration > 0 )
             {
@@ -673,6 +668,15 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
 #if 0
 msg_Dbg( p_demux, "block i_dts: %"PRId64" / i_pts: %"PRId64, p_block->i_dts, p_block->i_pts);
 #endif
+        if( !tk->b_no_duration )
+        {
+            if( !strcmp( tk->psz_codec, "S_VOBSUB" ) )
+                tk->b_no_duration = true;
+            else
+                p_block->i_length = i_duration * tk-> f_timecodescale *
+                    (double) p_segment->i_timescale / 1000.0;
+        }
+
         /* FIXME remove when VLC_TS_INVALID work is done */
         if( i == 0 || p_block->i_dts > VLC_TS_INVALID )
             p_block->i_dts += VLC_TS_0;
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index a883a46..65c8233 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -202,6 +202,7 @@ struct mkv_track_t
     bool         b_pts_only;
 
     uint64_t     i_default_duration;
+    bool         b_no_duration;
     float        f_timecodescale;
     mtime_t      i_last_dts;
 
-- 
1.8.4.2




More information about the vlc-devel mailing list