[vlc-commits] [Git][videolan/vlc][master] 12 commits: demux/mkv: use regular integer types

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jan 28 09:49:20 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5232df02 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: use regular integer types

They are just aliases in libebml.

- - - - -
fd9220f2 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: include external headers with <>

- - - - -
1c80e8c3 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: remove dead code

- - - - -
7e77a233 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: add override on overriden virtual methods

- - - - -
9481c03a by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: use actual namespaces

The defines were added for a second implementation but it used the same namespace.

- - - - -
a7522745 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: don't assume KaxPrevUID/KaxNextUID are a KaxSegmentUID

They can be compared with their binary data anyway.

- - - - -
1a25f679 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: read the library version before any other header

- - - - -
1567c0d7 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: rename bogus Timecode API with Timestamp

- - - - -
4323b35b by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: use dedicated macro to get the EbmlID of a class

- - - - -
8403c74b by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: use the original name for the Matroska context

There's a define that turns this name into another one. But the macro really generates this name.

- - - - -
3d5a786b by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: read language value with its getter

- - - - -
de03f1e0 by Steve Lhomme at 2024-01-28T09:29:10+00:00
demux/mkv: define the file context with no globals like the real one

We should not access the internal list of the original context directly. The type will change.

In a Matroska or WebM file there can only be an Ebml Header or a Matroska at the top level.
The CRC32 cannot be found. And the Void element should not be found either.

- - - - -


19 changed files:

- modules/demux/mkv/Ebml_dispatcher.hpp
- modules/demux/mkv/Ebml_parser.cpp
- modules/demux/mkv/chapter_command.cpp
- modules/demux/mkv/chapter_command.hpp
- modules/demux/mkv/chapters.cpp
- modules/demux/mkv/chapters.hpp
- modules/demux/mkv/demux.cpp
- modules/demux/mkv/dvd_types.hpp
- modules/demux/mkv/events.cpp
- modules/demux/mkv/events.hpp
- modules/demux/mkv/matroska_segment.cpp
- modules/demux/mkv/matroska_segment.hpp
- modules/demux/mkv/matroska_segment_parse.cpp
- modules/demux/mkv/matroska_segment_seeker.cpp
- modules/demux/mkv/mkv.cpp
- modules/demux/mkv/mkv.hpp
- modules/demux/mkv/stream_io_callback.cpp
- modules/demux/mkv/stream_io_callback.hpp
- modules/demux/mkv/virtual_segment.cpp


Changes:

=====================================
modules/demux/mkv/Ebml_dispatcher.hpp
=====================================
@@ -24,8 +24,8 @@
 
 #include "dispatcher.hpp"
 
-#include "ebml/EbmlElement.h"
-#include "ebml/EbmlId.h"
+#include <ebml/EbmlElement.h>
+#include <ebml/EbmlId.h>
 
 #include <vlc_threads.h>
 
