[vlc-devel] [PATCH] MKV: rename the Matroska timestamp fields to differentiate with VLC_TS ones

Steve Lhomme robUx4 at videolabs.io
Mon Mar 16 11:27:32 CET 2015


Replaces "split time values between container ones and VLC ones" patches
---
 modules/demux/mkv/chapter_command.cpp        |  6 +--
 modules/demux/mkv/demux.cpp                  |  2 +-
 modules/demux/mkv/demux.hpp                  |  4 +-
 modules/demux/mkv/matroska_segment.cpp       | 68 ++++++++++++++--------------
 modules/demux/mkv/matroska_segment.hpp       |  6 +--
 modules/demux/mkv/matroska_segment_parse.cpp |  2 +-
 modules/demux/mkv/mkv.cpp                    | 30 ++++++------
 modules/demux/mkv/mkv.hpp                    |  2 +-
 modules/demux/mkv/virtual_segment.cpp        | 50 ++++++++++----------
 modules/demux/mkv/virtual_segment.hpp        | 14 +++---
 10 files changed, 91 insertions(+), 93 deletions(-)

diff --git a/modules/demux/mkv/chapter_command.cpp b/modules/demux/mkv/chapter_command.cpp
index defb95c..a6821d6 100644
--- a/modules/demux/mkv/chapter_command.cpp
+++ b/modules/demux/mkv/chapter_command.cpp
@@ -531,7 +531,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             {
                 if ( !p_chapter->Enter( true ) )
                     // jump to the location in the found segment
-                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_virtual_start_time, p_chapter, -1 );
+                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_mk_virtual_start_time, p_chapter, -1 );
 
                 f_result = true;
             }
@@ -549,7 +549,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             {
                 if ( !p_chapter->Enter( true ) )
                     // jump to the location in the found segment
-                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_virtual_start_time, p_chapter, -1 );
+                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_mk_virtual_start_time, p_chapter, -1 );
 
                 f_result = true;
             }
@@ -749,7 +749,7 @@ bool matroska_script_interpretor_c::Interpret( const binary * p_command, size_t
         else
         {
             if ( !p_chapter->EnterAndLeave( sys.p_current_segment->CurrentChapter() ) )
-                p_segment->Seek( sys.demuxer, p_chapter->i_virtual_start_time, p_chapter, -1 );
+                p_segment->Seek( sys.demuxer, p_chapter->i_mk_virtual_start_time, p_chapter, -1 );
             b_result = true;
         }
     }
diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index 21a2547..c49c5cb 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -808,7 +808,7 @@ void demux_sys_t::JumpTo( virtual_segment_c & vsegment, virtual_chapter_c * p_ch
         if ( !p_chapter->p_chapter || !p_chapter->p_chapter->Enter( true ) )
         {
             // jump to the location in the found segment
-            vsegment.Seek( demuxer, p_chapter->i_virtual_start_time, p_chapter, -1 );
+            vsegment.Seek( demuxer, p_chapter->i_mk_virtual_start_time, p_chapter, -1 );
         }
     }
 
diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index eaefa95..0ebef69 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -334,7 +334,7 @@ public:
         ,i_pts(VLC_TS_INVALID)
         ,i_pcr(VLC_TS_INVALID)
         ,i_start_pts(VLC_TS_0)
-        ,i_chapter_time(0)
+        ,i_mk_chapter_time(0)
         ,meta(NULL)
         ,i_current_title(0)
         ,p_current_segment(NULL)
@@ -354,7 +354,7 @@ public:
     mtime_t                 i_pts;
     mtime_t                 i_pcr;
     mtime_t                 i_start_pts;
-    mtime_t                 i_chapter_time;
+    mtime_t                 i_mk_chapter_time;
 
     vlc_meta_t              *meta;
 
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 35fa678..645d688 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -33,7 +33,7 @@ matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estr
     ,es(estream)
     ,i_timescale(MKVD_TIMECODESCALE)
     ,i_duration(-1)
