[vlc-devel] [PATCH] MKV: use int64_t for the Matroska timestamps to avoid confusion with mtime_t
Steve Lhomme
robUx4 at videolabs.io
Mon Mar 16 09:39:36 CET 2015
---
modules/demux/mkv/demux.hpp | 2 +-
modules/demux/mkv/matroska_segment.cpp | 12 ++++++------
modules/demux/mkv/matroska_segment.hpp | 8 ++++----
modules/demux/mkv/matroska_segment_parse.cpp | 4 ++--
modules/demux/mkv/mkv.cpp | 8 ++++----
modules/demux/mkv/mkv.hpp | 8 ++++----
modules/demux/mkv/virtual_segment.cpp | 6 +++---
modules/demux/mkv/virtual_segment.hpp | 4 ++--
8 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index eaefa95..0cfd9dd 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -354,7 +354,7 @@ public:
mtime_t i_pts;
mtime_t i_pcr;
mtime_t i_start_pts;
- mtime_t i_chapter_time;
+ int64_t i_chapter_time;
vlc_meta_t *meta;
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 35fa678..31aa6a4 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -868,17 +868,17 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int
struct spoint
{
- spoint(unsigned int tk, mtime_t date, int64_t pos, int64_t cpos):
+ spoint(unsigned int tk, int64_t date, int64_t pos, int64_t cpos):
i_track(tk),i_date(date), i_seek_pos(pos),
i_cluster_pos(cpos), p_next(NULL){}
unsigned int i_track;
- mtime_t i_date;
+ int64_t i_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( int64_t i_date, int64_t i_time_offset, int64_t i_global_position )
{
KaxBlock *block;
KaxSimpleBlock *simpleblock;
@@ -886,7 +886,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
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;
+ int64_t i_pts = 0;
spoint *p_first = NULL;
spoint *p_last = NULL;
int i_cat;
@@ -977,7 +977,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
/* now parse until key frame */
const int es_types[3] = { VIDEO_ES, AUDIO_ES, SPU_ES };
i_cat = es_types[0];
- mtime_t i_seek_preroll = 0;
+ int64_t i_seek_preroll = 0;
for( int i = 0; i < 2; i_cat = es_types[++i] )
{
for( i_track = 0; i_track < tracks.size(); i_track++ )
@@ -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( int64_t i_start_time )
{
/* add all es */
msg_Dbg( &sys.demuxer, "found %d es", (int)tracks.size() );
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index e29d8dd..672888d 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -82,8 +82,8 @@ public:
uint64_t i_timescale;
/* duration of the segment */
- mtime_t i_duration;
- mtime_t i_start_time;
+ int64_t i_duration;
+ int64_t i_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( int64_t i_date, int64_t i_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( int64_t i_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..6156215 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -848,7 +848,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
{
KaxDuration &dur = *(KaxDuration*)l;
- i_duration = mtime_t( double( dur ) );
+ i_duration = int64_t( double( dur ) );
msg_Dbg( &sys.demuxer, "| | + Duration=%" PRId64,
i_duration );
@@ -958,7 +958,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
}
double f_dur = double(i_duration) * double(i_timescale) / 1000000.0;
- i_duration = mtime_t(f_dur);
+ i_duration = int64_t(f_dur);
if( !i_duration ) i_duration = -1;
}
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 0ee557d..1a3a990 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 *, int64_t i_date, double f_percent, virtual_chapter_c *p_chapter );
/*****************************************************************************
* Open: initializes matroska demux structures
@@ -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, int64_t i_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;
@@ -485,7 +485,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
/* Needed by matroska_segment::Seek() and Seek */
void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
- mtime_t i_pts, mtime_t i_duration, bool b_key_picture,
+ mtime_t i_pts, int64_t i_duration, bool b_key_picture,
bool b_discardable_picture )
{
demux_sys_t *p_sys = p_demux->p_sys;
@@ -622,7 +622,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
break;
case VLC_CODEC_OPUS:
- mtime_t i_length = i_duration * tk-> f_timecodescale *
+ int64_t i_length = i_duration * tk-> f_timecodescale *
(double) p_segment->i_timescale / 1000.0;
if ( i_length < 0 ) i_length = 0;
p_block->i_nb_samples = i_length * tk->fmt.audio.i_rate
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 4e2963e..cd6c0b8 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -125,7 +125,7 @@ using namespace LIBMATROSKA_NAMESPACE;
using namespace std;
void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
- mtime_t i_pts, mtime_t i_duration, bool b_key_picture,
+ mtime_t i_pts, int64_t i_duration, bool b_key_picture,
bool b_discardable_picture );
class attachment_c
@@ -200,7 +200,7 @@ struct mkv_track_t
bool b_pts_only;
bool b_no_duration;
- uint64_t i_default_duration;
+ int64_t i_default_duration;
float f_timecodescale;
mtime_t i_last_dts;
@@ -239,8 +239,8 @@ struct mkv_track_t
KaxContentCompSettings *p_compression_data;
/* Matroska 4 new elements used by Opus */
- mtime_t i_seek_preroll;
- mtime_t i_codec_delay;
+ int64_t i_seek_preroll;
+ int64_t i_codec_delay;
};
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 6b5e556..f2e9a69 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -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, int64_t i_date,
virtual_chapter_c *p_chapter, int64_t i_global_position )
{
demux_sys_t *p_sys = demuxer.p_sys;
@@ -476,7 +476,7 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_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 );
+ int64_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;
if ( p_chapter->p_chapter && p_chapter->i_seekpoint_num > 0 )
{
@@ -621,7 +621,7 @@ void virtual_chapter_c::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, int64_t i_start_time )
{
size_t i, j;
char *sub_lang = NULL, *aud_lang = NULL;
diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
index 5e9249b..06f7374 100644
--- a/modules/demux/mkv/virtual_segment.hpp
+++ b/modules/demux/mkv/virtual_segment.hpp
@@ -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, int64_t i_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, int64_t i_start_time );
};
#endif
--
2.3.2
More information about the vlc-devel
mailing list