Commit 0a7d6eb8 authored by Filip Roséen's avatar Filip Roséen Committed by Jean-Baptiste Kempf

mkv: introduced helper functions related to indexes

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6a735f6e
......@@ -893,13 +893,11 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
return;
}
indexes_t::const_iterator index_it = indexes.begin ();
indexes_t::const_iterator index_it = indexes_begin ();
if ( index_idx() )
{
indexes_t::const_iterator last_active_it = indexes.end() - 1;
for( ; index_it != last_active_it; ++index_it )
for( ; index_it != indexes_end(); ++index_it )
{
if (index_it->i_mk_time == -1)
continue;
......@@ -908,7 +906,7 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
break;
}
if( index_it != indexes.begin ())
if( index_it != indexes_begin ())
--index_it;
i_seek_position = index_it->i_position;
......
......@@ -145,8 +145,11 @@ public:
void UnSelect();
size_t index_idx () const { return indexes.size () - 1; }
mkv_index_t& index () { return *indexes.rbegin (); }
mkv_index_t& prev_index () { return *(indexes.end()-2); }
mkv_index_t& index () { return *(indexes.rbegin()); }
mkv_index_t& prev_index () { return *(indexes.rbegin()+1); }
indexes_t::iterator indexes_begin () { return indexes.begin(); }
indexes_t::iterator indexes_end () { return indexes.end() - (indexes.size() ? 1 : 0); }
static bool CompareSegmentUIDs( const matroska_segment_c * item_a, const matroska_segment_c * item_b );
......
......@@ -475,8 +475,8 @@ static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual
if (p_segment->indexes.size())
{
matroska_segment_c::indexes_t::iterator it = p_segment->indexes.begin ();
matroska_segment_c::indexes_t::iterator last_active = p_segment->indexes.end()-1;
matroska_segment_c::indexes_t::iterator it = p_segment->indexes_begin ();
matroska_segment_c::indexes_t::iterator last_active = p_segment->indexes_end ();
for ( ; it != last_active; ++it )
{
......
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