-    ,i_start_time(0)
+    ,i_mk_start_time(0)
     ,i_seekhead_count(0)
     ,i_seekhead_position(-1)
     ,i_cues_position(-1)
@@ -129,7 +129,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
             idx.i_track       = -1;
             idx.i_block_number= -1;
             idx.i_position    = -1;
-            idx.i_time        = -1;
+            idx.i_mk_time     = -1;
             idx.b_key         = true;
 
             ep->Down();
@@ -154,7 +154,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
                         b_invalid_cue = true;
                         break;
                     }
-                    idx.i_time = uint64( ctime ) * i_timescale / INT64_C(1000);
+                    idx.i_mk_time = uint64( ctime ) * i_timescale / INT64_C(1000);
                 }
                 else if( MKV_IS_ID( el, KaxCueTrackPositions ) )
                 {
@@ -598,7 +598,7 @@ void matroska_segment_c::IndexAppendCluster( KaxCluster *cluster )
     idx.i_track       = -1;
     idx.i_block_number= -1;
     idx.i_position    = cluster->GetElementPosition();
-    idx.i_time        = cluster->GlobalTimecode() / INT64_C(1000);
+    idx.i_mk_time     = cluster->GlobalTimecode() / INT64_C(1000);
     idx.b_key         = true;
 
     i_index++;
@@ -868,25 +868,25 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int
 
 struct spoint
 {
-    spoint(unsigned int tk, mtime_t date, int64_t pos, int64_t cpos):
-        i_track(tk),i_date(date), i_seek_pos(pos),
+    spoint(unsigned int tk, mtime_t mk_date, int64_t pos, int64_t cpos):
+        i_track(tk),i_mk_date(mk_date), i_seek_pos(pos),
         i_cluster_pos(cpos), p_next(NULL){}
     unsigned int     i_track;
-    mtime_t i_date;
+    mtime_t i_mk_date;
     int64_t i_seek_pos;
     int64_t i_cluster_pos;
     spoint * p_next;
 };
 
-void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_global_position )
+void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int64_t i_global_position )
 {
     KaxBlock    *block;
     KaxSimpleBlock *simpleblock;
     int64_t     i_block_duration;
     size_t      i_track;
     int64_t     i_seek_position = i_start_pos;
-    int64_t     i_seek_time = i_start_time;
-    mtime_t     i_pts = 0;
+    mtime_t     i_mk_seek_time = i_mk_start_time;
+    mtime_t     i_mk_pts = 0;
     spoint *p_first = NULL;
     spoint *p_last = NULL;
     int i_cat;
@@ -931,7 +931,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
     }
 
     /* Don't try complex seek if we seek to 0 */
-    if( i_date == 0 && i_time_offset == 0 )
+    if( i_mk_date == 0 && i_mk_time_offset == 0 )
     {
         es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, VLC_TS_0 );
         es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME,
@@ -953,17 +953,17 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
     {
 
         for( ; i_idx < i_index; i_idx++ )
-            if( p_indexes[i_idx].i_time != -1 && p_indexes[i_idx].i_time + i_time_offset > i_date )
+            if( p_indexes[i_idx].i_mk_time != -1 && p_indexes[i_idx].i_mk_time + i_mk_time_offset > i_mk_date )
                 break;
 
         if( i_idx > 0 )
             i_idx--;
 
         i_seek_position = p_indexes[i_idx].i_position;
-        i_seek_time = p_indexes[i_idx].i_time;
+        i_mk_seek_time = p_indexes[i_idx].i_mk_time;
     }
 
-    msg_Dbg( &sys.demuxer, "seek got %" PRId64 " - %" PRId64, i_seek_time, i_seek_position );
+    msg_Dbg( &sys.demuxer, "seek got %" PRId64 " - %" PRId64, i_mk_seek_time, i_seek_position );
 
     es.I_O().setFilePointer( i_seek_position, seek_beginning );
 
@@ -972,7 +972,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
                          var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
     cluster = NULL;
 
-    sys.i_start_pts = i_date + VLC_TS_0;
+    sys.i_start_pts = i_mk_date + VLC_TS_0;
 
     /* now parse until key frame */
     const int es_types[3] = { VIDEO_ES, AUDIO_ES, SPU_ES };
