[vlc-commits] mkv: add every seen subtitle block as seekpoint

Filip Roséen git at videolan.org
Mon May 9 15:09:28 CEST 2016


vlc | branch: master | Filip Roséen <filip at videolabs.io> | Mon May  9 14:53:11 2016 +0200| [2dba57cac19f767e47e8d9447ee49a04ce7984d5] | committer: Jean-Baptiste Kempf

mkv: add every seen subtitle block as seekpoint

Currently there are issues outside of the demuxer that does not allow us
to display an "on-going" subtitle if we seek to a location where a
subtitle has started, but yet finished.

Since there are several mkv files in the wild where there is no proper
mkv-cue for every subtitle, we should add every subtitle block we see as
an index; and then use this for seeking (if we know about it, and have
to).

In general, every subtitle block is effectively a "keyframe"; meaning
that this hack is safe (at least enough to justify its purpose). Having
seekpoints for the subtitle track will allow us to send it to the
relevant decoder, and after we have support for "unfinished" subtitles;
mkv's will magically play along nicely.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2dba57cac19f767e47e8d9447ee49a04ce7984d5
---

 modules/demux/mkv/matroska_segment.cpp |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index a9a3c80..44201b8 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1118,15 +1118,18 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
             vars.block->ReadData( vars.obj->es.I_O() );
             vars.block->SetParent( *vars.obj->cluster );
 
+            if( vars.obj->tracks[ kblock.TrackNum() ].fmt.i_cat == SPU_ES )
+            {
+                vars.obj->_seeker.add_seekpoint( kblock.TrackNum(), SegmentSeeker::Seekpoint::TRUSTED, kblock.GetElementPosition(), kblock.GlobalTimecode() / 1000 );
+            }
+
             vars.obj->ep->Keep ();
         }
-
         E_CASE( KaxBlockDuration, kduration )
         {
             kduration.ReadData( vars.obj->es.I_O() );
             vars.i_duration = static_cast<uint64>( kduration );
         }
-
         E_CASE( KaxReferenceBlock, kreference )
         {
            kreference.ReadData( vars.obj->es.I_O() );



More information about the vlc-commits mailing list