[vlc-commits] mkv: store priority tracks
Filip Roséen
git at videolan.org
Mon May 23 16:22:02 CEST 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Fri May 20 23:41:31 2016 +0200| [799fb3753016dd0693a3f19db31bb7c7507b428c] | committer: Jean-Baptiste Kempf
mkv: store priority tracks
When seeking, we should prioritize tracks depending on what type of ES
they are; this patch addes a data-member to matroska_segment_c that will
keep track of which tracks are more important than other.
It also adds logic to ComputePriorityTracks that will initialize this
data-member with the appropriate track-ids.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=799fb3753016dd0693a3f19db31bb7c7507b428c
---
modules/demux/mkv/matroska_segment.cpp | 30 ++++++++++++++++++++++++++++++
modules/demux/mkv/matroska_segment.hpp | 1 +
2 files changed, 31 insertions(+)
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 99d6487..881eed0 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -930,6 +930,36 @@ void matroska_segment_c::ComputeTrackPriority()
if( track.fmt.i_cat == VIDEO_ES )
track.fmt.i_priority--;
}
+
+ // find track(s) with highest priority //
+ {
+ int score = -1;
+ int es_type = -1;
+
+ for( tracks_map_t::const_iterator it = this->tracks.begin(); it != this->tracks.end(); ++it )
+ {
+ int track_score = -1;
+
+ switch( it->second.fmt.i_cat )
+ {
+ case VIDEO_ES: ++track_score;
+ case AUDIO_ES: ++track_score;
+ case SPU_ES: ++track_score;
+ default:
+ if( score < track_score )
+ {
+ es_type = it->second.fmt.i_cat;
+ score = track_score;
+ }
+ }
+ }
+
+ for( tracks_map_t::const_iterator it = this->tracks.begin(); it != this->tracks.end(); ++it )
+ {
+ if( it->second.fmt.i_cat == es_type )
+ priority_tracks.push_back( it->first );
+ }
+ }
}
void matroska_segment_c::EnsureDuration()
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index c39c275..0aa01be 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -93,6 +93,7 @@ public:
/* all tracks */
tracks_map_t tracks;
+ std::vector<mkv_track_t::track_id_t> priority_tracks;
/* from seekhead */
int i_seekhead_count;
More information about the vlc-commits
mailing list