@@ -995,7 +995,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
             }
             if( tracks[i_track]->fmt.i_cat == i_cat )
             {
-                spoint * seekpoint = new spoint(i_track, i_seek_time, i_seek_position, i_seek_position);
+                spoint * seekpoint = new spoint(i_track, i_mk_seek_time, i_seek_position, i_seek_position);
                 if( unlikely( !seekpoint ) )
                 {
                     for( spoint * sp = p_first; sp; )
@@ -1024,11 +1024,11 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
     /*Neither video nor audio track... no seek further*/
     if( unlikely( !p_first ) )
     {
-        es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, i_date + VLC_TS_0 );
-        es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date );
+        es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, i_mk_date + VLC_TS_0 );
+        es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_mk_date );
         return;
     }
-    i_date -= i_seek_preroll;
+    i_mk_date -= i_seek_preroll;
     for(;;)
     {
         do
@@ -1056,9 +1056,9 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
             }
 
             if( simpleblock )
-                i_pts = sys.i_chapter_time + simpleblock->GlobalTimecode() / INT64_C(1000);
+                i_mk_pts = sys.i_mk_chapter_time + simpleblock->GlobalTimecode() / INT64_C(1000);
             else
-                i_pts = sys.i_chapter_time + block->GlobalTimecode() / INT64_C(1000);
+                i_mk_pts = sys.i_mk_chapter_time + block->GlobalTimecode() / INT64_C(1000);
             if( i_track < tracks.size() )
             {
                 if( tracks[i_track]->fmt.i_cat == i_cat && b_key_picture )
@@ -1069,7 +1069,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
                         if( sp->i_track == i_track )
                             break;
 
-                    sp->i_date = i_pts;
+                    sp->i_mk_date = i_mk_pts;
                     if( simpleblock )
                         sp->i_seek_pos = simpleblock->GetElementPosition();
                     else
@@ -1080,14 +1080,14 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
             }
 
             delete block;
-        } while( i_pts < i_date );
+        } while( i_mk_pts < i_mk_date );
         if( b_has_key || !i_idx )
             break;
 
         /* No key picture was found in the cluster seek to previous seekpoint */
-        i_date = i_time_offset + p_indexes[i_idx].i_time;
+        i_mk_date = i_mk_time_offset + p_indexes[i_idx].i_mk_time;
         i_idx--;
-        i_pts = 0;
+        i_mk_pts = 0;
         es.I_O().setFilePointer( p_indexes[i_idx].i_position );
         delete ep;
         ep = new EbmlParser( &es, segment, &sys.demuxer,
@@ -1098,12 +1098,12 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
     /* rewind to the last I img */
     spoint * p_min;
     for( p_min  = p_first, p_last = p_first; p_last; p_last = p_last->p_next )
-        if( p_last->i_date < p_min->i_date )
+        if( p_last->i_mk_date < p_min->i_mk_date )
             p_min = p_last;
 
-    sys.i_pcr = sys.i_pts = p_min->i_date + VLC_TS_0;
+    sys.i_pcr = sys.i_pts = p_min->i_mk_date + VLC_TS_0;
     es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, sys.i_pcr );
-    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date );
+    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_mk_date );
     cluster = (KaxCluster *) ep->UnGet( p_min->i_seek_pos, p_min->i_cluster_pos );
 
     /* hack use BlockGet to get the cluster then goto the wanted block */
@@ -1304,7 +1304,7 @@ void matroska_segment_c::EnsureDuration()
     es.I_O().setFilePointer( i_current_position, seek_beginning );
 }
 
-bool matroska_segment_c::Select( mtime_t i_start_time )
+bool matroska_segment_c::Select( mtime_t i_mk_start_time )
 {
     /* add all es */
     msg_Dbg( &sys.demuxer, "found %d es", (int)tracks.size() );
@@ -1336,9 +1336,9 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                             p_tk->p_es );
         }
     }
-    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_start_time );
+    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_mk_start_time );
 
