[vlc-commits] mkv: among forced tracks, select the default

Romain Vimont git at videolan.org
Sat May 5 14:36:40 CEST 2018


vlc/vlc-3.0 | branch: master | Romain Vimont <rom1v at videolabs.io> | Thu May  3 16:13:27 2018 +0200| [92f0fbf153167a6e4d10702d5286fd002925751f] | committer: Jean-Baptiste Kempf

mkv: among forced tracks, select the default

When several tracks of the same kind were flagged "forced", it selected
the last one. Instead, select the default one if any.

Fixes #18883

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 3a0eeebc59ee682fdb71fdeceeb9b19e34aa4b0b)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=92f0fbf153167a6e4d10702d5286fd002925751f
---

 modules/demux/mkv/matroska_segment.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 796336830f..d50bdf5b20 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1116,6 +1116,7 @@ bool matroska_segment_c::ESCreate()
     es_out_Control( sys.demuxer.out, ES_OUT_SET_ES_CAT_POLICY, VIDEO_ES,
                     ES_OUT_ES_POLICY_EXCLUSIVE );
 
+    mkv_track_t *default_tracks[ES_CATEGORY_COUNT] = {};
     for( tracks_map_t::iterator it = tracks.begin(); it != tracks.end(); ++it )
     {
         tracks_map_t::key_type   track_id = it->first;
@@ -1138,8 +1139,17 @@ bool matroska_segment_c::ESCreate()
          */
         if( track.b_default || track.b_forced )
         {
-            es_out_Control( sys.demuxer.out, ES_OUT_SET_ES_DEFAULT, track.p_es );
+            mkv_track_t *&default_track = default_tracks[track.fmt.i_cat];
+            if( !default_track || track.b_default )
+                default_track = &track;
         }
+
+    }
+
+    for( mkv_track_t *track : default_tracks )
+    {
+        if( track )
+            es_out_Control( sys.demuxer.out, ES_OUT_SET_ES_DEFAULT, track->p_es );
     }
 
     return true;



More information about the vlc-commits mailing list