]> git.sesse.net Git - vlc/commitdiff
Regression fix for non-SPU tracks in MKV containers.
authorAgo Allikmaa <maxorator@gmail.com>
Thu, 21 Nov 2013 21:43:02 +0000 (21:43 +0000)
committerDenis Charmet <typx@dinauz.org>
Thu, 21 Nov 2013 21:53:38 +0000 (22:53 +0100)
Fixes track duration not being set for non-SPU tracks in MKV containers.

modules/demux/mkv/matroska_segment_parse.cpp
modules/demux/mkv/mkv.cpp
modules/demux/mkv/mkv.hpp

index 8845823b319b42324888163d2f3afb642b6af5a3..360614d2e0f3f1c32d99dc120c63f82267f052bc 100644 (file)
@@ -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;
@@ -1748,6 +1749,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
     else if( !strcmp( p_tk->psz_codec, "S_VOBSUB" ) )
     {
         p_tk->fmt.i_codec = VLC_CODEC_SPU;
+        p_tk->b_no_duration = true;
         if( p_tk->i_extra_data )
         {
             char *psz_start;
index 42f33346ca4960f62d56cd087a8442d5ae3dee7e..edf6a6f271688df5be4389079fd147c7864bc61c 100644 (file)
@@ -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,12 @@ 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 )
+        {
+            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;
index a883a466eb5659fef3fd5fb831a95ea743ad3929..063891462fe164830b02a39675f74bbefd5c2f58 100644 (file)
@@ -201,6 +201,7 @@ struct mkv_track_t
     bool         b_dts_only;
     bool         b_pts_only;
 
+    bool         b_no_duration;
     uint64_t     i_default_duration;
     float        f_timecodescale;
     mtime_t      i_last_dts;