-    sys.i_start_pts = i_start_time + VLC_TS_0;
+    sys.i_start_pts = i_mk_start_time + VLC_TS_0;
     // reset the stream reading to the first cluster of the segment used
     es.I_O().setFilePointer( i_start_pos );
 
@@ -1424,12 +1424,12 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
 
             /* update the index */
 #define idx p_indexes[i_index - 1]
-            if( i_index > 0 && idx.i_time == -1 )
+            if( i_index > 0 && idx.i_mk_time == -1 )
             {
                 if ( pp_simpleblock != NULL )
-                    idx.i_time        = pp_simpleblock->GlobalTimecode() / INT64_C(1000);
+                    idx.i_mk_time = pp_simpleblock->GlobalTimecode() / INT64_C(1000);
                 else
-                    idx.i_time        = (*pp_block).GlobalTimecode() / INT64_C(1000);
+                    idx.i_mk_time = (*pp_block).GlobalTimecode() / INT64_C(1000);
                 idx.b_key         = *pb_key_picture;
             }
 #undef idx
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index e29d8dd..8a9d9f6 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -83,7 +83,7 @@ public:
 
     /* duration of the segment */
     mtime_t                 i_duration;
-    mtime_t                 i_start_time;
+    mtime_t                 i_mk_start_time;
 
     /* all tracks */
     std::vector<mkv_track_t*> tracks;
@@ -136,13 +136,13 @@ public:
     bool Preload();
     bool PreloadFamily( const matroska_segment_c & segment );
     void InformationCreate();
-    void Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_global_position );
+    void Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int64_t i_global_position );
     int BlockGet( KaxBlock * &, KaxSimpleBlock * &, bool *, bool *, int64_t *);
 
     int BlockFindTrackIndex( size_t *pi_track,
                              const KaxBlock *, const KaxSimpleBlock * );
 
-    bool Select( mtime_t i_start_time );
+    bool Select( mtime_t i_mk_start_time );
     void UnSelect();
 
     static bool CompareSegmentUIDs( const matroska_segment_c * item_a, const matroska_segment_c * item_b );
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 9b82d4c..93dfa4e 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1277,7 +1277,7 @@ void matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
     }
 
     if( b_update_start_time )
-        i_start_time = cluster->GlobalTimecode() / 1000;
+        i_mk_start_time = cluster->GlobalTimecode() / 1000;
 }
 
 
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index bc4e999..58879f7 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -81,7 +81,7 @@ struct demux_sys_t;
 
 static int  Demux  ( demux_t * );
 static int  Control( demux_t *, int, va_list );
-static void Seek   ( demux_t *, mtime_t i_date, double f_percent, virtual_chapter_c *p_chapter );
+static void Seek   ( demux_t *, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_chapter );
 
 /*****************************************************************************
  * Open: initializes matroska demux structures
@@ -332,7 +332,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_GET_POSITION:
             pf = (double*)va_arg( args, double * );
             if ( p_sys->f_duration > 0.0 )
-                *pf = (double)(p_sys->i_pts >= p_sys->i_start_pts ? p_sys->i_pts : p_sys->i_start_pts ) / (1000.0 * p_sys->f_duration);
+                *pf = (double)(p_sys->i_pcr >= p_sys->i_start_pts ? p_sys->i_pcr : p_sys->i_start_pts ) / (1000.0 * p_sys->f_duration);
             return VLC_SUCCESS;
 
         case DEMUX_SET_POSITION:
@@ -346,7 +346,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_TIME:
             pi64 = (int64_t*)va_arg( args, int64_t * );
-            *pi64 = p_sys->i_pts;
+            *pi64 = p_sys->i_pcr;
             return VLC_SUCCESS;
 
         case DEMUX_GET_TITLE_INFO:
@@ -424,7 +424,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 }
 
 /* Seek */
