Commit 799fb375 authored by Filip Roséen's avatar Filip Roséen Committed by 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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent b26c2e4f
......@@ -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()
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment