Commit 0644d438 authored by Steve Lhomme's avatar Steve Lhomme

mkv.cpp: read the new KaxSimpleBlock element (when libmatroska 0.8.0 is used)

parent 10b47126
...@@ -1157,7 +1157,11 @@ public: ...@@ -1157,7 +1157,11 @@ public:
void LoadTags( ); void LoadTags( );
void InformationCreate( ); void InformationCreate( );
void Seek( mtime_t i_date, mtime_t i_time_offset ); void Seek( mtime_t i_date, mtime_t i_time_offset );
int BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64_t *pi_ref2, int64_t *pi_duration ); #if LIBMATROSKA_VERSION >= 0x000800
int BlockGet( KaxBlock * &, KaxSimpleBlock * &, int64_t *, int64_t *, int64_t *);
#else
int BlockGet( KaxBlock * &, int64_t *, int64_t *, int64_t *);
#endif
bool Select( mtime_t i_start_time ); bool Select( mtime_t i_start_time );
void UnSelect( ); void UnSelect( );
...@@ -1659,8 +1663,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1659,8 +1663,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
} }
} }
#if LIBMATROSKA_VERSION >= 0x000800
int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_simpleblock, int64_t *pi_ref1, int64_t *pi_ref2, int64_t *pi_duration )
#else
int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64_t *pi_ref2, int64_t *pi_duration ) int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64_t *pi_ref2, int64_t *pi_duration )
#endif
{ {
#if LIBMATROSKA_VERSION >= 0x000800
pp_simpleblock = NULL;
#endif
pp_block = NULL; pp_block = NULL;
*pi_ref1 = 0; *pi_ref1 = 0;
*pi_ref2 = 0; *pi_ref2 = 0;
...@@ -1751,6 +1762,17 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64 ...@@ -1751,6 +1762,17 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
i_block_pos = el->GetElementPosition(); i_block_pos = el->GetElementPosition();
ep->Down(); ep->Down();
} }
#if LIBMATROSKA_VERSION >= 0x000800
else if( MKV_IS_ID( el, KaxSimpleBlock ) )
{
pp_simpleblock = (KaxSimpleBlock*)el;
pp_simpleblock->ReadData( es.I_O() );
pp_simpleblock->SetParent( *cluster );
ep->Keep();
}
#endif
break; break;
case 3: case 3:
if( MKV_IS_ID( el, KaxBlock ) ) if( MKV_IS_ID( el, KaxBlock ) )
...@@ -1778,7 +1800,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64 ...@@ -1778,7 +1800,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
{ {
*pi_ref1 = int64( ref ) * cluster->GlobalTimecodeScale(); *pi_ref1 = int64( ref ) * cluster->GlobalTimecodeScale();
} }
else else if( *pi_ref2 == 0 )
{ {
*pi_ref2 = int64( ref ) * cluster->GlobalTimecodeScale(); *pi_ref2 = int64( ref ) * cluster->GlobalTimecodeScale();
} }
...@@ -3231,7 +3253,13 @@ static int Demux( demux_t *p_demux) ...@@ -3231,7 +3253,13 @@ static int Demux( demux_t *p_demux)
int64_t i_block_ref1; int64_t i_block_ref1;
int64_t i_block_ref2; int64_t i_block_ref2;
#if LIBMATROSKA_VERSION >= 0x000800
KaxSimpleBlock *simpleblock;
if( p_segment->BlockGet( block, simpleblock, &i_block_ref1, &i_block_ref2, &i_block_duration ) )
#else
if( p_segment->BlockGet( block, &i_block_ref1, &i_block_ref2, &i_block_duration ) ) if( p_segment->BlockGet( block, &i_block_ref1, &i_block_ref2, &i_block_duration ) )
#endif
{ {
if ( p_vsegment->Edition() && p_vsegment->Edition()->b_ordered ) if ( p_vsegment->Edition() && p_vsegment->Edition()->b_ordered )
{ {
...@@ -3283,6 +3311,9 @@ static int Demux( demux_t *p_demux) ...@@ -3283,6 +3311,9 @@ static int Demux( demux_t *p_demux)
{ {
i_return = 1; i_return = 1;
delete block; delete block;
#if LIBMATROSKA_VERSION >= 0x000800
delete simpleblock;
#endif
break; break;
} }
} }
...@@ -3293,6 +3324,9 @@ static int Demux( demux_t *p_demux) ...@@ -3293,6 +3324,9 @@ static int Demux( demux_t *p_demux)
if ( !p_vsegment->SelectNext() ) if ( !p_vsegment->SelectNext() )
{ {
delete block; delete block;
#if LIBMATROSKA_VERSION >= 0x000800
delete simpleblock;
#endif
break; break;
} }
p_segment->UnSelect( ); p_segment->UnSelect( );
...@@ -3305,6 +3339,9 @@ static int Demux( demux_t *p_demux) ...@@ -3305,6 +3339,9 @@ static int Demux( demux_t *p_demux)
{ {
msg_Err( p_demux, "Failed to select new segment" ); msg_Err( p_demux, "Failed to select new segment" );
delete block; delete block;
#if LIBMATROSKA_VERSION >= 0x000800
delete simpleblock;
#endif
break; break;
} }
delete block; delete block;
...@@ -3314,6 +3351,9 @@ static int Demux( demux_t *p_demux) ...@@ -3314,6 +3351,9 @@ static int Demux( demux_t *p_demux)
BlockDecode( p_demux, block, p_sys->i_pts, i_block_duration, i_block_ref1 >= 0 || i_block_ref2 > 0 ); BlockDecode( p_demux, block, p_sys->i_pts, i_block_duration, i_block_ref1 >= 0 || i_block_ref2 > 0 );
delete block; delete block;
#if LIBMATROSKA_VERSION >= 0x000800
delete simpleblock;
#endif
i_block_count++; i_block_count++;
// TODO optimize when there is need to leave or when seeking has been called // TODO optimize when there is need to leave or when seeking has been called
...@@ -5319,6 +5359,9 @@ void virtual_segment_c::AppendUID( const EbmlBinary * p_UID ) ...@@ -5319,6 +5359,9 @@ void virtual_segment_c::AppendUID( const EbmlBinary * p_UID )
void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset ) void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
{ {
KaxBlock *block; KaxBlock *block;
#if LIBMATROSKA_VERSION >= 0x000800
KaxSimpleBlock *simpleblock;
#endif
int i_track_skipping; int i_track_skipping;
int64_t i_block_duration; int64_t i_block_duration;
int64_t i_block_ref1; int64_t i_block_ref1;
...@@ -5376,7 +5419,11 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset ) ...@@ -5376,7 +5419,11 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
while( i_track_skipping > 0 ) while( i_track_skipping > 0 )
{ {
#if LIBMATROSKA_VERSION >= 0x000800
if( BlockGet( block, simpleblock, &i_block_ref1, &i_block_ref2, &i_block_duration ) )
#else
if( BlockGet( block, &i_block_ref1, &i_block_ref2, &i_block_duration ) ) if( BlockGet( block, &i_block_ref1, &i_block_ref2, &i_block_duration ) )
#endif
{ {
msg_Warn( &sys.demuxer, "cannot get block EOF?" ); msg_Warn( &sys.demuxer, "cannot get block EOF?" );
...@@ -5416,6 +5463,9 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset ) ...@@ -5416,6 +5463,9 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
} }
delete block; delete block;
#if LIBMATROSKA_VERSION >= 0x000800
delete simpleblock;
#endif
} }
} }
......
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