-static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_chapter_c *p_chapter )
+static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_chapter )
 {
     demux_sys_t        *p_sys = p_demux->p_sys;
     virtual_segment_c  *p_vsegment = p_sys->p_current_segment;
@@ -433,8 +433,8 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
 
     int         i_index;
 
-    msg_Dbg( p_demux, "seek request to %" PRId64 " (%f%%)", i_date, f_percent );
-    if( i_date < 0 && f_percent < 0 )
+    msg_Dbg( p_demux, "seek request to %" PRId64 " (%f%%)", i_mk_date, f_percent );
+    if( i_mk_date < 0 && f_percent < 0 )
     {
         msg_Warn( p_demux, "cannot seek nowhere!" );
         return;
@@ -456,9 +456,9 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
     }
 
     /* seek without index or without date */
-    if( f_percent >= 0 && (var_InheritBool( p_demux, "mkv-seek-percent" ) || !p_segment->b_cues || i_date < 0 ))
+    if( f_percent >= 0 && (var_InheritBool( p_demux, "mkv-seek-percent" ) || !p_segment->b_cues || i_mk_date < 0 ))
     {
-        i_date = int64_t( f_percent * p_sys->f_duration * 1000.0 );
+        i_mk_date = int64_t( f_percent * p_sys->f_duration * 1000.0 );
         if( !p_segment->b_cues )
         {
             int64_t i_pos = int64_t( f_percent * stream_Size( p_demux->s ) );
@@ -467,7 +467,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
             for( i_index = 0; i_index < p_segment->i_index; i_index++ )
             {
                 if( p_segment->p_indexes[i_index].i_position >= i_pos &&
-                    p_segment->p_indexes[i_index].i_time != -1 )
+                    p_segment->p_indexes[i_index].i_mk_time != -1 )
                     break;
             }
             if( i_index == p_segment->i_index )
@@ -480,7 +480,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
             }
         }
     }
-    p_vsegment->Seek( *p_demux, i_date, p_chapter, i_global_position );
+    p_vsegment->Seek( *p_demux, i_mk_date, p_chapter, i_global_position );
 }
 
 /* Needed by matroska_segment::Seek() and Seek */
@@ -719,10 +719,8 @@ msg_Dbg( p_demux, "block (track=%d) i_dts: %"PRId64" / i_pts: %"PRId64, tk->i_nu
 
         es_out_Send( p_demux->out, tk->p_es, p_block );
 
-        /* use time stamp only for first block */
-        i_pts = ( tk->i_default_duration )?
-                 i_pts + ( mtime_t )tk->i_default_duration:
-                 VLC_TS_INVALID;
+        // prepare the pts for the next frame in the lace
+        i_pts += tk->i_default_duration ? tk->i_default_duration : 1;
     }
 }
 
@@ -776,7 +774,7 @@ static int Demux( demux_t *p_demux)
                 {
                     /* TODO handle successive chapters with the same user_start_time/user_end_time
                     */
-                    p_sys->i_pts = p_chap->i_virtual_stop_time + VLC_TS_0;
+                    p_sys->i_pts = p_chap->i_mk_virtual_stop_time + VLC_TS_0;
                     p_sys->i_pts++; // trick to avoid staying on segments with no duration and no content
 
                     i_return = 1;
@@ -795,7 +793,7 @@ static int Demux( demux_t *p_demux)
             p_sys->i_pts = (mtime_t)simpleblock->GlobalTimecode() / INT64_C(1000);
         else
             p_sys->i_pts = (mtime_t)block->GlobalTimecode() / INT64_C(1000);
-        p_sys->i_pts += p_sys->i_chapter_time + VLC_TS_0;
+        p_sys->i_pts += p_sys->i_mk_chapter_time + VLC_TS_0;
 
         if( p_sys->i_pts >= p_sys->i_start_pts  )
         {
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 4e2963e..7157bda 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -250,7 +250,7 @@ struct mkv_index_t
     int     i_block_number;
 
     int64_t i_position;
-    int64_t i_time;
+    mtime_t i_mk_time;
 
     bool       b_key;
 };
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 6b5e556..c7852d6 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -89,7 +89,7 @@ virtual_chapter_c * virtual_chapter_c::CreateVirtualChapter( chapter_item_c * p_
 
     msg_Dbg( &p_main_segment->sys.demuxer,
              "Virtual chapter %s from %" PRId64 " to %" PRId64 " - " ,
-             p_chap->psz_name.c_str(), p_vchap->i_virtual_start_time, p_vchap->i_virtual_stop_time );
+             p_chap->psz_name.c_str(), p_vchap->i_mk_virtual_start_time, p_vchap->i_mk_virtual_stop_time );
 
     return p_vchap;
 }
