[vlc-commits] mkv: removed legacy indexing
Filip Roséen
git at videolan.org
Mon May 9 15:09:26 CEST 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Mon May 9 14:53:03 2016 +0200| [72e98d2e0e4aa72ca9b18f3de1f179b1e9fc8788] | committer: Jean-Baptiste Kempf
mkv: removed legacy indexing
Since indexing is now managed by matroska_segment_seeker.{hpp,cpp},
there is no need for the legacy functionality and data-members.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72e98d2e0e4aa72ca9b18f3de1f179b1e9fc8788
---
modules/demux/mkv/matroska_segment.cpp | 53 --------------------------------
modules/demux/mkv/matroska_segment.hpp | 7 -----
modules/demux/mkv/mkv.cpp | 20 ------------
modules/demux/mkv/mkv.hpp | 15 ---------
4 files changed, 95 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index a6b67ff..b317079 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -62,8 +62,6 @@ matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estr
,b_preloaded(false)
,b_ref_external_segments(false)
{
- indexes.reserve (1024);
- indexes.resize (1);
}
matroska_segment_c::~matroska_segment_c()
@@ -120,13 +118,6 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
if( MKV_IS_ID( el, KaxCuePoint ) )
{
b_invalid_cue = false;
- mkv_index_t& last_idx = index();
-
- last_idx.i_track = -1;
- last_idx.i_block_number= -1;
- last_idx.i_position = -1;
- last_idx.i_mk_time = -1;
- last_idx.b_key = true;
eparser.Down();
while( ( el = eparser.Get() ) != NULL )
@@ -149,7 +140,6 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
b_invalid_cue = true;
break;
}
- last_idx.i_mk_time = static_cast<uint64>( *kct_ptr ) * i_timescale / INT64_C(1000);
}
else if( MKV_IS_ID( el, KaxCueTrackPositions ) )
{
@@ -169,17 +159,14 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
if( MKV_CHECKED_PTR_DECL ( kct_ptr, KaxCueTrack, el ) )
{
kct_ptr->ReadData( es.I_O() );
- last_idx.i_track = static_cast<uint16>( *kct_ptr );
}
else if( MKV_CHECKED_PTR_DECL ( kccp_ptr, KaxCueClusterPosition, el ) )
{
kccp_ptr->ReadData( es.I_O() );
- last_idx.i_position = segment->GetGlobalPosition( static_cast<uint64> ( *kccp_ptr ) );
}
else if( MKV_CHECKED_PTR_DECL ( kcbn_ptr, KaxCueBlockNumber, el ) )
{
kcbn_ptr->ReadData( es.I_O() );
- last_idx.i_block_number = static_cast<uint32>( *kcbn_ptr );
}
#if LIBMATROSKA_VERSION >= 0x010401
else if( MKV_IS_ID( el, KaxCueRelativePosition ) )
@@ -213,8 +200,6 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
}
eparser.Up();
- if( likely( !b_invalid_cue ) )
- indexes.push_back (mkv_index_t ());
}
else
{
@@ -223,7 +208,6 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
}
b_cues = true;
msg_Dbg( &sys.demuxer, "| - loading cues done." );
- std::sort( indexes_begin(), indexes_end() );
}
@@ -459,15 +443,7 @@ void matroska_segment_c::InformationCreate( )
void matroska_segment_c::IndexAppendCluster( KaxCluster *cluster )
{
- mkv_index_t& last_idx = index();
-
- last_idx.i_track = -1;
- last_idx.i_block_number= -1;
- last_idx.i_position = cluster->GetElementPosition();
- last_idx.i_mk_time = cluster->GlobalTimecode() / INT64_C(1000);
- last_idx.b_key = true;
- indexes.push_back (mkv_index_t ());
}
bool matroska_segment_c::PreloadClusters(uint64 i_cluster_pos)
@@ -677,20 +653,6 @@ bool matroska_segment_c::Preload( )
return true;
}
-namespace {
- struct SeekIndexFinder {
- SeekIndexFinder( mtime_t mk_time_offset )
- : _mk_time_offset( mk_time_offset )
- { }
-
- bool operator()(mtime_t target, mkv_index_t const& mkv_index) const {
- return target < mkv_index.i_mk_time + _mk_time_offset;
- }
-
- mtime_t _mk_time_offset;
- };
-}
-
/* Here we try to load elements that were found in Seek Heads, but not yet parsed */
bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int64_t i_element_position )
{
@@ -891,9 +853,7 @@ void matroska_segment_c::EnsureDuration()
uint64 i_last_cluster_pos = 0;
// find the last Cluster from the Cues
- if ( b_cues && index_idx ())
{
- i_last_cluster_pos = prev_index().i_position;
}
// find the last Cluster manually
@@ -1207,19 +1167,6 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
}
}
- /* update the index */
-
- if(index_idx() && prev_index().i_mk_time == -1 )
- {
- mkv_index_t& last_idx = prev_index();
-
- if ( pp_simpleblock != NULL )
- last_idx.i_mk_time = pp_simpleblock->GlobalTimecode() / INT64_C(1000);
- else
- last_idx.i_mk_time = (*pp_block).GlobalTimecode() / INT64_C(1000);
-
- last_idx.b_key = *pb_key_picture;
- }
return VLC_SUCCESS;
}
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index 292a1c9..2672f9a 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -71,7 +71,6 @@ public:
class matroska_segment_c
{
public:
- typedef std::vector<mkv_index_t> indexes_t;
typedef std::vector<Tag> tags_t;
matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estream );
@@ -107,7 +106,6 @@ public:
KaxNextUID *p_next_segment_uid;
bool b_cues;
- indexes_t indexes;
/* info */
char *psz_muxing_application;
@@ -144,12 +142,7 @@ public:
bool Select( mtime_t i_mk_start_time );
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.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 );
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 6d646cd..3da89bf 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -481,26 +481,6 @@ static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual
int64_t i_pos = int64_t( f_percent * stream_Size( p_demux->s ) );
msg_Dbg( p_demux, "lengthy way of seeking for pos:%" PRId64, i_pos );
-
- 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 ();
-
- for ( ; it != last_active; ++it )
- {
- if( it->i_position >= i_pos && it->i_mk_time != -1 )
- break;
- }
-
- if ( it == last_active && it != p_segment->indexes.begin() )
- --it;
-
- if( it->i_position < i_pos )
- {
- msg_Dbg( p_demux, "no cues, seek request to global pos: %" PRId64, i_pos );
- }
- }
}
}
p_vsegment->Seek( *p_demux, i_mk_date, p_vchapter );
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 64a5dff..b428266 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -233,20 +233,5 @@ class mkv_track_t
mtime_t i_codec_delay;
};
-struct mkv_index_t
-{
- int i_track;
- int i_block_number;
-
- int64_t i_position;
- mtime_t i_mk_time;
-
- bool b_key;
-
- bool operator< (mkv_index_t const& rhs) const {
- return i_mk_time < rhs.i_mk_time;
- }
-};
-
#endif /* _MKV_HPP_ */
More information about the vlc-commits
mailing list