Commit 2e56d2ef authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

MKV: rename functions to match better the actual implementation

parent c42f4116
...@@ -718,20 +718,20 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c *p_new_segment ) ...@@ -718,20 +718,20 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c *p_new_segment )
{ {
if ( p_new_segment != NULL && p_new_segment != p_current_segment ) if ( p_new_segment != NULL && p_new_segment != p_current_segment )
{ {
if ( p_current_segment != NULL && p_current_segment->Segment() != NULL ) if ( p_current_segment != NULL && p_current_segment->CurrentSegment() != NULL )
p_current_segment->Segment()->UnSelect(); p_current_segment->CurrentSegment()->UnSelect();
p_current_segment = p_new_segment; p_current_segment = p_new_segment;
i_current_title = p_new_segment->i_sys_title; i_current_title = p_new_segment->i_sys_title;
} }
if( !p_current_segment->Segment()->b_cues ) if( !p_current_segment->CurrentSegment()->b_cues )
msg_Warn( &p_current_segment->Segment()->sys.demuxer, "no cues/empty cues found->seek won't be precise" ); msg_Warn( &p_current_segment->CurrentSegment()->sys.demuxer, "no cues/empty cues found->seek won't be precise" );
f_duration = p_current_segment->Duration(); f_duration = p_current_segment->Duration();
/* add information */ /* add information */
p_current_segment->Segment()->InformationCreate( ); p_current_segment->CurrentSegment()->InformationCreate( );
p_current_segment->Segment()->Select( 0 ); p_current_segment->CurrentSegment()->Select( 0 );
return true; return true;
} }
......
...@@ -246,7 +246,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -246,7 +246,7 @@ static int Open( vlc_object_t * p_this )
} }
p_sys->InitUi(); p_sys->InitUi();
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
...@@ -375,9 +375,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -375,9 +375,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_FPS: case DEMUX_GET_FPS:
pf = (double *)va_arg( args, double * ); pf = (double *)va_arg( args, double * );
*pf = 0.0; *pf = 0.0;
if( p_sys->p_current_segment && p_sys->p_current_segment->Segment() ) if( p_sys->p_current_segment && p_sys->p_current_segment->CurrentSegment() )
{ {
const matroska_segment_c *p_segment = p_sys->p_current_segment->Segment(); const matroska_segment_c *p_segment = p_sys->p_current_segment->CurrentSegment();
for( size_t i = 0; i < p_segment->tracks.size(); i++ ) for( size_t i = 0; i < p_segment->tracks.size(); i++ )
{ {
mkv_track_t *tk = p_segment->tracks[i]; mkv_track_t *tk = p_segment->tracks[i];
...@@ -401,7 +401,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, chapter_it ...@@ -401,7 +401,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, chapter_it
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
virtual_segment_c *p_vsegment = p_sys->p_current_segment; virtual_segment_c *p_vsegment = p_sys->p_current_segment;
matroska_segment_c *p_segment = p_vsegment->Segment(); matroska_segment_c *p_segment = p_vsegment->CurrentSegment();
mtime_t i_time_offset = 0; mtime_t i_time_offset = 0;
int64_t i_global_position = -1; int64_t i_global_position = -1;
...@@ -471,7 +471,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock ...@@ -471,7 +471,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
mtime_t i_pts, mtime_t i_duration, bool f_mandatory ) mtime_t i_pts, mtime_t i_duration, bool f_mandatory )
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
matroska_segment_c *p_segment = p_sys->p_current_segment->Segment(); matroska_segment_c *p_segment = p_sys->p_current_segment->CurrentSegment();
if( !p_segment ) return; if( !p_segment ) return;
...@@ -630,7 +630,7 @@ static int Demux( demux_t *p_demux) ...@@ -630,7 +630,7 @@ static int Demux( demux_t *p_demux)
vlc_mutex_lock( &p_sys->lock_demuxer ); vlc_mutex_lock( &p_sys->lock_demuxer );
virtual_segment_c *p_vsegment = p_sys->p_current_segment; virtual_segment_c *p_vsegment = p_sys->p_current_segment;
matroska_segment_c *p_segment = p_vsegment->Segment(); matroska_segment_c *p_segment = p_vsegment->CurrentSegment();
if ( p_segment == NULL ) return 0; if ( p_segment == NULL ) return 0;
int i_block_count = 0; int i_block_count = 0;
int i_return = 0; int i_return = 0;
...@@ -646,18 +646,18 @@ static int Demux( demux_t *p_demux) ...@@ -646,18 +646,18 @@ static int Demux( demux_t *p_demux)
i_return = 1; i_return = 1;
break; break;
} }
if ( p_vsegment->Edition() && p_vsegment->Edition()->b_ordered && p_vsegment->CurrentChapter() == NULL ) if ( p_vsegment->CurrentEdition() && p_vsegment->CurrentEdition()->b_ordered && p_vsegment->CurrentChapter() == NULL )
{ {
/* nothing left to read in this ordered edition */ /* nothing left to read in this ordered edition */
if ( !p_vsegment->SelectNext() ) if ( !p_vsegment->SelectNext() )
break; break;
p_segment->UnSelect( ); p_segment->UnSelect( );
es_out_Control( p_demux->out, ES_OUT_RESET_PCR ); es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
/* switch to the next segment */ /* switch to the next segment */
p_segment = p_vsegment->Segment(); p_segment = p_vsegment->CurrentSegment();
if ( !p_segment->Select( 0 ) ) if ( !p_segment->Select( 0 ) )
{ {
msg_Err( p_demux, "Failed to select new segment" ); msg_Err( p_demux, "Failed to select new segment" );
...@@ -673,7 +673,7 @@ static int Demux( demux_t *p_demux) ...@@ -673,7 +673,7 @@ static int Demux( demux_t *p_demux)
bool b_discardable_picture; bool b_discardable_picture;
if( p_segment->BlockGet( block, simpleblock, &b_key_picture, &b_discardable_picture, &i_block_duration ) ) if( p_segment->BlockGet( block, simpleblock, &b_key_picture, &b_discardable_picture, &i_block_duration ) )
{ {
if ( p_vsegment->Edition() && p_vsegment->Edition()->b_ordered ) if ( p_vsegment->CurrentEdition() && p_vsegment->CurrentEdition()->b_ordered )
{ {
const chapter_item_c *p_chap = p_vsegment->CurrentChapter(); const chapter_item_c *p_chap = p_vsegment->CurrentChapter();
// check if there are more chapters to read // check if there are more chapters to read
...@@ -695,14 +695,14 @@ static int Demux( demux_t *p_demux) ...@@ -695,14 +695,14 @@ static int Demux( demux_t *p_demux)
{ {
msg_Warn( p_demux, "cannot get block EOF?" ); msg_Warn( p_demux, "cannot get block EOF?" );
p_segment->UnSelect( ); p_segment->UnSelect( );
es_out_Control( p_demux->out, ES_OUT_RESET_PCR ); es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
/* switch to the next segment */ /* switch to the next segment */
if ( !p_vsegment->SelectNext() ) if ( !p_vsegment->SelectNext() )
// no more segments in this stream // no more segments in this stream
break; break;
p_segment = p_vsegment->Segment(); p_segment = p_vsegment->CurrentSegment();
if ( !p_segment->Select( 0 ) ) if ( !p_segment->Select( 0 ) )
{ {
msg_Err( p_demux, "Failed to select new segment" ); msg_Err( p_demux, "Failed to select new segment" );
...@@ -730,8 +730,8 @@ static int Demux( demux_t *p_demux) ...@@ -730,8 +730,8 @@ static int Demux( demux_t *p_demux)
break; break;
} }
} }
if ( p_vsegment->Edition() && p_vsegment->Edition()->b_ordered && p_vsegment->CurrentChapter() == NULL ) if ( p_vsegment->CurrentEdition() && p_vsegment->CurrentEdition()->b_ordered && p_vsegment->CurrentChapter() == NULL )
{ {
/* nothing left to read in this ordered edition */ /* nothing left to read in this ordered edition */
if ( !p_vsegment->SelectNext() ) if ( !p_vsegment->SelectNext() )
...@@ -740,11 +740,11 @@ static int Demux( demux_t *p_demux) ...@@ -740,11 +740,11 @@ static int Demux( demux_t *p_demux)
break; break;
} }
p_segment->UnSelect( ); p_segment->UnSelect( );
es_out_Control( p_demux->out, ES_OUT_RESET_PCR ); es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
/* switch to the next segment */ /* switch to the next segment */
p_segment = p_vsegment->Segment(); p_segment = p_vsegment->CurrentSegment();
if ( !p_segment->Select( 0 ) ) if ( !p_segment->Select( 0 ) )
{ {
msg_Err( p_demux, "Failed to select new segment" ); msg_Err( p_demux, "Failed to select new segment" );
......
...@@ -211,7 +211,7 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_date, mtime_t i_time_ ...@@ -211,7 +211,7 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_date, mtime_t i_time_
// find the actual time for an ordered edition // find the actual time for an ordered edition
if ( psz_chapter == NULL ) if ( psz_chapter == NULL )
{ {
if ( Edition() && Edition()->b_ordered ) if ( CurrentEdition() && CurrentEdition()->b_ordered )
{ {
/* 1st, we need to know in which chapter we are */ /* 1st, we need to know in which chapter we are */
psz_chapter = (*p_editions)[i_current_edition]->FindTimecode( i_date, p_current_chapter ); psz_chapter = (*p_editions)[i_current_edition]->FindTimecode( i_date, p_current_chapter );
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
mtime_t Duration() const; mtime_t Duration() const;
inline chapter_edition_c *Edition() inline chapter_edition_c *CurrentEdition()
{ {
if ( i_current_edition >= 0 && size_t(i_current_edition) < p_editions->size() ) if ( i_current_edition >= 0 && size_t(i_current_edition) < p_editions->size() )
return (*p_editions)[i_current_edition]; return (*p_editions)[i_current_edition];
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
} }
std::vector<chapter_edition_c*>* Editions() const { return p_editions; }; std::vector<chapter_edition_c*>* Editions() const { return p_editions; };
matroska_segment_c * Segment() const matroska_segment_c * CurrentSegment() const
{ {
if ( linked_segments.size() == 0 || i_current_segment >= linked_segments.size() ) if ( linked_segments.size() == 0 || i_current_segment >= linked_segments.size() )
return NULL; return NULL;
......
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