@@ -123,7 +123,7 @@ virtual_edition_c::virtual_edition_c( chapter_edition_c * p_edit, std::vector<ma
                 chapters.push_back( p_vchap );
         }
         if( chapters.size() )
-            i_duration = chapters[ chapters.size() - 1 ]->i_virtual_stop_time;
+            i_duration = chapters[ chapters.size() - 1 ]->i_mk_virtual_stop_time;
         else
             i_duration = 0; /* Empty ordered editions will be ignored */
     }
@@ -222,16 +222,16 @@ virtual_edition_c::~virtual_edition_c()
 
 void virtual_edition_c::retimeSubChapters( virtual_chapter_c * p_vchap )
 {
-    int64_t stop_time = p_vchap->i_virtual_stop_time;
+    mtime_t i_mk_stop_time = p_vchap->i_mk_virtual_stop_time;
     for( size_t i = p_vchap->sub_chapters.size(); i-- > 0; )
     {
         virtual_chapter_c * p_vsubchap = p_vchap->sub_chapters[i];
-        //p_vsubchap->i_virtual_start_time += p_vchap->i_virtual_start_time;
+        //p_vsubchap->i_mk_virtual_start_time += p_vchap->i_mk_virtual_start_time;
 
         /*FIXME we artificially extend stop time if they were there before...*/
         /* Just for comfort*/
-        p_vsubchap->i_virtual_stop_time = stop_time;
-        stop_time = p_vsubchap->i_virtual_start_time;
+        p_vsubchap->i_mk_virtual_stop_time = i_mk_stop_time;
+        i_mk_stop_time = p_vsubchap->i_mk_virtual_start_time;
 
         retimeSubChapters( p_vsubchap );
     }
@@ -250,9 +250,9 @@ void virtual_edition_c::retimeChapters()
     {
         virtual_chapter_c * p_vchap = chapters[i];
 
-        p_vchap->i_virtual_start_time = i_duration;
+        p_vchap->i_mk_virtual_start_time = i_duration;
         i_duration += p_vchap->p_segment->i_duration * 1000;
-        p_vchap->i_virtual_stop_time = i_duration;
+        p_vchap->i_mk_virtual_stop_time = i_duration;
 
         retimeSubChapters( p_vchap );
     }
@@ -376,7 +376,7 @@ virtual_chapter_c* virtual_chapter_c::getSubChapterbyTimecode( int64_t time )
 {
     for( size_t i = 0; i < sub_chapters.size(); i++ )
     {
-        if( time >= sub_chapters[i]->i_virtual_start_time && time < sub_chapters[i]->i_virtual_stop_time )
+        if( time >= sub_chapters[i]->i_mk_virtual_start_time && time < sub_chapters[i]->i_mk_virtual_stop_time )
             return sub_chapters[i]->getSubChapterbyTimecode( time );
     }
 
@@ -387,8 +387,8 @@ virtual_chapter_c* virtual_edition_c::getChapterbyTimecode( int64_t time )
 {
     for( size_t i = 0; i < chapters.size(); i++ )
     {
-        if( time >= chapters[i]->i_virtual_start_time &&
-            ( chapters[i]->i_virtual_stop_time < 0 || time < chapters[i]->i_virtual_stop_time ) )
+        if( time >= chapters[i]->i_mk_virtual_start_time &&
+            ( chapters[i]->i_mk_virtual_stop_time < 0 || time < chapters[i]->i_mk_virtual_stop_time ) )
             /*with the current implementation only the last chapter can have a negative virtual_stop_time*/
             return chapters[i]->getSubChapterbyTimecode( time );
     }
@@ -423,11 +423,11 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
                         ( p_current_chapter && p_current_chapter->p_segment != p_cur_chapter->p_segment ) ||
                         ( p_current_chapter->p_chapter->i_end_time != p_cur_chapter->p_chapter->i_start_time ))
                     {
-                        Seek( demux, p_cur_chapter->i_virtual_start_time, p_cur_chapter, -1 );
+                        Seek( demux, p_cur_chapter->i_mk_virtual_start_time, p_cur_chapter, -1 );
                         return true;
                     }
                 }
-                sys.i_start_pts = p_cur_chapter->i_virtual_start_time + VLC_TS_0;
+                sys.i_start_pts = p_cur_chapter->i_mk_virtual_start_time + VLC_TS_0;
             }
 
             p_current_chapter = p_cur_chapter;