@@ -112,7 +112,7 @@ namespace {
 
 #define E_CASE(EbmlType_, VariableName_)            \
     EBML_ELEMENT_CASE_DEF(EbmlType_, EbmlType_, VariableName_, \
-      (dispatcher.insert( EbmlProcessorEntry( EbmlType_ ::ClassInfos.ClassId(), &EbmlType_ ## _callback) ) ) \
+      (dispatcher.insert( EbmlProcessorEntry( EBML_ID(EbmlType_), &EbmlType_ ## _callback) ) ) \
     )
 
 #define E_CASE_DEFAULT(VariableName_)                    \


=====================================
modules/demux/mkv/Ebml_parser.cpp
=====================================
@@ -123,11 +123,13 @@ static const EbmlSemanticContext & GetEbmlNoGlobal_Context()
 }
 
 // the Segment Context should not allow Void or CRC32 elements to avoid lookup false alarm
-const EbmlSemanticContext Context_KaxSegmentVLC = EbmlSemanticContext(KaxSegment_Context.GetSize(),
-                                                                      KaxSegment_Context.MyTable,
-                                                                      KaxSegment_Context.Parent(),
-                                                                      GetEbmlNoGlobal_Context,
-                                                                      KaxSegment_Context.GetMaster());
+DEFINE_START_SEMANTIC(KaxSegmentVLC)
+DEFINE_SEMANTIC_ITEM(true, true, EbmlHead)
+DEFINE_SEMANTIC_ITEM(false, false, KaxSegment)
+DEFINE_END_SEMANTIC(KaxSegmentVLC)
+
+DEFINE_xxx_CONTEXT(KaxSegmentVLC,GetEbmlNoGlobal_Context)
+
 
 EbmlElement *EbmlParser::Get( bool allow_overshoot )
 {
@@ -167,8 +169,8 @@ next:
             if ( mi_level > 1 && m_el[mi_level-2]->IsFiniteSize() &&
                  m_el[mi_level-1]->GetEndPosition() < m_el[mi_level-2]->GetEndPosition() )
             {
-                uint64 top = m_el[mi_level-2]->GetEndPosition();
-                uint64 bom = m_el[mi_level-1]->GetEndPosition();
+                uint64_t top = m_el[mi_level-2]->GetEndPosition();
+                uint64_t bom = m_el[mi_level-1]->GetEndPosition();
                 i_max_read = top - bom;
             }
         }
@@ -187,8 +189,8 @@ next:
         else if (size_lvl == 0 || !m_el[size_lvl-1]->IsFiniteSize() || !m_el[size_lvl]->IsFiniteSize() )
             i_max_read = UINT64_MAX;
         else {
-            uint64 top = m_el[size_lvl-1]->GetEndPosition();
-            uint64 bom = m_el[mi_level]->GetEndPosition();
+            uint64_t top = m_el[size_lvl-1]->GetEndPosition();
+            uint64_t bom = m_el[mi_level]->GetEndPosition();
             i_max_read = top - bom;
         }
     }


=====================================
modules/demux/mkv/chapter_command.cpp
=====================================
@@ -29,12 +29,12 @@ namespace mkv {
 
 void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command )
 {
-    uint32 codec_time = uint32(-1);
+    uint32_t codec_time = uint32_t(-1);
     for( size_t i = 0; i < command.ListSize(); i++ )
     {
         if( MKV_CHECKED_PTR_DECL_CONST( p_cpt, KaxChapterProcessTime, command[i] ) )
         {
-            codec_time = static_cast<uint32>( *p_cpt );
+            codec_time = static_cast<uint32_t>( *p_cpt );
             break;
         }
     }
@@ -55,14 +55,14 @@ void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command
     }
 }
 
-int16 dvd_chapter_codec_c::GetTitleNumber()
+int16_t dvd_chapter_codec_c::GetTitleNumber()
 {
     if ( p_private_data->GetSize() >= 3)
     {
         const binary* p_data = p_private_data->GetBuffer();
         if ( p_data[0] == MATROSKA_DVD_LEVEL_SS )
         {
-            return int16( (p_data[2] << 8) + p_data[3] );
+            return int16_t( (p_data[2] << 8) + p_data[3] );
         }
     }
     return -1;
@@ -152,19 +152,19 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
     virtual_segment_c *p_vsegment = NULL;
     virtual_chapter_c *p_vchapter = NULL;
     bool f_result = false;
-    uint16 i_command = ( p_command[0] << 8 ) + p_command[1];
+    uint16_t i_command = ( p_command[0] << 8 ) + p_command[1];
 
     // handle register tests if there are some
     if ( (i_command & 0xF0) != 0 )
     {
         bool b_test_positive = true;//(i_command & CMD_DVD_IF_NOT) == 0;
         bool b_test_value    = (i_command & CMD_DVD_TEST_VALUE) != 0;
-        uint8 i_test = i_command & 0x70;
-        uint16 i_value;
+        uint8_t i_test = i_command & 0x70;
+        uint16_t i_value;
 
         // see http://dvd.sourceforge.net/dvdinfo/vmi.html
-        uint8  i_cr1;
-        uint16 i_cr2;
+        uint8_t  i_cr1;
+        uint16_t i_cr2;
         switch ( i_command >> 12 )
         {
         default:
@@ -281,7 +281,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
         }
     case CMD_DVD_JUMP_TT:
         {
-            uint8 i_title = p_command[5];
+            uint8_t i_title = p_command[5];
             msg_Dbg( &sys.demuxer, "JumpTT %d", i_title );
 
             // find in the ChapProcessPrivate matching this Title level
@@ -289,7 +289,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             if ( p_vsegment != NULL && p_vchapter != NULL )
             {
                 /* enter via the First Cell */
-                uint8 i_cell = 1;
+                uint8_t i_cell = 1;
                 p_vchapter = p_vchapter->BrowseCodecPrivate( MATROSKA_CHAPTER_CODEC_DVD, MatchCellNumber, &i_cell, sizeof(i_cell) );
                 if ( p_vchapter != NULL )
                 {
@@ -338,7 +338,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
                     if ( p_vsegment != NULL && p_vchapter != NULL )
                     {
                         /* enter via the first Cell */
-                        uint8 i_cell = 1;
+                        uint8_t i_cell = 1;
                         p_vchapter = p_vchapter->BrowseCodecPrivate( MATROSKA_CHAPTER_CODEC_DVD, MatchCellNumber, &i_cell, sizeof(i_cell) );
                         if ( p_vchapter != NULL )
                         {
@@ -462,8 +462,8 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
         }
     case CMD_DVD_JUMPVTS_PTT:
         {
-            uint8 i_title = p_command[5];
-            uint8 i_ptt = p_command[3];
+            uint8_t i_title = p_command[5];
+            uint8_t i_ptt = p_command[3];
 
             msg_Dbg( &sys.demuxer, "JumpVTS Title (%d) PTT (%d)", i_title, i_ptt);
 
@@ -471,7 +471,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             p_vchapter = sys.p_current_vsegment->BrowseCodecPrivate( 1, MatchIsDomain, NULL, 0 );
             if ( p_vchapter != NULL )
             {
-                int16 i_curr_title = ( p_vchapter->p_chapter )? p_vchapter->p_chapter->GetTitleNumber() : 0;
+                int16_t i_curr_title = ( p_vchapter->p_chapter )? p_vchapter->p_chapter->GetTitleNumber() : 0;
                 if ( i_curr_title > 0 )
                 {
                     p_vchapter = sys.BrowseCodecPrivate( 1, MatchVTSNumber, &i_curr_title, sizeof(i_curr_title), p_vsegment );
@@ -513,7 +513,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
         }
     case CMD_DVD_LINKPGCN:
         {
-            uint16 i_pgcn = (p_command[6] << 8) + p_command[7];
+            uint16_t i_pgcn = (p_command[6] << 8) + p_command[7];
 
             msg_Dbg( &sys.demuxer, "Link PGCN(%d)", i_pgcn );
             p_vchapter = sys.p_current_vsegment->BrowseCodecPrivate( 1, MatchPgcNumber, &i_pgcn, 2 );
@@ -526,7 +526,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
         }
     case CMD_DVD_LINKCN:
         {
-            uint8 i_cn = p_command[7];
+            uint8_t i_cn = p_command[7];
 
             p_vchapter = sys.p_current_vsegment->CurrentChapter();
 
@@ -592,8 +592,8 @@ bool dvd_command_interpretor_c::MatchVTSNumber( const chapter_codec_cmds_c &data
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_SS || data.p_private_data->GetBuffer()[1] != 0x80 )
         return false;
 
-    uint16 i_gtitle = (data.p_private_data->GetBuffer()[2] << 8 ) + data.p_private_data->GetBuffer()[3];
-    uint16 i_title = *static_cast<uint16 const*>( p_cookie );
+    uint16_t i_gtitle = (data.p_private_data->GetBuffer()[2] << 8 ) + data.p_private_data->GetBuffer()[3];
+    uint16_t i_title = *static_cast<uint16_t const*>( p_cookie );
 
     return (i_gtitle == i_title);
 }
@@ -606,8 +606,8 @@ bool dvd_command_interpretor_c::MatchVTSMNumber( const chapter_codec_cmds_c &dat
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_SS || data.p_private_data->GetBuffer()[1] != 0x40 )
         return false;
 
-    uint8 i_gtitle = data.p_private_data->GetBuffer()[3];
-    uint8 i_title = *static_cast<uint8 const*>( p_cookie );
+    uint8_t i_gtitle = data.p_private_data->GetBuffer()[3];
+    uint8_t i_title = *static_cast<uint8_t const*>( p_cookie );
 
     return (i_gtitle == i_title);
 }
@@ -620,8 +620,8 @@ bool dvd_command_interpretor_c::MatchTitleNumber( const chapter_codec_cmds_c &da
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_TT )
         return false;
 
-    uint16 i_gtitle = (data.p_private_data->GetBuffer()[1] << 8 ) + data.p_private_data->GetBuffer()[2];
-    uint8 i_title = *static_cast<uint8 const*>( p_cookie );
+    uint16_t i_gtitle = (data.p_private_data->GetBuffer()[1] << 8 ) + data.p_private_data->GetBuffer()[2];
+    uint8_t i_title = *static_cast<uint8_t const*>( p_cookie );
 
     return (i_gtitle == i_title);
 }
@@ -634,8 +634,8 @@ bool dvd_command_interpretor_c::MatchPgcType( const chapter_codec_cmds_c &data,
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_PGC )
         return false;
 
-    uint8 i_pgc_type = data.p_private_data->GetBuffer()[3] & 0x0F;
-    uint8 i_pgc = *static_cast<uint8 const*>( p_cookie );
+    uint8_t i_pgc_type = data.p_private_data->GetBuffer()[3] & 0x0F;
+    uint8_t i_pgc = *static_cast<uint8_t const*>( p_cookie );
 
     return (i_pgc_type == i_pgc);
 }
@@ -648,8 +648,8 @@ bool dvd_command_interpretor_c::MatchPgcNumber( const chapter_codec_cmds_c &data
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_PGC )
         return false;
 
-    uint16 const* i_pgc_n = static_cast<uint16 const*>( p_cookie );
-    uint16 i_pgc_num = (data.p_private_data->GetBuffer()[1] << 8) + data.p_private_data->GetBuffer()[2];
+    uint16_t const* i_pgc_n = static_cast<uint16_t const*>( p_cookie );
+    uint16_t i_pgc_num = (data.p_private_data->GetBuffer()[1] << 8) + data.p_private_data->GetBuffer()[2];
 
     return (i_pgc_num == *i_pgc_n);
 }
@@ -662,8 +662,8 @@ bool dvd_command_interpretor_c::MatchChapterNumber( const chapter_codec_cmds_c &
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_PTT )
         return false;
 
-    uint8 i_chapter = data.p_private_data->GetBuffer()[1];
-    uint8 i_ptt = *static_cast<uint8 const*>( p_cookie );
+    uint8_t i_chapter = data.p_private_data->GetBuffer()[1];
+    uint8_t i_ptt = *static_cast<uint8_t const*>( p_cookie );
 
     return (i_chapter == i_ptt);
 }
@@ -676,8 +676,8 @@ bool dvd_command_interpretor_c::MatchCellNumber( const chapter_codec_cmds_c &dat
     if ( data.p_private_data->GetBuffer()[0] != MATROSKA_DVD_LEVEL_CN )
         return false;
 
-    uint8 const* i_cell_n = static_cast<uint8 const*>( p_cookie );
-    uint8 i_cell_num = data.p_private_data->GetBuffer()[3];
+    uint8_t const* i_cell_n = static_cast<uint8_t const*>( p_cookie );
+    uint8_t i_cell_num = data.p_private_data->GetBuffer()[3];
 
     return (i_cell_num == *i_cell_n);
 }


=====================================
modules/demux/mkv/chapter_command.hpp
=====================================
@@ -70,7 +70,7 @@ public:
     virtual bool Enter() { return false; }
     virtual bool Leave() { return false; }
     virtual std::string GetCodecName( bool ) const { return ""; }
-    virtual int16 GetTitleNumber() { return -1; }
+    virtual int16_t GetTitleNumber() { return -1; }
 
     KaxChapterProcessPrivate *p_private_data;
 
@@ -103,21 +103,21 @@ public:
 
     bool Interpret( const binary * p_command, size_t i_size = 8 );
 
-    uint16 GetPRM( size_t index ) const
+    uint16_t GetPRM( size_t index ) const
     {
         if ( index < 256 )
             return p_PRMs[ index ];
         else return 0;
     }
 
-    uint16 GetGPRM( size_t index ) const
+    uint16_t GetGPRM( size_t index ) const
     {
         if ( index < 16 )
             return p_PRMs[ index ];
         else return 0;
     }
 
-    uint16 GetSPRM( size_t index ) const
+    uint16_t GetSPRM( size_t index ) const
     {
         // 21,22,23 reserved for future use
         if ( index >= 0x80 && index < 0x95 )
@@ -125,7 +125,7 @@ public:
         else return 0;
     }
 
-    bool SetPRM( size_t index, uint16 value )
+    bool SetPRM( size_t index, uint16_t value )
     {
         if ( index < 16 )
         {
@@ -135,7 +135,7 @@ public:
         return false;
     }
 
-    bool SetGPRM( size_t index, uint16 value )
+    bool SetGPRM( size_t index, uint16_t value )
     {
         if ( index < 16 )
         {
@@ -145,7 +145,7 @@ public:
         return false;
     }
 
-    bool SetSPRM( size_t index, uint16 value )
+    bool SetSPRM( size_t index, uint16_t value )
     {
         if ( index > 0x80 && index <= 0x8D && index != 0x8C )
         {
@@ -156,7 +156,7 @@ public:
     }
 
 protected:
-    std::string GetRegTypeName( bool b_value, uint16 value ) const
+    std::string GetRegTypeName( bool b_value, uint16_t value ) const
     {
         std::string result;
         char s_value[6], s_reg_value[6];
@@ -189,50 +189,50 @@ protected:
         return result;
     }
 
-    uint16       p_PRMs[256];
+    uint16_t       p_PRMs[256];
     demux_sys_t  & sys;
 
     // DVD command IDs
 
     // Tests
     // whether it's a comparison on the value or register
-    static const uint16 CMD_DVD_TEST_VALUE          = 0x80;
-    static const uint16 CMD_DVD_IF_GPREG_AND        = (1 << 4);
-    static const uint16 CMD_DVD_IF_GPREG_EQUAL      = (2 << 4);
-    static const uint16 CMD_DVD_IF_GPREG_NOT_EQUAL  = (3 << 4);
-    static const uint16 CMD_DVD_IF_GPREG_SUP_EQUAL  = (4 << 4);
-    static const uint16 CMD_DVD_IF_GPREG_SUP        = (5 << 4);
-    static const uint16 CMD_DVD_IF_GPREG_INF_EQUAL  = (6 << 4);
-    static const uint16 CMD_DVD_IF_GPREG_INF        = (7 << 4);
-
-    static const uint16 CMD_DVD_NOP                    = 0x0000;
-    static const uint16 CMD_DVD_GOTO_LINE              = 0x0001;
-    static const uint16 CMD_DVD_BREAK                  = 0x0002;
+    static const uint16_t CMD_DVD_TEST_VALUE          = 0x80;
+    static const uint16_t CMD_DVD_IF_GPREG_AND        = (1 << 4);
+    static const uint16_t CMD_DVD_IF_GPREG_EQUAL      = (2 << 4);
+    static const uint16_t CMD_DVD_IF_GPREG_NOT_EQUAL  = (3 << 4);
+    static const uint16_t CMD_DVD_IF_GPREG_SUP_EQUAL  = (4 << 4);
+    static const uint16_t CMD_DVD_IF_GPREG_SUP        = (5 << 4);
+    static const uint16_t CMD_DVD_IF_GPREG_INF_EQUAL  = (6 << 4);
+    static const uint16_t CMD_DVD_IF_GPREG_INF        = (7 << 4);
+
+    static const uint16_t CMD_DVD_NOP                    = 0x0000;
+    static const uint16_t CMD_DVD_GOTO_LINE              = 0x0001;
+    static const uint16_t CMD_DVD_BREAK                  = 0x0002;
     // Links
-    static const uint16 CMD_DVD_NOP2                   = 0x2001;
-    static const uint16 CMD_DVD_LINKPGCN               = 0x2004;
-    static const uint16 CMD_DVD_LINKPGN                = 0x2006;
-    static const uint16 CMD_DVD_LINKCN                 = 0x2007;
-    static const uint16 CMD_DVD_JUMP_TT                = 0x3002;
-    static const uint16 CMD_DVD_JUMPVTS_TT             = 0x3003;
-    static const uint16 CMD_DVD_JUMPVTS_PTT            = 0x3005;
-    static const uint16 CMD_DVD_JUMP_SS                = 0x3006;
-    static const uint16 CMD_DVD_CALLSS_VTSM1           = 0x3008;
+    static const uint16_t CMD_DVD_NOP2                   = 0x2001;
+    static const uint16_t CMD_DVD_LINKPGCN               = 0x2004;
+    static const uint16_t CMD_DVD_LINKPGN                = 0x2006;
+    static const uint16_t CMD_DVD_LINKCN                 = 0x2007;
+    static const uint16_t CMD_DVD_JUMP_TT                = 0x3002;
+    static const uint16_t CMD_DVD_JUMPVTS_TT             = 0x3003;
+    static const uint16_t CMD_DVD_JUMPVTS_PTT            = 0x3005;
+    static const uint16_t CMD_DVD_JUMP_SS                = 0x3006;
+    static const uint16_t CMD_DVD_CALLSS_VTSM1           = 0x3008;
     //
-    static const uint16 CMD_DVD_SET_HL_BTNN2           = 0x4600;
-    static const uint16 CMD_DVD_SET_HL_BTNN_LINKPGCN1  = 0x4604;
-    static const uint16 CMD_DVD_SET_STREAM             = 0x5100;
-    static const uint16 CMD_DVD_SET_GPRMMD             = 0x5300;
-    static const uint16 CMD_DVD_SET_HL_BTNN1           = 0x5600;
-    static const uint16 CMD_DVD_SET_HL_BTNN_LINKPGCN2  = 0x5604;
-    static const uint16 CMD_DVD_SET_HL_BTNN_LINKCN     = 0x5607;
+    static const uint16_t CMD_DVD_SET_HL_BTNN2           = 0x4600;
+    static const uint16_t CMD_DVD_SET_HL_BTNN_LINKPGCN1  = 0x4604;
+    static const uint16_t CMD_DVD_SET_STREAM             = 0x5100;
+    static const uint16_t CMD_DVD_SET_GPRMMD             = 0x5300;
+    static const uint16_t CMD_DVD_SET_HL_BTNN1           = 0x5600;
+    static const uint16_t CMD_DVD_SET_HL_BTNN_LINKPGCN2  = 0x5604;
+    static const uint16_t CMD_DVD_SET_HL_BTNN_LINKCN     = 0x5607;
     // Operations
-    static const uint16 CMD_DVD_MOV_SPREG_PREG         = 0x6100;
-    static const uint16 CMD_DVD_GPREG_MOV_VALUE        = 0x7100;
-    static const uint16 CMD_DVD_SUB_GPREG              = 0x7400;
-    static const uint16 CMD_DVD_MULT_GPREG             = 0x7500;
-    static const uint16 CMD_DVD_GPREG_DIV_VALUE        = 0x7600;
-    static const uint16 CMD_DVD_GPREG_AND_VALUE        = 0x7900;
+    static const uint16_t CMD_DVD_MOV_SPREG_PREG         = 0x6100;
+    static const uint16_t CMD_DVD_GPREG_MOV_VALUE        = 0x7100;
+    static const uint16_t CMD_DVD_SUB_GPREG              = 0x7400;
+    static const uint16_t CMD_DVD_MULT_GPREG             = 0x7500;
+    static const uint16_t CMD_DVD_GPREG_DIV_VALUE        = 0x7600;
+    static const uint16_t CMD_DVD_GPREG_AND_VALUE        = 0x7900;
 
     // callbacks when browsing inside CodecPrivate
     static bool MatchIsDomain     ( const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size );
@@ -257,7 +257,7 @@ public:
     bool Leave();
 
     std::string GetCodecName( bool f_for_title = false ) const;
-    int16 GetTitleNumber();
+    int16_t GetTitleNumber();
 
 protected:
     bool EnterLeaveHelper( char const*, std::vector<KaxChapterProcessData*>* );


=====================================
modules/demux/mkv/chapters.cpp
=====================================
@@ -108,7 +108,7 @@ std::string chapter_item_c::GetCodecName( bool f_for_title ) const
     return result;
 }
 
-int16 chapter_item_c::GetTitleNumber( ) const
+int16_t chapter_item_c::GetTitleNumber( ) const
 {
     int result = -1;
 


=====================================
modules/demux/mkv/chapters.hpp
=====================================
@@ -71,7 +71,7 @@ public:
                                     size_t i_cookie_size );
     std::string                 GetCodecName( bool f_for_title = false ) const;
     bool                        ParentOf( const chapter_item_c & item ) const;
-    int16                       GetTitleNumber( ) const;
+    int16_t                     GetTitleNumber( ) const;
 
     vlc_tick_t                  i_start_time, i_end_time;
     std::vector<chapter_item_c*> sub_chapters;


=====================================
modules/demux/mkv/demux.cpp
=====================================
@@ -79,9 +79,9 @@ bool demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, matroska_stream_c *
     }
 
     EDocTypeReadVersion doc_read_version = GetChild<EDocTypeReadVersion>(*static_cast<EbmlHead*>(p_l0));
-    if (uint64(doc_read_version) > 5)
+    if (uint64_t(doc_read_version) > 5)
     {
-        msg_Err( p_demux, "matroska file needs version %" PRId64 " but only versions 1 to 4 supported", uint64(doc_read_version));
+        msg_Err( p_demux, "matroska file needs version %" PRId64 " but only versions 1 to 4 supported", uint64_t(doc_read_version));
         return false;
     }
 
@@ -129,7 +129,7 @@ bool demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, matroska_stream_c *
 
         if (p_l0->IsFiniteSize() )
         {
-            p_l0->SkipData(p_stream1->estream, KaxMatroska_Context);
+            p_l0->SkipData(p_stream1->estream, Context_KaxMatroska);
             p_l0 = p_stream1->estream.FindNextID(EBML_INFO(KaxSegment), UINT64_MAX);
         }
         else


=====================================
modules/demux/mkv/dvd_types.hpp
=====================================
@@ -218,41 +218,41 @@ typedef struct {
  */
 typedef struct {
 #ifdef WORDS_BIGENDIAN
-  uint32        btn_coln         : 2;  /**< button color number */
-  uint32        x_start          : 10; /**< x start offset within the overlay */
-  uint32        zero1            : 2;  /**< reserved */
-  uint32        x_end            : 10; /**< x end offset within the overlay */
+  uint32_t      btn_coln         : 2;  /**< button color number */
+  uint32_t      x_start          : 10; /**< x start offset within the overlay */
+  uint32_t      zero1            : 2;  /**< reserved */
+  uint32_t      x_end            : 10; /**< x end offset within the overlay */
 
-  uint32        zero3            : 2;  /**< reserved */
-  uint32        up               : 6;  /**< button index when pressing up */
+  uint32_t      zero3            : 2;  /**< reserved */
+  uint32_t      up               : 6;  /**< button index when pressing up */
 
-  uint32        auto_action_mode : 2;  /**< 0: no, 1: activated if selected */
-  uint32        y_start          : 10; /**< y start offset within the overlay */
-  uint32        zero2            : 2;  /**< reserved */
-  uint32        y_end            : 10; /**< y end offset within the overlay */
+  uint32_t      auto_action_mode : 2;  /**< 0: no, 1: activated if selected */
+  uint32_t      y_start          : 10; /**< y start offset within the overlay */
+  uint32_t      zero2            : 2;  /**< reserved */
+  uint32_t      y_end            : 10; /**< y end offset within the overlay */
 
-  uint32        zero4            : 2;  /**< reserved */
-  uint32        down             : 6;  /**< button index when pressing down */
+  uint32_t      zero4            : 2;  /**< reserved */
+  uint32_t      down             : 6;  /**< button index when pressing down */
   unsigned char zero5            : 2;  /**< reserved */
   unsigned char left             : 6;  /**< button index when pressing left */
   unsigned char zero6            : 2;  /**< reserved */
   unsigned char right            : 6;  /**< button index when pressing right */
 #else
-  uint32        x_end            : 10;
-  uint32        zero1            : 2;
-  uint32        x_start          : 10;
-  uint32        btn_coln         : 2;
+  uint32_t      x_end            : 10;
+  uint32_t      zero1            : 2;
+  uint32_t      x_start          : 10;
+  uint32_t      btn_coln         : 2;
 
-  uint32        up               : 6;
-  uint32        zero3            : 2;
+  uint32_t      up               : 6;
+  uint32_t      zero3            : 2;
 
-  uint32        y_end            : 10;
-  uint32        zero2            : 2;
-  uint32        y_start          : 10;
-  uint32        auto_action_mode : 2;
+  uint32_t      y_end            : 10;
+  uint32_t      zero2            : 2;
+  uint32_t      y_start          : 10;
+  uint32_t      auto_action_mode : 2;
 
-  uint32        down             : 6;
-  uint32        zero4            : 2;
+  uint32_t      down             : 6;
+  uint32_t      zero4            : 2;
   unsigned char left             : 6;
   unsigned char zero5            : 2;
   unsigned char right            : 6;


=====================================
modules/demux/mkv/events.cpp
=====================================
@@ -60,10 +60,10 @@ void event_thread_t::SetPci(const pci_t *data)
         btni_t *button_ptr = &(pci_packet.hli.btnit[button-1]);
         binary *p_data = (binary*) button_ptr;
 
-        uint16 i_x_start = ((p_data[0] & 0x3F) << 4 ) + ( p_data[1] >> 4 );
-        uint16 i_x_end   = ((p_data[1] & 0x03) << 8 ) + p_data[2];
-        uint16 i_y_start = ((p_data[3] & 0x3F) << 4 ) + ( p_data[4] >> 4 );
-        uint16 i_y_end   = ((p_data[4] & 0x03) << 8 ) + p_data[5];
+        uint16_t i_x_start = ((p_data[0] & 0x3F) << 4 ) + ( p_data[1] >> 4 );
+        uint16_t i_x_end   = ((p_data[1] & 0x03) << 8 ) + p_data[2];
+        uint16_t i_y_start = ((p_data[3] & 0x3F) << 4 ) + ( p_data[4] >> 4 );
+        uint16_t i_y_end   = ((p_data[4] & 0x03) << 8 ) + p_data[5];
         button_ptr->x_start = i_x_start;
         button_ptr->x_end   = i_x_end;
         button_ptr->y_start = i_y_start;
@@ -165,7 +165,7 @@ void *event_thread_t::EventThread(void *data)
     return NULL;
 }
 
-void event_thread_t::ProcessNavAction( uint16 button, pci_t* pci )
+void event_thread_t::ProcessNavAction( uint16_t button, pci_t* pci )
 {
     demux_sys_t* p_sys = (demux_sys_t*)p_demux->p_sys;
 
@@ -194,7 +194,7 @@ void event_thread_t::HandleKeyEvent( EventInfo const& ev )
     demux_sys_t* p_sys = (demux_sys_t*)p_demux->p_sys;
     pci_t *pci = &pci_packet;
 
-    uint16 i_curr_button = p_sys->dvd_interpretor.GetSPRM( 0x88 );
+    uint16_t i_curr_button = p_sys->dvd_interpretor.GetSPRM( 0x88 );
 
     if( i_curr_button <= 0 || i_curr_button > pci->hli.hl_gi.btn_ns )
         return;
@@ -270,7 +270,7 @@ void event_thread_t::HandleMouseEvent( EventInfo const& event )
         if ( best != 0)
         {
             btni_t button_ptr = pci->hli.btnit[best-1];
-            uint16 i_curr_button = p_sys->dvd_interpretor.GetSPRM( 0x88 );
+            uint16_t i_curr_button = p_sys->dvd_interpretor.GetSPRM( 0x88 );
 
             msg_Dbg( &p_sys->demuxer, "Clicked button %d", best );
             vlc_mutex_unlock( &lock );


=====================================
modules/demux/mkv/events.hpp
=====================================
@@ -111,7 +111,7 @@ private:
     void HandleKeyEvent( EventInfo const& );
     void HandleMouseEvent( EventInfo const& );
 
-    void ProcessNavAction( uint16 button, pci_t* pci );
+    void ProcessNavAction( uint16_t button, pci_t* pci );
 
     demux_t      *p_demux;
 


=====================================
modules/demux/mkv/matroska_segment.cpp
=====================================
@@ -133,7 +133,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
                         b_invalid_cue = true;
                         break;
                     }
-                    cue_mk_time = VLC_TICK_FROM_NS(static_cast<uint64>( *cuetime ) * i_timescale);
+                    cue_mk_time = VLC_TICK_FROM_NS(static_cast<uint64_t>( *cuetime ) * i_timescale);
                 }
                 else if( MKV_IS_ID( el, KaxCueTrackPositions ) )
                 {
@@ -153,12 +153,12 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
                             if( MKV_CHECKED_PTR_DECL ( kct_ptr, KaxCueTrack, el ) )
                             {
                                 kct_ptr->ReadData( es.I_O() );
-                                track_id = static_cast<uint16>( *kct_ptr );
+                                track_id = static_cast<uint16_t>( *kct_ptr );
                             }
                             else if( MKV_CHECKED_PTR_DECL ( kccp_ptr, KaxCueClusterPosition, el ) )
                             {
                                 kccp_ptr->ReadData( es.I_O() );
-                                cue_position = segment->GetGlobalPosition( static_cast<uint64>( *kccp_ptr ) );
+                                cue_position = segment->GetGlobalPosition( static_cast<uint64_t>( *kccp_ptr ) );
 
                                 _seeker.add_cluster_position( cue_position );
                             }
@@ -295,7 +295,7 @@ bool matroska_segment_c::ParseSimpleTags( SimpleTag* pout_simple, KaxTagSimple *
         }
         E_CASE( KaxTagLangue, entry )
         {
-            vars.out.lang = entry;
+            vars.out.lang = entry.GetValue();
         }
         E_CASE( KaxTagDefault, unused )
         {
@@ -390,31 +390,31 @@ void matroska_segment_c::LoadTags( KaxTags *tags_ )
                         MKV_SWITCH_INIT();
                         E_CASE( KaxTagTargetTypeValue, entry )
                         {
-                            vars.target_type = static_cast<uint32>( entry );
+                            vars.target_type = static_cast<uint32_t>( entry );
                             msg_Dbg( &vars.sys.demuxer, "|   |   + TargetTypeValue: %u", vars.target_type);
                         }
                         E_CASE( KaxTagTrackUID, entry )
                         {
                             vars.tag.i_tag_type = TRACK_UID;
-                            vars.tag.i_uid = static_cast<uint64>( entry );
+                            vars.tag.i_uid = static_cast<uint64_t>( entry );
                             msg_Dbg( &vars.sys.demuxer, "|   |   + TrackUID: %" PRIu64, vars.tag.i_uid);
                         }
                         E_CASE( KaxTagEditionUID, entry )
                         {
                             vars.tag.i_tag_type = EDITION_UID;
-                            vars.tag.i_uid = static_cast<uint64>( entry );
+                            vars.tag.i_uid = static_cast<uint64_t>( entry );
                             msg_Dbg( &vars.sys.demuxer, "|   |   + EditionUID: %" PRIu64, vars.tag.i_uid);
                         }
                         E_CASE( KaxTagChapterUID, entry )
                         {
                             vars.tag.i_tag_type = CHAPTER_UID;
-                            vars.tag.i_uid = static_cast<uint64>( entry );
+                            vars.tag.i_uid = static_cast<uint64_t>( entry );
                             msg_Dbg( &vars.sys.demuxer, "|   |   + ChapterUID: %" PRIu64, vars.tag.i_uid);
                         }
                         E_CASE( KaxTagAttachmentUID, entry )
                         {
                             vars.tag.i_tag_type = ATTACHMENT_UID;
-                            vars.tag.i_uid = static_cast<uint64>( entry );
+                            vars.tag.i_uid = static_cast<uint64_t>( entry );
                             msg_Dbg( &vars.sys.demuxer, "|   |   + AttachmentUID: %" PRIu64, vars.tag.i_uid);
                         }
                         E_CASE( KaxTagTargetType, entry )
@@ -474,7 +474,7 @@ void matroska_segment_c::InformationCreate( )
  * Misc
  *****************************************************************************/
 
-bool matroska_segment_c::PreloadClusters(uint64 i_cluster_pos)
+bool matroska_segment_c::PreloadClusters(uint64_t i_cluster_pos)
 {
     struct ClusterHandlerPayload
     {
@@ -1019,8 +1019,8 @@ void matroska_segment_c::EnsureDuration()
         return;
     }
 
-    uint64 i_current_position = es.I_O().getFilePointer();
-    uint64 i_last_cluster_pos = cluster->GetElementPosition();
+    uint64_t i_current_position = es.I_O().getFilePointer();
+    uint64_t i_last_cluster_pos = cluster->GetElementPosition();
 
     // find the last Cluster from the Cues
 
@@ -1064,7 +1064,7 @@ void matroska_segment_c::EnsureDuration()
         ParseCluster( p_last_cluster, false, SCOPE_PARTIAL_DATA ) )
     {
         // use the last block + duration
-        uint64 i_last_timecode = p_last_cluster->GlobalTimecode();
+        uint64_t i_last_timecode = p_last_cluster->GlobalTimestamp();
         for( unsigned int i = 0; i < p_last_cluster->ListSize(); i++ )
         {
             EbmlElement *l = (*p_last_cluster)[i];
@@ -1072,11 +1072,11 @@ void matroska_segment_c::EnsureDuration()
             if( MKV_CHECKED_PTR_DECL ( simpleblock, KaxSimpleBlock, l ) )
             {
                 simpleblock->SetParent( *p_last_cluster );
-                i_last_timecode = std::max(i_last_timecode, simpleblock->GlobalTimecode());
+                i_last_timecode = std::max(i_last_timecode, simpleblock->GlobalTimestamp());
             }
             else if( MKV_CHECKED_PTR_DECL ( group, KaxBlockGroup, l ) )
             {
-                uint64 i_group_timecode = 0;
+                uint64_t i_group_timecode = 0;
                 for( unsigned int j = 0; j < group->ListSize(); j++ )
                 {
                     EbmlElement *g = (*group)[j];
@@ -1084,18 +1084,18 @@ void matroska_segment_c::EnsureDuration()
                     if( MKV_CHECKED_PTR_DECL ( block, KaxBlock, g ) )
                     {
                         block->SetParent( *p_last_cluster );
-                        i_group_timecode += block->GlobalTimecode();
+                        i_group_timecode += block->GlobalTimestamp();
                     }
                     else if( MKV_CHECKED_PTR_DECL ( kbd_ptr, KaxBlockDuration, g ) )
                     {
-                        i_group_timecode += static_cast<uint64>( *kbd_ptr );
+                        i_group_timecode += static_cast<uint64_t>( *kbd_ptr );
                     }
                 }
                 i_last_timecode = std::max(i_last_timecode, i_group_timecode);
             }
         }
 
-        i_duration = VLC_TICK_FROM_NS( i_last_timecode - cluster->GlobalTimecode() );
+        i_duration = VLC_TICK_FROM_NS( i_last_timecode - cluster->GlobalTimestamp() );
         msg_Dbg( &sys.demuxer, " extracted Duration=%" PRId64, SEC_FROM_VLC_TICK(i_duration) );
     }
 
@@ -1228,10 +1228,10 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
     {
         MKV_SWITCH_INIT();
 
-        E_CASE( KaxClusterTimecode, ktimecode )
+        E_CASE( KaxClusterTimestamp, ktimecode )
         {
             ktimecode.ReadData( vars.obj->es.I_O(), SCOPE_ALL_DATA );
-            vars.obj->cluster->InitTimecode( static_cast<uint64>( ktimecode ), vars.obj->i_timescale );
+            vars.obj->cluster->InitTimestamp( static_cast<uint64_t>( ktimecode ), vars.obj->i_timescale );
             vars.obj->_seeker.add_cluster( vars.obj->cluster );
             vars.b_cluster_timecode = true;
         }
@@ -1263,7 +1263,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
                 bool const b_valid_track = vars.obj->FindTrackByBlock( NULL, &ksblock ) != NULL;
                 if (b_valid_track)
                     vars.obj->_seeker.add_seekpoint( ksblock.TrackNum(),
-                        SegmentSeeker::Seekpoint( ksblock.GetElementPosition(), VLC_TICK_FROM_NS(ksblock.GlobalTimecode()) ) );
+                        SegmentSeeker::Seekpoint( ksblock.GetElementPosition(), VLC_TICK_FROM_NS(ksblock.GlobalTimestamp()) ) );
             }
         }
     };
@@ -1282,7 +1282,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
             if( p_track != NULL && p_track->fmt.i_cat == SPU_ES )
             {
                 vars.obj->_seeker.add_seekpoint( kblock.TrackNum(),
-                    SegmentSeeker::Seekpoint( kblock.GetElementPosition(), VLC_TICK_FROM_NS(kblock.GlobalTimecode()) ) );
+                    SegmentSeeker::Seekpoint( kblock.GetElementPosition(), VLC_TICK_FROM_NS(kblock.GlobalTimestamp()) ) );
             }
 
             vars.ep->Keep ();
@@ -1301,7 +1301,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
         E_CASE( KaxBlockDuration, kduration )
         {
             kduration.ReadData( vars.obj->es.I_O() );
-            vars.i_duration = static_cast<uint64>( kduration );
+            vars.i_duration = static_cast<uint64_t>( kduration );
         }
         E_CASE( KaxReferenceBlock, kreference )
         {
@@ -1309,7 +1309,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
 
            if( vars.b_key_picture )
                vars.b_key_picture = false;
-           else if( static_cast<int64>( kreference ) )
+           else if( static_cast<int64_t>( kreference ) )
                vars.b_discardable_picture = true;
         }
         E_CASE( KaxClusterSilentTrackNumber, kstrackn )
@@ -1321,7 +1321,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
         E_CASE( KaxDiscardPadding, kdiscardp )
         {
             kdiscardp.ReadData( vars.obj->es.I_O() );
-            int64 i_duration = static_cast<int64>( kdiscardp );
+            int64_t i_duration = static_cast<int64_t>( kdiscardp );
 
             if( vars.i_duration < i_duration )
                 vars.i_duration = 0;


=====================================
modules/demux/mkv/matroska_segment.hpp
=====================================
@@ -110,7 +110,7 @@ public:
     int64_t                 i_attachments_position;
 
     KaxCluster              *cluster;
-    uint64                  i_block_pos;
+    uint64_t                i_block_pos;
     KaxSegmentUID           *p_segment_uid;
     KaxPrevUID              *p_prev_segment_uid;
     KaxNextUID              *p_next_segment_uid;
@@ -141,7 +141,7 @@ public:
 
     bool Preload();
     bool PreloadFamily( const matroska_segment_c & segment );
-    bool PreloadClusters( uint64 i_cluster_position );
+    bool PreloadClusters( uint64_t i_cluster_position );
     void InformationCreate();
 
     bool Seek( demux_t &, vlc_tick_t i_mk_date, vlc_tick_t i_mk_time_offset, bool b_accurate );


=====================================
modules/demux/mkv/matroska_segment_parse.cpp
=====================================
@@ -128,7 +128,7 @@ void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
                     {
                         KaxSeekPosition &spos = *static_cast<KaxSeekPosition*>( l );
                         spos.ReadData( es.I_O() );
-                        i_pos = (int64_t)segment->GetGlobalPosition( static_cast<uint64>( spos ) );
+                        i_pos = (int64_t)segment->GetGlobalPosition( static_cast<uint64_t>( spos ) );
                     }
                     else if ( !MKV_IS_ID( l, EbmlVoid ) && !MKV_IS_ID( l, EbmlCrc32 ))
                     {
@@ -206,9 +206,9 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
     bool bSupported = true;
 
     EbmlUInteger *pTrackType = static_cast<EbmlUInteger*>(m->FindElt(EBML_INFO(KaxTrackType)));
-    uint8 ttype;
+    uint8_t ttype;
     if (likely(pTrackType != NULL))
-        ttype = (uint8) *pTrackType;
+        ttype = (uint8_t) *pTrackType;
     else
         ttype = 0;
 
@@ -270,18 +270,18 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxTrackNumber, tnum )
         {
-            vars.tk->i_number = static_cast<uint32>( tnum );
+            vars.tk->i_number = static_cast<uint32_t>( tnum );
             debug( vars, "Track Number=%u", vars.tk->i_number );
         }
         E_CASE( KaxTrackUID, tuid )
         {
-            debug( vars, "Track UID=%x", static_cast<uint32>( tuid ) );
+            debug( vars, "Track UID=%x", static_cast<uint32_t>( tuid ) );
         }
         E_CASE( KaxTrackType, ttype )
         {
             const char *psz_type;
 
-            switch( static_cast<uint8>( ttype ) )
+            switch( static_cast<uint8_t>( ttype ) )
             {
                 case track_audio:
                     psz_type = "audio";
@@ -304,38 +304,38 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxTrackFlagEnabled, fenb ) // UNUSED
         {
-            vars.tk->b_enabled = static_cast<uint32>( fenb );
+            vars.tk->b_enabled = static_cast<uint32_t>( fenb );
             debug( vars, "Track Enabled=%u", vars.tk->b_enabled );
         }
         E_CASE( KaxTrackFlagDefault, fdef )
         {
-            vars.tk->b_default = static_cast<uint32>( fdef );
+            vars.tk->b_default = static_cast<uint32_t>( fdef );
             debug( vars, "Track Default=%u", vars.tk->b_default );
         }
         E_CASE( KaxTrackFlagForced, ffor ) // UNUSED
         {
-            vars.tk->b_forced = static_cast<uint32>( ffor );
+            vars.tk->b_forced = static_cast<uint32_t>( ffor );
 
             debug( vars, "Track Forced=%u", vars.tk->b_forced );
         }
         E_CASE( KaxTrackFlagLacing, lac ) // UNUSED
         {
-            debug( vars, "Track Lacing=%d", static_cast<uint32>( lac ) ) ;
+            debug( vars, "Track Lacing=%d", static_cast<uint32_t>( lac ) ) ;
         }
         E_CASE( KaxTrackMinCache, cmin ) // UNUSED
         {
-            debug( vars, "Track MinCache=%d", static_cast<uint32>( cmin ) ) ;
+            debug( vars, "Track MinCache=%d", static_cast<uint32_t>( cmin ) ) ;
         }
         E_CASE( KaxTrackMaxCache, cmax ) // UNUSED
         {
-            debug( vars, "Track MaxCache=%d", static_cast<uint32>( cmax ) ) ;
+            debug( vars, "Track MaxCache=%d", static_cast<uint32_t>( cmax ) ) ;
         }
         E_CASE( KaxTrackDefaultDuration, defd )
         {
-            vars.tk->i_default_duration = VLC_TICK_FROM_NS(static_cast<uint64>(defd));
+            vars.tk->i_default_duration = VLC_TICK_FROM_NS(static_cast<uint64_t>(defd));
             debug( vars, "Track Default Duration=%" PRId64, vars.tk->i_default_duration );
         }
-        E_CASE( KaxTrackTimecodeScale, ttcs )
+        E_CASE( KaxTrackTimestampScale, ttcs )
         {
             vars.tk->f_timecodescale = static_cast<float>( ttcs );
             if ( vars.tk->f_timecodescale <= 0 ) vars.tk->f_timecodescale = 1.0;
@@ -343,7 +343,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxMaxBlockAdditionID, mbl ) // UNUSED
         {
-            debug( vars, "Track Max BlockAdditionID=%d", static_cast<uint32>( mbl ) ) ;
+            debug( vars, "Track Max BlockAdditionID=%d", static_cast<uint32_t>( mbl ) ) ;
         }
         E_CASE( KaxTrackName, tname )
         {
@@ -384,11 +384,11 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         //AttachmentLink
         E_CASE( KaxCodecDecodeAll, cdall ) // UNUSED
         {
-            debug( vars, "Track Codec Decode All=%u", static_cast<uint8>( cdall ) ) ;
+            debug( vars, "Track Codec Decode All=%u", static_cast<uint8_t>( cdall ) ) ;
         }
         E_CASE( KaxTrackOverlay, tovr ) // UNUSED
         {
-            debug( vars, "Track Overlay=%u", static_cast<uint32>( tovr ) ) ;
+            debug( vars, "Track Overlay=%u", static_cast<uint32_t>( tovr ) ) ;
         }
 #if LIBMATROSKA_VERSION >= 0x010401
         E_CASE( KaxCodecDelay, codecdelay )
@@ -427,16 +427,16 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxContentEncodingOrder, encord )
         {
-            debug( vars, "Order: %i", static_cast<uint32>( encord ) );
+            debug( vars, "Order: %i", static_cast<uint32_t>( encord ) );
         }
         E_CASE( KaxContentEncodingScope, encscope )
         {
-            vars.tk->i_encoding_scope = static_cast<uint32>( encscope );
+            vars.tk->i_encoding_scope = static_cast<uint32_t>( encscope );
             debug( vars, "Scope: %i", vars.tk->i_encoding_scope );
         }
         E_CASE( KaxContentEncodingType, enctype )
         {
-            debug( vars, "Type: %i", static_cast<uint32>( enctype ) );
+            debug( vars, "Type: %i", static_cast<uint32_t>( enctype ) );
         }
         E_CASE( KaxContentCompression, compr )
         {
@@ -450,7 +450,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxContentCompAlgo, compalg )
         {
-            vars.tk->i_compression_type = static_cast<uint32>( compalg );
+            vars.tk->i_compression_type = static_cast<uint32_t>( compalg );
             debug( vars, "Compression Algorithm: %i", vars.tk->i_compression_type );
             if ( ( vars.tk->i_compression_type != MATROSKA_COMPRESSION_ZLIB ) &&
                  ( vars.tk->i_compression_type != MATROSKA_COMPRESSION_HEADER ) )
@@ -593,7 +593,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         E_CASE( KaxVideoProjectionType, fint )
         {
             ONLY_FMT(VIDEO);
-            switch (static_cast<uint8>( fint ))
+            switch (static_cast<uint8_t>( fint ))
             {
             case 0:
                 vars.tk->fmt.video.projection_mode = PROJECTION_MODE_RECTANGULAR;
@@ -605,7 +605,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 vars.tk->fmt.video.projection_mode = PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD;
                 break;
             default:
-                debug( vars, "Track Video Projection %u not supported", static_cast<uint8>( fint ) ) ;
+                debug( vars, "Track Video Projection %u not supported", static_cast<uint8_t>( fint ) ) ;
                 break;
             }
         }
@@ -628,13 +628,13 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         E_CASE( KaxVideoFlagInterlaced, fint ) // UNUSED
         {
             ONLY_FMT(VIDEO);
-            debug( vars, "Track Video Interlaced=%u", static_cast<uint8>( fint ) ) ;
+            debug( vars, "Track Video Interlaced=%u", static_cast<uint8_t>( fint ) ) ;
         }
         E_CASE( KaxVideoStereoMode, stereo ) // UNUSED
         {
             ONLY_FMT(VIDEO);
             vars.tk->fmt.video.b_multiview_right_eye_first = false;
-            switch (static_cast<uint8>( stereo ))
+            switch (static_cast<uint8_t>( stereo ))
             {
             case 0: vars.tk->fmt.video.multiview_mode = MULTIVIEW_2D;         break;
             case 1: vars.tk->fmt.video.multiview_mode = MULTIVIEW_STEREO_SBS; break;
@@ -657,62 +657,62 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                     vars.tk->fmt.video.b_multiview_right_eye_first = true;    break;
             default:
             case 10: case 12:
-                debug( vars, " unsupported Stereo Mode=%u", static_cast<uint8>( stereo ) ) ;
+                debug( vars, " unsupported Stereo Mode=%u", static_cast<uint8_t>( stereo ) ) ;
             }
-            debug( vars, "Track Video Stereo Mode=%u", static_cast<uint8>( stereo ) ) ;
+            debug( vars, "Track Video Stereo Mode=%u", static_cast<uint8_t>( stereo ) ) ;
         }
         E_CASE( KaxVideoPixelWidth, vwidth )
         {
             ONLY_FMT(VIDEO);
-            vars.tk->fmt.video.i_width += static_cast<uint32>( vwidth );
+            vars.tk->fmt.video.i_width += static_cast<uint32_t>( vwidth );
             debug( vars, "width=%u", vars.tk->fmt.video.i_width );
         }
         E_CASE( KaxVideoPixelHeight, vheight )
         {
             ONLY_FMT(VIDEO);
-            vars.tk->fmt.video.i_height += static_cast<uint32>( vheight );
+            vars.tk->fmt.video.i_height += static_cast<uint32_t>( vheight );
             debug( vars, "height=%u", vars.tk->fmt.video.i_height );
         }
         E_CASE( KaxVideoDisplayWidth, vwidth )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_display_width = static_cast<uint32>( vwidth );
+            vars.track_video_info.i_display_width = static_cast<uint32_t>( vwidth );
             debug( vars, "display width=%u", vars.track_video_info.i_display_width );
         }
         E_CASE( KaxVideoDisplayHeight, vheight )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_display_height = static_cast<uint32>( vheight );
+            vars.track_video_info.i_display_height = static_cast<uint32_t>( vheight );
             debug( vars, "display height=%u", vars.track_video_info.i_display_height );
         }
         E_CASE( KaxVideoPixelCropBottom, cropval )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_crop_bottom = static_cast<uint32>( cropval );
+            vars.track_video_info.i_crop_bottom = static_cast<uint32_t>( cropval );
             debug( vars, "crop pixel bottom=%u", vars.track_video_info.i_crop_bottom );
         }
         E_CASE( KaxVideoPixelCropTop, cropval )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_crop_top = static_cast<uint32>( cropval );
+            vars.track_video_info.i_crop_top = static_cast<uint32_t>( cropval );
             debug( vars, "crop pixel top=%u", vars.track_video_info.i_crop_top );
         }
         E_CASE( KaxVideoPixelCropRight, cropval )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_crop_right = static_cast<uint32>( cropval );
+            vars.track_video_info.i_crop_right = static_cast<uint32_t>( cropval );
             debug( vars, "crop pixel right=%u", vars.track_video_info.i_crop_right );
         }
         E_CASE( KaxVideoPixelCropLeft, cropval )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_crop_left = static_cast<uint32>( cropval );
+            vars.track_video_info.i_crop_left = static_cast<uint32_t>( cropval );
             debug( vars, "crop pixel left=%u", vars.track_video_info.i_crop_left );
         }
         E_CASE( KaxVideoDisplayUnit, vdmode )
         {
             ONLY_FMT(VIDEO);
-            vars.track_video_info.i_display_unit = static_cast<uint8>( vdmode );
+            vars.track_video_info.i_display_unit = static_cast<uint8_t>( vdmode );
             const char *psz_unit;
             switch (vars.track_video_info.i_display_unit)
             {
@@ -727,7 +727,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         E_CASE( KaxVideoAspectRatio, ratio ) // UNUSED
         {
             ONLY_FMT(VIDEO);
-            debug( vars, "Track Video Aspect Ratio Type=%u", static_cast<uint8>( ratio ) ) ;
+            debug( vars, "Track Video Aspect Ratio Type=%u", static_cast<uint8_t>( ratio ) ) ;
         }
         E_CASE( KaxVideoFrameRate, vfps )
         {
@@ -761,7 +761,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         {
             ONLY_FMT(VIDEO);
             const char *name = nullptr;
-            switch( static_cast<uint8>(range) )
+            switch( static_cast<uint8_t>(range) )
             {
             case 1:
                 vars.tk->fmt.video.color_range = COLOR_RANGE_LIMITED;
@@ -773,16 +773,16 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 break;
             case 3: // Matrix coefficients + Transfer characteristics
             default:
-                debug( vars, "Unsupported Colour Range=%d", static_cast<uint8>(range) );
+                debug( vars, "Unsupported Colour Range=%d", static_cast<uint8_t>(range) );
             }
             if (name != nullptr) debug( vars, "Range=%s", name );
         }
         E_CASE( KaxVideoColourTransferCharacter, transfer )
         {
             ONLY_FMT(VIDEO);
-            vars.tk->fmt.video.transfer = iso_23001_transfer_to_vlc( static_cast<uint8>(transfer) );
+            vars.tk->fmt.video.transfer = iso_23001_transfer_to_vlc( static_cast<uint8_t>(transfer) );
             const char *name = nullptr;
-            switch( static_cast<uint8>(transfer) )
+            switch( static_cast<uint8_t>(transfer) )
             {
             case 1: name = "BT-709";
                 break;
@@ -813,18 +813,18 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 break;
             }
             if (vars.tk->fmt.video.transfer == TRANSFER_FUNC_UNDEF)
-                debug( vars, "Unsupported Colour Transfer=%d", static_cast<uint8>(transfer) );
+                debug( vars, "Unsupported Colour Transfer=%d", static_cast<uint8_t>(transfer) );
             else if (name == nullptr)
-                debug( vars, "Colour Transfer=%d", static_cast<uint8>(transfer) );
+                debug( vars, "Colour Transfer=%d", static_cast<uint8_t>(transfer) );
             else
                 debug( vars, "Colour Transfer=%s", name );
         }
         E_CASE( KaxVideoColourPrimaries, primaries )
         {
             ONLY_FMT(VIDEO);
-            vars.tk->fmt.video.primaries = iso_23001_primaries_to_vlc( static_cast<uint8>(primaries) );
+            vars.tk->fmt.video.primaries = iso_23001_primaries_to_vlc( static_cast<uint8_t>(primaries) );
             const char *name = nullptr;
-            switch( static_cast<uint8>(primaries) )
+            switch( static_cast<uint8_t>(primaries) )
             {
             case 1: name = "BT-709";
                 break;
@@ -845,18 +845,18 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 break;
             }
             if (vars.tk->fmt.video.primaries == COLOR_PRIMARIES_UNDEF)
-                debug( vars, "Unsupported Colour Primaries=%d", static_cast<uint8>(primaries) );
+                debug( vars, "Unsupported Colour Primaries=%d", static_cast<uint8_t>(primaries) );
             else if (name == nullptr)
-                debug( vars, "Colour Primaries=%s", static_cast<uint8>(primaries) );
+                debug( vars, "Colour Primaries=%s", static_cast<uint8_t>(primaries) );
             else
                 debug( vars, "Colour Primaries=%s", name );
         }
         E_CASE( KaxVideoColourMatrix, matrix )
         {
             ONLY_FMT(VIDEO);
-            vars.tk->fmt.video.space = iso_23001_matrix_coeffs_to_vlc( static_cast<uint8>(matrix) );
+            vars.tk->fmt.video.space = iso_23001_matrix_coeffs_to_vlc( static_cast<uint8_t>(matrix) );
             const char *name = nullptr;
-            switch( static_cast<uint8>(matrix) )
+            switch( static_cast<uint8_t>(matrix) )
             {
             case 1: name = "BT-709";
                 break;
@@ -882,9 +882,9 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
                 break;
             }
             if (vars.tk->fmt.video.space == COLOR_SPACE_UNDEF)
-                debug( vars, "Unsupported Colour Matrix=%d", static_cast<uint8>(matrix) );
+                debug( vars, "Unsupported Colour Matrix=%d", static_cast<uint8_t>(matrix) );
             else if (name == nullptr)
-                debug( vars, "Colour Matrix=%d", static_cast<uint8>(matrix) );
+                debug( vars, "Colour Matrix=%d", static_cast<uint8_t>(matrix) );
             else
                 debug( vars, "Colour Matrix=%s", name );
         }
@@ -892,14 +892,14 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         {
             ONLY_FMT(VIDEO);
             const char *name = nullptr;
-            vars.track_video_info.chroma_sit_horizontal = static_cast<uint8>(chroma_hor);
-            switch( static_cast<uint8>(chroma_hor) )
+            vars.track_video_info.chroma_sit_horizontal = static_cast<uint8_t>(chroma_hor);
+            switch( static_cast<uint8_t>(chroma_hor) )
             {
             case 0: name = "unspecified"; break;
             case 1: name = "left";        break;
             case 2: name = "center";      break;
             default:
-                debug( vars, "Unsupported Horizontal Chroma Siting=%d", static_cast<uint8>(chroma_hor) );
+                debug( vars, "Unsupported Horizontal Chroma Siting=%d", static_cast<uint8_t>(chroma_hor) );
             }
             if (name != nullptr) debug( vars, "Chroma Siting Horizontal=%s", name);
         }
@@ -907,14 +907,14 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         {
             ONLY_FMT(VIDEO);
             const char *name = nullptr;
-            vars.track_video_info.chroma_sit_vertical = static_cast<uint8>(chroma_ver);
-            switch( static_cast<uint8>(chroma_ver) )
+            vars.track_video_info.chroma_sit_vertical = static_cast<uint8_t>(chroma_ver);
+            switch( static_cast<uint8_t>(chroma_ver) )
             {
             case 0: name = "unspecified"; break;
             case 1: name = "left";        break;
             case 2: name = "center";      break;
             default:
-                debug( vars, "Unsupported Vertical Chroma Siting=%d", static_cast<uint8>(chroma_ver) );
+                debug( vars, "Unsupported Vertical Chroma Siting=%d", static_cast<uint8_t>(chroma_ver) );
             }
             if (name != nullptr) debug( vars, "Chroma Siting Vertical=%s", name);
         }
@@ -1029,13 +1029,13 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         E_CASE( KaxAudioChannels, achan )
         {
             ONLY_FMT(AUDIO);
-            vars.tk->fmt.audio.i_channels = static_cast<uint8>( achan );
+            vars.tk->fmt.audio.i_channels = static_cast<uint8_t>( achan );
             debug( vars, "achan=%u", vars.tk->fmt.audio.i_channels );
         }
         E_CASE( KaxAudioBitDepth, abits )
         {
             ONLY_FMT(AUDIO);
-            vars.tk->fmt.audio.i_bitspersample = static_cast<uint8>( abits );
+            vars.tk->fmt.audio.i_bitspersample = static_cast<uint8_t>( abits );
             debug( vars, "abits=%u", vars.tk->fmt.audio.i_bitspersample);
         }
         E_CASE ( EbmlVoid, ) {
@@ -1193,7 +1193,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
             {
                 vars.obj->p_segment_uid = new KaxSegmentUID( uid );
             }
-            debug( vars, "UID=%" PRIx64, *reinterpret_cast<uint64*>( vars.obj->p_segment_uid->GetBuffer() ) );
+            debug( vars, "UID=%" PRIx64, *reinterpret_cast<uint64_t*>( vars.obj->p_segment_uid->GetBuffer() ) );
         }
         E_CASE( KaxPrevUID, uid )
         {
@@ -1202,7 +1202,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
                 vars.obj->p_prev_segment_uid = new KaxPrevUID( uid );
                 vars.obj->b_ref_external_segments = true;
             }
-            debug( vars, "PrevUID=%" PRIx64, *reinterpret_cast<uint64*>( vars.obj->p_prev_segment_uid->GetBuffer() ) );
+            debug( vars, "PrevUID=%" PRIx64, *reinterpret_cast<uint64_t*>( vars.obj->p_prev_segment_uid->GetBuffer() ) );
         }
         E_CASE( KaxNextUID, uid )
         {
@@ -1211,11 +1211,11 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
                 vars.obj->p_next_segment_uid = new KaxNextUID( uid );
                 vars.obj->b_ref_external_segments = true;
             }
-            debug( vars, "NextUID=%" PRIx64, *reinterpret_cast<uint64*>( vars.obj->p_next_segment_uid->GetBuffer() ) );
+            debug( vars, "NextUID=%" PRIx64, *reinterpret_cast<uint64_t*>( vars.obj->p_next_segment_uid->GetBuffer() ) );
         }
-        E_CASE( KaxTimecodeScale, tcs )
+        E_CASE( KaxTimestampScale, tcs )
         {
-            vars.obj->i_timescale = static_cast<uint64>( tcs );
+            vars.obj->i_timescale = static_cast<uint64_t>( tcs );
             debug( vars, "TimecodeScale=%" PRId64, vars.obj->i_timescale );
         }
         E_CASE( KaxDuration, dur )
@@ -1246,7 +1246,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
         E_CASE( KaxSegmentFamily, uid )
         {
             vars.obj->families.push_back( new KaxSegmentFamily(uid) );
-            debug( vars, "Family=%" PRIx64, *reinterpret_cast<uint64*>( uid.GetBuffer() ) );
+            debug( vars, "Family=%" PRIx64, *reinterpret_cast<uint64_t*>( uid.GetBuffer() ) );
         }
         E_CASE( KaxDateUTC, date )
         {
@@ -1270,11 +1270,11 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
 
                 E_CASE( KaxChapterTranslateEditionUID, uid )
                 {
-                    vars->editions.push_back( static_cast<uint64>( uid ) );
+                    vars->editions.push_back( static_cast<uint64_t>( uid ) );
                 }
                 E_CASE( KaxChapterTranslateCodec, codec_id )
                 {
-                    vars->codec_id = static_cast<uint32>( codec_id );
+                    vars->codec_id = static_cast<uint32_t>( codec_id );
                 }
                 E_CASE( KaxChapterTranslateID, translated_id )
                 {
@@ -1358,7 +1358,7 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
         }
         E_CASE( KaxChapterFlagHidden, flag )
         {
-            vars.chapters.b_display_seekpoint = static_cast<uint8>( flag ) == 0;
+            vars.chapters.b_display_seekpoint = static_cast<uint8_t>( flag ) == 0;
             debug( vars, "ChapterFlagHidden=%s", vars.chapters.b_display_seekpoint ? "no" : "yes" );
         }
         E_CASE( KaxChapterSegmentUID, uid )
@@ -1366,7 +1366,7 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
             vars.chapters.p_segment_uid = new KaxChapterSegmentUID( uid );
             vars.obj->b_ref_external_segments = true;
 
-            debug( vars, "ChapterSegmentUID=%" PRIx64, *reinterpret_cast<uint64*>( vars.chapters.p_segment_uid->GetBuffer() ) );
+            debug( vars, "ChapterSegmentUID=%" PRIx64, *reinterpret_cast<uint64_t*>( vars.chapters.p_segment_uid->GetBuffer() ) );
         }
         E_CASE( KaxChapterSegmentEditionUID, euid )
         {
@@ -1374,20 +1374,20 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
 
             debug( vars, "ChapterSegmentEditionUID=%x",
 #if LIBMATROSKA_VERSION < 0x010300
-              *reinterpret_cast<uint32*>( vars.chapters.p_segment_edition_uid->GetBuffer() )
+              *reinterpret_cast<uint32_t*>( vars.chapters.p_segment_edition_uid->GetBuffer() )
 #else
-              static_cast<uint32>( *vars.chapters.p_segment_edition_uid )
+              static_cast<uint32_t>( *vars.chapters.p_segment_edition_uid )
 #endif
             );
         }
         E_CASE( KaxChapterTimeStart, start )
         {
-            vars.chapters.i_start_time = VLC_TICK_FROM_NS(static_cast<uint64>( start ));
+            vars.chapters.i_start_time = VLC_TICK_FROM_NS(static_cast<uint64_t>( start ));
             debug( vars, "ChapterTimeStart=%" PRId64, vars.chapters.i_start_time );
         }
         E_CASE( KaxChapterTimeEnd, end )
         {
-            vars.chapters.i_end_time = VLC_TICK_FROM_NS(static_cast<uint64>( end ));
+            vars.chapters.i_end_time = VLC_TICK_FROM_NS(static_cast<uint64_t>( end ));
             debug( vars, "ChapterTimeEnd=%" PRId64, vars.chapters.i_end_time );
         }
         E_CASE( KaxChapterDisplay, chapter_display )
@@ -1430,9 +1430,9 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
             {
                 if( MKV_CHECKED_PTR_DECL( p_codec_id, KaxChapterProcessCodecID, cp[j] ) )
                 {
-                    if ( static_cast<uint32>(*p_codec_id) == 0 )
+                    if ( static_cast<uint32_t>(*p_codec_id) == 0 )
                         p_ccodec = new matroska_script_codec_c( vars.obj->sys );
-                    else if ( static_cast<uint32>(*p_codec_id) == 1 )
+                    else if ( static_cast<uint32_t>(*p_codec_id) == 1 )
                         p_ccodec = new dvd_chapter_codec_c( vars.obj->sys );
                     break;
                 }
@@ -1570,20 +1570,20 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
                 }
                 E_CASE( KaxEditionUID, euid )
                 {
-                    vars.p_edition->i_uid = static_cast<uint64> ( euid );
+                    vars.p_edition->i_uid = static_cast<uint64_t> ( euid );
                 }
                 E_CASE( KaxEditionFlagOrdered, flag_ordered )
                 {
-                    vars.p_edition->b_ordered = var_InheritBool(vars.p_demuxer, "mkv-use-ordered-chapters") && static_cast<uint8>( flag_ordered );
+                    vars.p_edition->b_ordered = var_InheritBool(vars.p_demuxer, "mkv-use-ordered-chapters") && static_cast<uint8_t>( flag_ordered );
                 }
                 E_CASE( KaxEditionFlagDefault, flag_default )
                 {
-                    if( static_cast<uint8>( flag_default ) )
+                    if( static_cast<uint8_t>( flag_default ) )
                         vars.obj->i_default_edition = vars.obj->stored_editions.size();
                 }
                 E_CASE( KaxEditionFlagHidden, flag_hidden )
                 {
-                    vars.p_edition->b_hidden = static_cast<uint8>( flag_hidden ) != 0;
+                    vars.p_edition->b_hidden = static_cast<uint8_t>( flag_hidden ) != 0;
                 }
                 E_CASE( EbmlVoid, el )
                 {
@@ -1642,9 +1642,9 @@ bool matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
 
     for( unsigned int i = 0; i < cluster->ListSize(); ++i )
     {
-        if( MKV_CHECKED_PTR_DECL( p_ctc, KaxClusterTimecode, (*cluster)[i] ) )
+        if( MKV_CHECKED_PTR_DECL( p_ctc, KaxClusterTimestamp, (*cluster)[i] ) )
         {
-            cluster->InitTimecode( static_cast<uint64>( *p_ctc ), i_timescale );
+            cluster->InitTimestamp( static_cast<uint64_t>( *p_ctc ), i_timescale );
             _seeker.add_cluster( cluster );
             b_has_timecode = true;
             break;
@@ -1658,7 +1658,7 @@ bool matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
     }
 
     if( b_update_start_time )
-        i_mk_start_time = VLC_TICK_FROM_NS( cluster->GlobalTimecode() );
+        i_mk_start_time = VLC_TICK_FROM_NS( cluster->GlobalTimestamp() );
 
     return true;
 }


=====================================
modules/demux/mkv/matroska_segment_seeker.cpp
=====================================
@@ -67,7 +67,7 @@ SegmentSeeker::add_cluster( KaxCluster * const p_cluster )
 {
     Cluster cinfo = {
         /* fpos     */ p_cluster->GetElementPosition(),
-        /* pts      */ vlc_tick_t( VLC_TICK_FROM_NS( p_cluster->GlobalTimecode() ) ),
+        /* pts      */ vlc_tick_t( VLC_TICK_FROM_NS( p_cluster->GlobalTimestamp() ) ),
         /* duration */ vlc_tick_t( -1 ),
         /* size     */ p_cluster->IsFiniteSize()
             ? p_cluster->GetEndPosition() - p_cluster->GetElementPosition()
@@ -379,7 +379,7 @@ SegmentSeeker::index_unsearched_range( matroska_segment_c& ms, Range search_area
             : static_cast<KaxInternalBlock&>( *block );
 
         block_pos = internal_block.GetElementPosition();
-        block_pts = VLC_TICK_FROM_NS(internal_block.GlobalTimecode());
+        block_pts = VLC_TICK_FROM_NS(internal_block.GlobalTimestamp());
         track_id  = internal_block.TrackNum();
 
         bool const b_valid_track = ms.FindTrackByBlock( block, simpleblock ) != NULL;
@@ -512,10 +512,10 @@ SegmentSeeker::mkv_jump_to( matroska_segment_c& ms, fptr_t fpos )
 
     while( EbmlElement * el = ms.ep.Get() )
     {
-        if( MKV_CHECKED_PTR_DECL( p_tc, KaxClusterTimecode, el ) )
+        if( MKV_CHECKED_PTR_DECL( p_tc, KaxClusterTimestamp, el ) )
         {
             p_tc->ReadData( ms.es.I_O(), SCOPE_ALL_DATA );
-            ms.cluster->InitTimecode( static_cast<uint64>( *p_tc ), ms.i_timescale );
+            ms.cluster->InitTimestamp( static_cast<uint64_t>( *p_tc ), ms.i_timescale );
             add_cluster(ms.cluster);
             break;
         }
@@ -525,7 +525,7 @@ SegmentSeeker::mkv_jump_to( matroska_segment_c& ms, fptr_t fpos )
         }
     }
 
-    /* TODO: add error handling; what if we never get a KaxCluster and/or KaxClusterTimecode? */
+    /* TODO: add error handling; what if we never get a KaxCluster and/or KaxClusterTimestamp? */
 
     mark_range_as_searched( Range( i_cluster_pos, ms.es.I_O().getFilePointer() ) );
 


=====================================
modules/demux/mkv/mkv.cpp
=====================================
@@ -842,7 +842,7 @@ static int Demux( demux_t *p_demux)
     /* set pts */
     {
         p_sys->i_pts = p_sys->i_mk_chapter_time + VLC_TICK_0;
-        p_sys->i_pts += VLC_TICK_FROM_NS(internal_block.GlobalTimecode());
+        p_sys->i_pts += VLC_TICK_FROM_NS(internal_block.GlobalTimestamp());
     }
 
     if ( p_vsegment->CurrentEdition() &&


=====================================
modules/demux/mkv/mkv.hpp
=====================================
@@ -50,35 +50,41 @@
 #include <stdexcept>
 
 /* libebml and matroska */
-#include "ebml/EbmlHead.h"
-#include "ebml/EbmlSubHead.h"
-#include "ebml/EbmlStream.h"
-#include "ebml/EbmlContexts.h"
-#include "ebml/EbmlVoid.h"
-#include "ebml/EbmlVersion.h"
-
-#include "matroska/KaxAttachments.h"
-#include "matroska/KaxAttached.h"
-#include "matroska/KaxBlock.h"
-#include "matroska/KaxBlockData.h"
-#include "matroska/KaxChapters.h"
-#include "matroska/KaxCluster.h"
-#include "matroska/KaxClusterData.h"
-#include "matroska/KaxContexts.h"
-#include "matroska/KaxCues.h"
-#include "matroska/KaxCuesData.h"
-#include "matroska/KaxInfo.h"
-#include "matroska/KaxInfoData.h"
-#include "matroska/KaxSeekHead.h"
-#include "matroska/KaxSegment.h"
-#include "matroska/KaxTag.h"
-#include "matroska/KaxTags.h"
-#include "matroska/KaxTracks.h"
-#include "matroska/KaxTrackAudio.h"
-#include "matroska/KaxTrackVideo.h"
-#include "matroska/KaxTrackEntryData.h"
-#include "matroska/KaxContentEncoding.h"
-#include "matroska/KaxVersion.h"
+#include <ebml/EbmlVersion.h>
+#include <ebml/EbmlHead.h>
+#include <ebml/EbmlSubHead.h>
+#include <ebml/EbmlStream.h>
+#include <ebml/EbmlContexts.h>
+#include <ebml/EbmlVoid.h>
+
+#include <matroska/KaxVersion.h>
+#include <matroska/KaxAttachments.h>
+#include <matroska/KaxAttached.h>
+#include <matroska/KaxBlock.h>
+#include <matroska/KaxBlockData.h>
+#include <matroska/KaxChapters.h>
+#include <matroska/KaxCluster.h>
+#include <matroska/KaxClusterData.h>
+#include <matroska/KaxContexts.h>
+#include <matroska/KaxCues.h>
+#include <matroska/KaxCuesData.h>
+#include <matroska/KaxInfo.h>
+#include <matroska/KaxInfoData.h>
+#include <matroska/KaxSeekHead.h>
+#include <matroska/KaxSegment.h>
+#include <matroska/KaxTag.h>
+#include <matroska/KaxTags.h>
+#include <matroska/KaxTracks.h>
+#include <matroska/KaxTrackAudio.h>
+#include <matroska/KaxTrackVideo.h>
+#include <matroska/KaxTrackEntryData.h>
+#include <matroska/KaxContentEncoding.h>
+
+#define GlobalTimestamp()   GlobalTimecode()
+#define InitTimestamp(t,s)  InitTimecode(t,s)
+using KaxClusterTimestamp    = libmatroska::KaxClusterTimecode;
+using KaxTimestampScale      = libmatroska::KaxTimecodeScale;
+using KaxTrackTimestampScale = libmatroska::KaxTrackTimecodeScale;
 
 #include "stream_io_callback.hpp"
 
@@ -107,12 +113,12 @@ enum
 
 #define MKVD_TIMECODESCALE 1000000
 
-#define MKV_IS_ID( el, C ) ( el != NULL && (el->operator const EbmlId&()) == (C::ClassInfos.ClassId()) && !el->IsDummy() )
+#define MKV_IS_ID( el, C ) ( el != NULL && (el->operator const EbmlId&()) == EBML_ID(C) && !el->IsDummy() )
 #define MKV_CHECKED_PTR_DECL( name, type, src ) type * name = MKV_IS_ID(src, type) ? static_cast<type*>(src) : NULL
 #define MKV_CHECKED_PTR_DECL_CONST( name, type, src ) const type * name = MKV_IS_ID(src, type) ? static_cast<const type*>(src) : NULL
 
 
-using namespace LIBMATROSKA_NAMESPACE;
+using namespace libmatroska;
 
 void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
                   KaxBlockAdditions *additions,


=====================================
modules/demux/mkv/stream_io_callback.cpp
=====================================
@@ -87,7 +87,7 @@ void vlc_stream_io_callback::setFilePointer(int64_t i_offset, seek_mode mode )
     return;
 }
 
-uint64 vlc_stream_io_callback::getFilePointer( void )
+uint64_t vlc_stream_io_callback::getFilePointer( void )
 {
     if ( s == NULL )
         return 0;
@@ -99,19 +99,4 @@ size_t vlc_stream_io_callback::write(const void *, size_t )
     return 0;
 }
 
-uint64 vlc_stream_io_callback::toRead( void )
-{
-    uint64_t i_size;
-
-    if( s == NULL)
-        return 0;
-
-    i_size = stream_Size( s );
-
-    if( i_size <= 0 )
-        return UINT64_MAX;
-
-    return static_cast<uint64>( i_size - vlc_stream_Tell( s ) );
-}
-
 } // namespace


=====================================
modules/demux/mkv/stream_io_callback.hpp
=====================================
@@ -30,9 +30,9 @@
 
 #include <vlc_demux.h>
 
-#include "ebml/IOCallback.h"
+#include <ebml/IOCallback.h>
 
-using namespace LIBEBML_NAMESPACE;
+using namespace libebml;
 
 namespace mkv {
 
@@ -57,12 +57,11 @@ class vlc_stream_io_callback: public IOCallback
 
     bool IsEOF() const { return mb_eof; }
 
-    virtual uint32   read            ( void *p_buffer, size_t i_size);
-    virtual void     setFilePointer  ( int64_t i_offset, seek_mode mode = seek_beginning );
-    virtual size_t   write           ( const void *p_buffer, size_t i_size);
-    virtual uint64   getFilePointer  ( void );
-    virtual void     close           ( void ) { return; }
-    uint64           toRead          ( void );
+    virtual uint32_t read            ( void *p_buffer, size_t i_size) override;
+    virtual void     setFilePointer  ( int64_t i_offset, seek_mode mode = seek_beginning ) override;
+    virtual size_t   write           ( const void *p_buffer, size_t i_size) override;
+    virtual uint64_t getFilePointer  ( void ) override;
+    virtual void     close           ( void ) override { return; }
 };
 
 } // namespace


=====================================
modules/demux/mkv/virtual_segment.cpp
=====================================
@@ -29,7 +29,8 @@
 namespace mkv {
 
 /* FIXME move this, it's demux_sys_t::FindSegment */
-matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vector<matroska_segment_c*> & segments )
+template<typename T>
+matroska_segment_c * getSegmentbyUID( T * p_uid, std::vector<matroska_segment_c*> & segments )
 {
     for( size_t i = 0; i < segments.size(); i++ )
     {
@@ -54,7 +55,7 @@ virtual_chapter_c * virtual_chapter_c::CreateVirtualChapter( chapter_item_c * p_
 
     matroska_segment_c * p_segment = &main_segment;
     if( p_chap->p_segment_uid &&
-       ( !( p_segment = getSegmentbyUID( (KaxSegmentUID*) p_chap->p_segment_uid,segments ) ) || !b_ordered ) )
+       ( !( p_segment = getSegmentbyUID( p_chap->p_segment_uid,segments ) ) || !b_ordered ) )
     {
         msg_Warn( &main_segment.sys.demuxer,
                   "Couldn't find segment 0x%x or not ordered... - ignoring chapter %s",



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/89aabb63144e5a552869019fe7b7895a60f4763b...de03f1e026976220eab1c6b8d091e93a4760194f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/89aabb63144e5a552869019fe7b7895a60f4763b...de03f1e026976220eab1c6b8d091e93a4760194f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list