@@ -463,7 +463,7 @@ bool virtual_chapter_c::EnterAndLeave( virtual_chapter_c *p_item, bool b_enter )
     return p_chapter->EnterAndLeave( p_item->p_chapter, b_enter );
 }
 
-void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_date,
+void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
                               virtual_chapter_c *p_chapter, int64_t i_global_position )
 {
     demux_sys_t *p_sys = demuxer.p_sys;
@@ -472,12 +472,12 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_date,
     /* find the actual time for an ordered edition */
     if ( p_chapter == NULL )
         /* 1st, we need to know in which chapter we are */
-        p_chapter = editions[ i_current_edition ]->getChapterbyTimecode( i_date );
+        p_chapter = editions[ i_current_edition ]->getChapterbyTimecode( i_mk_date );
 
     if ( p_chapter != NULL )
     {
-        mtime_t i_time_offset = p_chapter->i_virtual_start_time - ( ( p_chapter->p_chapter )? p_chapter->p_chapter->i_start_time : 0 );
-        p_sys->i_chapter_time = i_time_offset - p_chapter->p_segment->i_start_time;
+        mtime_t i_mk_time_offset = p_chapter->i_mk_virtual_start_time - ( ( p_chapter->p_chapter )? p_chapter->p_chapter->i_start_time : 0 );
+        p_sys->i_mk_chapter_time = i_mk_time_offset - p_chapter->p_segment->i_mk_start_time;
         if ( p_chapter->p_chapter && p_chapter->i_seekpoint_num > 0 )
         {
             demuxer.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
@@ -486,10 +486,10 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_date,
         }
 
         if( p_current_chapter->p_segment != p_chapter->p_segment )
-            ChangeSegment( p_current_chapter->p_segment, p_chapter->p_segment, i_date );
+            ChangeSegment( p_current_chapter->p_segment, p_chapter->p_segment, i_mk_date );
         p_current_chapter = p_chapter;
 
-        p_chapter->p_segment->Seek( i_date, i_time_offset, i_global_position );
+        p_chapter->p_segment->Seek( i_mk_date, i_mk_time_offset, i_global_position );
     }
 }
 
@@ -531,12 +531,12 @@ int virtual_chapter_c::PublishChapters( input_title_t & title, int & i_user_chap
     }
 
     if ( ( p_chapter && p_chapter->b_display_seekpoint &&
-         ( ( sub_chapters.size() > 0 && i_virtual_start_time != sub_chapters[0]->i_virtual_start_time) ||
+         ( ( sub_chapters.size() > 0 && i_mk_virtual_start_time != sub_chapters[0]->i_mk_virtual_start_time) ||
            sub_chapters.size() == 0 ) ) || !p_chapter )
     {
         seekpoint_t *sk = vlc_seekpoint_New();
 
-        sk->i_time_offset = i_virtual_start_time;
+        sk->i_time_offset = i_mk_virtual_start_time;
         if( p_chapter )
             sk->psz_name = strdup( p_chapter->psz_name.c_str() );
         else
@@ -565,7 +565,7 @@ int virtual_edition_c::PublishChapters( input_title_t & title, int & i_user_chap
 
     /* HACK for now don't expose edition as a seekpoint if its start time is the same than it's first chapter */
     if( chapters.size() > 0 &&
-        chapters[0]->i_virtual_start_time && p_edition )
+        chapters[0]->i_mk_virtual_start_time && p_edition )
     {
         seekpoint_t *sk = vlc_seekpoint_New();
 
@@ -615,13 +615,13 @@ bool virtual_chapter_c::Leave( bool b_do_subs )
 void virtual_chapter_c::print()
 {
     msg_Dbg( &p_segment->sys.demuxer, "*** chapter %"PRId64" - %"PRId64" (%u)",
-             i_virtual_start_time, i_virtual_stop_time, sub_chapters.size() );
+             i_mk_virtual_start_time, i_mk_virtual_stop_time, sub_chapters.size() );
     for( size_t i = 0; i < sub_chapters.size(); i++ )
         sub_chapters[i]->print();
 }
 #endif
 
-void virtual_segment_c::ChangeSegment( matroska_segment_c * p_old, matroska_segment_c * p_new, mtime_t i_start_time )
+void virtual_segment_c::ChangeSegment( matroska_segment_c * p_old, matroska_segment_c * p_new, mtime_t i_mk_start_time )
 {
     size_t i, j;
     char *sub_lang = NULL, *aud_lang = NULL;
@@ -690,6 +690,6 @@ void virtual_segment_c::ChangeSegment( matroska_segment_c * p_old, matroska_segm
             p_tk->b_forced = true;
         }
     }
-    p_new->Select( i_start_time );
+    p_new->Select( i_mk_start_time );
     p_old->UnSelect();
 }
diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
index 5e9249b..94ed1e2 100644
--- a/modules/demux/mkv/virtual_segment.hpp
+++ b/modules/demux/mkv/virtual_segment.hpp
@@ -38,7 +38,7 @@ class virtual_chapter_c
 public:
     virtual_chapter_c( matroska_segment_c *p_seg, chapter_item_c *p_chap, int64_t start, int64_t stop ):
         p_segment(p_seg), p_chapter(p_chap),
-        i_virtual_start_time(start), i_virtual_stop_time(stop)
+        i_mk_virtual_start_time(start), i_mk_virtual_stop_time(stop)
     {}
     ~virtual_chapter_c();
 
@@ -63,13 +63,13 @@ public:
 
     static bool CompareTimecode( const virtual_chapter_c * itemA, const virtual_chapter_c * itemB )
     {
-        return ( itemA->i_virtual_start_time < itemB->i_virtual_start_time );
+        return ( itemA->i_mk_virtual_start_time < itemB->i_mk_virtual_start_time );
     }
 
     matroska_segment_c  *p_segment;
     chapter_item_c      *p_chapter;
-    int64_t             i_virtual_start_time;
-    int64_t             i_virtual_stop_time;
+    mtime_t             i_mk_virtual_start_time;
+    mtime_t             i_mk_virtual_stop_time;
     int                 i_seekpoint_num;
     std::vector<virtual_chapter_c *> sub_chapters;
 #ifdef MKV_DEBUG
@@ -94,7 +94,7 @@ public:
                                              const void *p_cookie, size_t i_cookie_size );
 
     bool                b_ordered;
-    int64_t             i_duration;
+    mtime_t             i_duration;
     chapter_edition_c   *p_edition;
     int                 i_seekpoint_num;
 
@@ -155,10 +155,10 @@ public:
     virtual_chapter_c * FindChapter( int64_t i_find_uid );
 
     bool UpdateCurrentToChapter( demux_t & demux );
-    void Seek( demux_t & demuxer, mtime_t i_date,
+    void Seek( demux_t & demuxer, mtime_t i_mk_date,
                virtual_chapter_c *p_chapter, int64_t i_global_position );
 private:
-    void ChangeSegment( matroska_segment_c * p_old, matroska_segment_c * p_new, mtime_t i_start_time );
+    void ChangeSegment( matroska_segment_c * p_old, matroska_segment_c * p_new, mtime_t i_mk_start_time );
 };
 
 #endif
-- 
2.3.2




More information about the vlc-devel mailing list