[vlc-devel] [PATCH 05/20] mkv: matroska_segment_parse.cpp c-style cast => c++ cast
Filip Roséen
filip at videolabs.io
Fri Mar 4 17:04:03 CET 2016
---
modules/demux/mkv/matroska_segment_parse.cpp | 264 +++++++++++++--------------
1 file changed, 132 insertions(+), 132 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 652b549..053861e 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -50,7 +50,7 @@ static inline void fill_extra_data_alac( mkv_track_t *p_tk )
p_tk->fmt.p_extra = malloc( p_tk->i_extra_data + 12 );
if( unlikely( !p_tk->fmt.p_extra ) ) return;
p_tk->fmt.i_extra = p_tk->i_extra_data + 12;
- uint8_t *p_extra = (uint8_t *)p_tk->fmt.p_extra;
+ uint8_t *p_extra = static_cast<uint8_t*>( p_tk->fmt.p_extra );
/* See "ALAC Specific Info (36 bytes) (required)" from
alac.macosforge.org/trac/browser/trunk/ALACMagicCookieDescription.txt */
SetDWBE( p_extra, p_tk->fmt.i_extra );
@@ -116,15 +116,15 @@ void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
}
if( MKV_IS_ID( l, KaxSeekID ) )
{
- KaxSeekID &sid = *(KaxSeekID*)l;
+ KaxSeekID &sid = *static_cast<KaxSeekID*>( l );
sid.ReadData( es.I_O() );
id = EbmlId( sid.GetBuffer(), sid.GetSize() );
}
else if( MKV_IS_ID( l, KaxSeekPosition ) )
{
- KaxSeekPosition &spos = *(KaxSeekPosition*)l;
+ KaxSeekPosition &spos = *static_cast<KaxSeekPosition*>( l );
spos.ReadData( es.I_O() );
- i_pos = (int64_t)segment->GetGlobalPosition( uint64( spos ) );
+ i_pos = (int64_t)segment->GetGlobalPosition( static_cast<uint64>( spos ) );
}
else if ( !MKV_IS_ID( l, EbmlVoid ) && !MKV_IS_ID( l, EbmlCrc32 ))
{
@@ -203,7 +203,7 @@ static void MkvTree( demux_t & demuxer, int i_level, const char *psz_format, ...
}
va_start( args, psz_format );
static const char psz_foo[] = "| | | | | | | | | |";
- char *psz_foo2 = (char*)malloc( i_level * 4 + 3 + strlen( psz_format ) );
+ char *psz_foo2 = static_cast<char*>( malloc( i_level * 4 + 3 + strlen( psz_format ) ) );
strncpy( psz_foo2, psz_foo, 4 * i_level );
psz_foo2[ 4 * i_level ] = '+';
psz_foo2[ 4 * i_level + 1 ] = ' ';
@@ -264,23 +264,23 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
if( MKV_IS_ID( l, KaxTrackNumber ) )
{
- KaxTrackNumber &tnum = *(KaxTrackNumber*)l;
+ KaxTrackNumber &tnum = *static_cast<KaxTrackNumber*>( l );
- tk->i_number = uint32( tnum );
- msg_Dbg( &sys.demuxer, "| | | + Track Number=%u", uint32( tnum ) );
+ tk->i_number = static_cast<uint32>( tnum );
+ msg_Dbg( &sys.demuxer, "| | | + Track Number=%u", static_cast<uint32>( tnum ) );
}
else if( MKV_IS_ID( l, KaxTrackUID ) )
{
- KaxTrackUID &tuid = *(KaxTrackUID*)l;
+ KaxTrackUID &tuid = *static_cast<KaxTrackUID*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track UID=%u", uint32( tuid ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track UID=%u", static_cast<uint32>( tuid ) );
}
else if( MKV_IS_ID( l, KaxTrackType ) )
{
const char *psz_type;
- KaxTrackType &ttype = *(KaxTrackType*)l;
+ KaxTrackType &ttype = *static_cast<KaxTrackType*>( l );
- switch( uint8(ttype) )
+ switch( static_cast<uint8>( ttype ) )
{
case track_audio:
psz_type = "audio";
@@ -310,46 +310,46 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
}
else if( MKV_IS_ID( l, KaxTrackFlagEnabled ) ) // UNUSED
{
- KaxTrackFlagEnabled &fenb = *(KaxTrackFlagEnabled*)l;
+ KaxTrackFlagEnabled &fenb = *static_cast<KaxTrackFlagEnabled*>( l );
- tk->b_enabled = uint32( fenb );
- msg_Dbg( &sys.demuxer, "| | | + Track Enabled=%u", uint32( fenb ) );
+ tk->b_enabled = static_cast<uint32>( fenb );
+ msg_Dbg( &sys.demuxer, "| | | + Track Enabled=%u", static_cast<uint32>( fenb ) );
}
else if( MKV_IS_ID( l, KaxTrackFlagDefault ) )
{
- KaxTrackFlagDefault &fdef = *(KaxTrackFlagDefault*)l;
+ KaxTrackFlagDefault &fdef = *static_cast<KaxTrackFlagDefault*>( l );
- tk->b_default = uint32( fdef );
- msg_Dbg( &sys.demuxer, "| | | + Track Default=%u", uint32( fdef ) );
+ tk->b_default = static_cast<uint32>( fdef );
+ msg_Dbg( &sys.demuxer, "| | | + Track Default=%u", static_cast<uint32>( fdef ) );
}
else if( MKV_IS_ID( l, KaxTrackFlagForced ) ) // UNUSED
{
- KaxTrackFlagForced &ffor = *(KaxTrackFlagForced*)l;
- tk->b_forced = uint32( ffor );
+ KaxTrackFlagForced &ffor = *static_cast<KaxTrackFlagForced*>( l );
+ tk->b_forced = static_cast<uint32>( ffor );
- msg_Dbg( &sys.demuxer, "| | | + Track Forced=%u", uint32( ffor ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track Forced=%u", static_cast<uint32>( ffor ) );
}
else if( MKV_IS_ID( l, KaxTrackFlagLacing ) ) // UNUSED
{
- KaxTrackFlagLacing &lac = *(KaxTrackFlagLacing*)l;
+ KaxTrackFlagLacing &lac = *static_cast<KaxTrackFlagLacing*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track Lacing=%d", uint32( lac ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track Lacing=%d", static_cast<uint32>( lac ) );
}
else if( MKV_IS_ID( l, KaxTrackMinCache ) ) // UNUSED
{
- KaxTrackMinCache &cmin = *(KaxTrackMinCache*)l;
+ KaxTrackMinCache &cmin = *static_cast<KaxTrackMinCache*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track MinCache=%d", uint32( cmin ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track MinCache=%d", static_cast<uint32>( cmin ) );
}
else if( MKV_IS_ID( l, KaxTrackMaxCache ) ) // UNUSED
{
- KaxTrackMaxCache &cmax = *(KaxTrackMaxCache*)l;
+ KaxTrackMaxCache &cmax = *static_cast<KaxTrackMaxCache*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track MaxCache=%d", uint32( cmax ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track MaxCache=%d", static_cast<uint32>( cmax ) );
}
else if( MKV_IS_ID( l, KaxTrackDefaultDuration ) )
{
- KaxTrackDefaultDuration &defd = *(KaxTrackDefaultDuration*)l;
+ KaxTrackDefaultDuration &defd = *static_cast<KaxTrackDefaultDuration*>( l );
tk->i_default_duration = uint64(defd);
msg_Dbg( &sys.demuxer, "| | | + Track Default Duration=%" PRId64, tk->i_default_duration );
@@ -357,28 +357,28 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
}
else if( MKV_IS_ID( l, KaxTrackTimecodeScale ) )
{
- KaxTrackTimecodeScale &ttcs = *(KaxTrackTimecodeScale*)l;
+ KaxTrackTimecodeScale &ttcs = *static_cast<KaxTrackTimecodeScale*>( l );
- tk->f_timecodescale = float( ttcs );
+ tk->f_timecodescale = static_cast<float>( ttcs );
if ( tk->f_timecodescale <= 0 ) tk->f_timecodescale = 1.0;
msg_Dbg( &sys.demuxer, "| | | + Track TimeCodeScale=%f", tk->f_timecodescale );
}
else if( MKV_IS_ID( l, KaxMaxBlockAdditionID ) ) // UNUSED
{
- KaxMaxBlockAdditionID &mbl = *(KaxMaxBlockAdditionID*)l;
+ KaxMaxBlockAdditionID &mbl = *static_cast<KaxMaxBlockAdditionID*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track Max BlockAdditionID=%d", uint32( mbl ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track Max BlockAdditionID=%d", static_cast<uint32>( mbl ) );
}
else if( MKV_IS_ID( l, KaxTrackName ) )
{
- KaxTrackName &tname = *(KaxTrackName*)l;
+ KaxTrackName &tname = *static_cast<KaxTrackName*>( l );
tk->fmt.psz_description = ToUTF8( UTFstring( tname ) );
msg_Dbg( &sys.demuxer, "| | | + Track Name=%s", tk->fmt.psz_description );
}
else if( MKV_IS_ID( l, KaxTrackLanguage ) )
{
- KaxTrackLanguage &lang = *(KaxTrackLanguage*)l;
+ KaxTrackLanguage &lang = *static_cast<KaxTrackLanguage*>( l );
free( tk->fmt.psz_language );
tk->fmt.psz_language = strdup( std::string( lang ).c_str() );
@@ -387,26 +387,26 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
}
else if( MKV_IS_ID( l, KaxCodecID ) )
{
- KaxCodecID &codecid = *(KaxCodecID*)l;
+ KaxCodecID &codecid = *static_cast<KaxCodecID*>( l );
tk->psz_codec = strdup( std::string( codecid ).c_str() );
msg_Dbg( &sys.demuxer, "| | | + Track CodecId=%s", std::string( codecid ).c_str() );
}
else if( MKV_IS_ID( l, KaxCodecPrivate ) )
{
- KaxCodecPrivate &cpriv = *(KaxCodecPrivate*)l;
+ KaxCodecPrivate &cpriv = *static_cast<KaxCodecPrivate*>( l );
tk->i_extra_data = cpriv.GetSize();
if( tk->i_extra_data > 0 )
{
- tk->p_extra_data = (uint8_t*)malloc( tk->i_extra_data );
+ tk->p_extra_data = static_cast<uint8_t*>( malloc( tk->i_extra_data ) );
memcpy( tk->p_extra_data, cpriv.GetBuffer(), tk->i_extra_data );
}
msg_Dbg( &sys.demuxer, "| | | + Track CodecPrivate size=%" PRId64, cpriv.GetSize() );
}
else if( MKV_IS_ID( l, KaxCodecName ) )
{
- KaxCodecName &cname = *(KaxCodecName*)l;
+ KaxCodecName &cname = *static_cast<KaxCodecName*>( l );
tk->psz_codec_name = ToUTF8( UTFstring( cname ) );
msg_Dbg( &sys.demuxer, "| | | + Track Codec Name=%s", tk->psz_codec_name );
@@ -414,27 +414,27 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
//AttachmentLink
else if( MKV_IS_ID( l, KaxCodecDecodeAll ) ) // UNUSED
{
- KaxCodecDecodeAll &cdall = *(KaxCodecDecodeAll*)l;
+ KaxCodecDecodeAll &cdall = *static_cast<KaxCodecDecodeAll*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track Codec Decode All=%u", uint8( cdall ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track Codec Decode All=%u", static_cast<uint8>( cdall ) );
}
else if( MKV_IS_ID( l, KaxTrackOverlay ) ) // UNUSED
{
- KaxTrackOverlay &tovr = *(KaxTrackOverlay*)l;
+ KaxTrackOverlay &tovr = *static_cast<KaxTrackOverlay*>( l );
- msg_Dbg( &sys.demuxer, "| | | + Track Overlay=%u", uint32( tovr ) );
+ msg_Dbg( &sys.demuxer, "| | | + Track Overlay=%u", static_cast<uint32>( tovr ) );
}
#if LIBMATROSKA_VERSION >= 0x010401
else if( MKV_IS_ID( l, KaxCodecDelay ) )
{
- KaxCodecDelay &codecdelay = *(KaxCodecDelay*)l;
+ KaxCodecDelay &codecdelay = *static_cast<KaxCodecDelay*>( l );
tk->i_codec_delay = uint64_t( codecdelay ) / 1000;
msg_Dbg( &sys.demuxer, "| | | + Track Codec Delay =%" PRIu64,
tk->i_codec_delay );
}
else if( MKV_IS_ID( l, KaxSeekPreRoll ) )
{
- KaxSeekPreRoll &spr = *(KaxSeekPreRoll*)l;
+ KaxSeekPreRoll &spr = *static_cast<KaxSeekPreRoll*>( l );
tk->i_seek_preroll = uint64_t(spr) / 1000;
msg_Dbg( &sys.demuxer, "| | | + Track Seek Preroll =%" PRIu64, tk->i_seek_preroll );
}
@@ -461,18 +461,18 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
if( MKV_IS_ID( l3, KaxContentEncodingOrder ) )
{
KaxContentEncodingOrder &encord = *(KaxContentEncodingOrder*)l3;
- MkvTree( sys.demuxer, 5, "Order: %i", uint32( encord ) );
+ MkvTree( sys.demuxer, 5, "Order: %i", static_cast<uint32>( encord ) );
}
else if( MKV_IS_ID( l3, KaxContentEncodingScope ) )
{
KaxContentEncodingScope &encscope = *(KaxContentEncodingScope*)l3;
- tk->i_encoding_scope = uint32( encscope );
- MkvTree( sys.demuxer, 5, "Scope: %i", uint32( encscope ) );
+ tk->i_encoding_scope = static_cast<uint32>( encscope );
+ MkvTree( sys.demuxer, 5, "Scope: %i", static_cast<uint32>( encscope ) );
}
else if( MKV_IS_ID( l3, KaxContentEncodingType ) )
{
KaxContentEncodingType &enctype = *(KaxContentEncodingType*)l3;
- MkvTree( sys.demuxer, 5, "Type: %i", uint32( enctype ) );
+ MkvTree( sys.demuxer, 5, "Type: %i", static_cast<uint32>( enctype ) );
}
else if( MKV_IS_ID( l3, KaxContentCompression ) )
{
@@ -486,8 +486,8 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
if( MKV_IS_ID( l4, KaxContentCompAlgo ) )
{
KaxContentCompAlgo &compalg = *(KaxContentCompAlgo*)l4;
- MkvTree( sys.demuxer, 6, "Compression Algorithm: %i", uint32(compalg) );
- tk->i_compression_type = uint32( compalg );
+ MkvTree( sys.demuxer, 6, "Compression Algorithm: %i", static_cast<uint32>(compalg) );
+ tk->i_compression_type = static_cast<uint32>( compalg );
if ( ( tk->i_compression_type != MATROSKA_COMPRESSION_ZLIB ) &&
( tk->i_compression_type != MATROSKA_COMPRESSION_HEADER ) )
{
@@ -556,93 +556,93 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
EbmlElement *l = (*tkv)[j];
if( MKV_IS_ID( l, KaxVideoFlagInterlaced ) ) // UNUSED
{
- KaxVideoFlagInterlaced &fint = *(KaxVideoFlagInterlaced*)l;
+ KaxVideoFlagInterlaced &fint = *static_cast<KaxVideoFlagInterlaced*>( l );
- msg_Dbg( &sys.demuxer, "| | | | + Track Video Interlaced=%u", uint8( fint ) );
+ msg_Dbg( &sys.demuxer, "| | | | + Track Video Interlaced=%u", static_cast<uint8>( fint ) );
}
else if( MKV_IS_ID( l, KaxVideoStereoMode ) ) // UNUSED
{
- KaxVideoStereoMode &stereo = *(KaxVideoStereoMode*)l;
+ KaxVideoStereoMode &stereo = *static_cast<KaxVideoStereoMode*>( l );
- msg_Dbg( &sys.demuxer, "| | | | + Track Video Stereo Mode=%u", uint8( stereo ) );
+ msg_Dbg( &sys.demuxer, "| | | | + Track Video Stereo Mode=%u", static_cast<uint8>( stereo ) );
}
else if( MKV_IS_ID( l, KaxVideoPixelWidth ) )
{
- KaxVideoPixelWidth &vwidth = *(KaxVideoPixelWidth*)l;
+ KaxVideoPixelWidth &vwidth = *static_cast<KaxVideoPixelWidth*>( l );
- tk->fmt.video.i_width += uint16( vwidth );
- msg_Dbg( &sys.demuxer, "| | | | + width=%d", uint16( vwidth ) );
+ tk->fmt.video.i_width += static_cast<uint16>( vwidth );
+ msg_Dbg( &sys.demuxer, "| | | | + width=%d", static_cast<uint16>( vwidth ) );
}
else if( MKV_IS_ID( l, KaxVideoPixelHeight ) )
{
- KaxVideoPixelWidth &vheight = *(KaxVideoPixelWidth*)l;
+ KaxVideoPixelWidth &vheight = *static_cast<KaxVideoPixelWidth*>( l );
- tk->fmt.video.i_height += uint16( vheight );
- msg_Dbg( &sys.demuxer, "| | | | + height=%d", uint16( vheight ) );
+ tk->fmt.video.i_height += static_cast<uint16>( vheight );
+ msg_Dbg( &sys.demuxer, "| | | | + height=%d", static_cast<uint16>( vheight ) );
}
else if( MKV_IS_ID( l, KaxVideoDisplayWidth ) )
{
- KaxVideoDisplayWidth &vwidth = *(KaxVideoDisplayWidth*)l;
+ KaxVideoDisplayWidth &vwidth = *static_cast<KaxVideoDisplayWidth*>( l );
- i_display_width = uint16( vwidth );
- msg_Dbg( &sys.demuxer, "| | | | + display width=%d", uint16( vwidth ) );
+ i_display_width = static_cast<uint16>( vwidth );
+ msg_Dbg( &sys.demuxer, "| | | | + display width=%d", static_cast<uint16>( vwidth ) );
}
else if( MKV_IS_ID( l, KaxVideoDisplayHeight ) )
{
- KaxVideoDisplayWidth &vheight = *(KaxVideoDisplayWidth*)l;
+ KaxVideoDisplayWidth &vheight = *static_cast<KaxVideoDisplayWidth*>( l );
- i_display_height = uint16( vheight );
- msg_Dbg( &sys.demuxer, "| | | | + display height=%d", uint16( vheight ) );
+ i_display_height = static_cast<uint16>( vheight );
+ msg_Dbg( &sys.demuxer, "| | | | + display height=%d", static_cast<uint16>( vheight ) );
}
else if( MKV_IS_ID( l, KaxVideoPixelCropBottom ) )
{
- KaxVideoPixelCropBottom &cropval = *(KaxVideoPixelCropBottom*)l;
+ KaxVideoPixelCropBottom &cropval = *static_cast<KaxVideoPixelCropBottom*>( l );
- i_crop_bottom = uint16( cropval );
- msg_Dbg( &sys.demuxer, "| | | | + crop pixel bottom=%d", uint16( cropval ) );
+ i_crop_bottom = static_cast<uint16>( cropval );
+ msg_Dbg( &sys.demuxer, "| | | | + crop pixel bottom=%d", static_cast<uint16>( cropval ) );
}
else if( MKV_IS_ID( l, KaxVideoPixelCropTop ) )
{
- KaxVideoPixelCropTop &cropval = *(KaxVideoPixelCropTop*)l;
+ KaxVideoPixelCropTop &cropval = *static_cast<KaxVideoPixelCropTop*>( l );
- i_crop_top = uint16( cropval );
- msg_Dbg( &sys.demuxer, "| | | | + crop pixel top=%d", uint16( cropval ) );
+ i_crop_top = static_cast<uint16>( cropval );
+ msg_Dbg( &sys.demuxer, "| | | | + crop pixel top=%d", static_cast<uint16>( cropval ) );
}
else if( MKV_IS_ID( l, KaxVideoPixelCropRight ) )
{
- KaxVideoPixelCropRight &cropval = *(KaxVideoPixelCropRight*)l;
+ KaxVideoPixelCropRight &cropval = *static_cast<KaxVideoPixelCropRight*>( l );
- i_crop_right = uint16( cropval );
- msg_Dbg( &sys.demuxer, "| | | | + crop pixel right=%d", uint16( cropval ) );
+ i_crop_right = static_cast<uint16>( cropval );
+ msg_Dbg( &sys.demuxer, "| | | | + crop pixel right=%d", static_cast<uint16>( cropval ) );
}
else if( MKV_IS_ID( l, KaxVideoPixelCropLeft ) )
{
- KaxVideoPixelCropLeft &cropval = *(KaxVideoPixelCropLeft*)l;
+ KaxVideoPixelCropLeft &cropval = *static_cast<KaxVideoPixelCropLeft*>( l );
- i_crop_left = uint16( cropval );
- msg_Dbg( &sys.demuxer, "| | | | + crop pixel left=%d", uint16( cropval ) );
+ i_crop_left = static_cast<uint16>( cropval );
+ msg_Dbg( &sys.demuxer, "| | | | + crop pixel left=%d", static_cast<uint16>( cropval ) );
}
else if( MKV_IS_ID( l, KaxVideoDisplayUnit ) )
{
- KaxVideoDisplayUnit &vdmode = *(KaxVideoDisplayUnit*)l;
+ KaxVideoDisplayUnit &vdmode = *static_cast<KaxVideoDisplayUnit*>( l );
- i_display_unit = uint8( vdmode );
+ i_display_unit = static_cast<uint8>( vdmode );
msg_Dbg( &sys.demuxer, "| | | | + Track Video Display Unit=%s",
i_display_unit == 0 ? "pixels" : ( i_display_unit == 1 ? "centimeters": "inches" ) );
}
else if( MKV_IS_ID( l, KaxVideoAspectRatio ) ) // UNUSED
{
- KaxVideoAspectRatio &ratio = *(KaxVideoAspectRatio*)l;
+ KaxVideoAspectRatio &ratio = *static_cast<KaxVideoAspectRatio*>( l );
- msg_Dbg( &sys.demuxer, " | | | + Track Video Aspect Ratio Type=%u", uint8( ratio ) );
+ msg_Dbg( &sys.demuxer, " | | | + Track Video Aspect Ratio Type=%u", static_cast<uint8>( ratio ) );
}
// ColourSpace UNUSED
else if( MKV_IS_ID( l, KaxVideoFrameRate ) )
{
- KaxVideoFrameRate &vfps = *(KaxVideoFrameRate*)l;
+ KaxVideoFrameRate &vfps = *static_cast<KaxVideoFrameRate*>( l );
- tk->f_fps = __MAX( float( vfps ), 1 );
- msg_Dbg( &sys.demuxer, " | | | + fps=%f", float( vfps ) );
+ tk->f_fps = __MAX( static_cast<float>( vfps ), 1 );
+ msg_Dbg( &sys.demuxer, " | | | + fps=%f", static_cast<float>( vfps ) );
}
// else if( MKV_IS_ID( l, KaxVideoGamma) ) //DEPRECATED by Matroska
// {
@@ -688,31 +688,31 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
if( MKV_IS_ID( l, KaxAudioSamplingFreq ) )
{
- KaxAudioSamplingFreq &afreq = *(KaxAudioSamplingFreq*)l;
+ KaxAudioSamplingFreq &afreq = *static_cast<KaxAudioSamplingFreq*>( l );
- tk->i_original_rate = tk->fmt.audio.i_rate = (int)float( afreq );
+ tk->i_original_rate = tk->fmt.audio.i_rate = static_cast<int>( static_cast<float>( afreq ) );
msg_Dbg( &sys.demuxer, "| | | | + afreq=%d", tk->fmt.audio.i_rate );
}
else if( MKV_IS_ID( l, KaxAudioOutputSamplingFreq ) )
{
- KaxAudioOutputSamplingFreq &afreq = *(KaxAudioOutputSamplingFreq*)l;
+ KaxAudioOutputSamplingFreq &afreq = *static_cast<KaxAudioOutputSamplingFreq*>( l );
- tk->fmt.audio.i_rate = (int)float( afreq );
+ tk->fmt.audio.i_rate = static_cast<int>( static_cast<float>( afreq ) );
msg_Dbg( &sys.demuxer, "| | | | + aoutfreq=%d", tk->fmt.audio.i_rate );
}
else if( MKV_IS_ID( l, KaxAudioChannels ) )
{
- KaxAudioChannels &achan = *(KaxAudioChannels*)l;
+ KaxAudioChannels &achan = *static_cast<KaxAudioChannels*>( l );
- tk->fmt.audio.i_channels = uint8( achan );
- msg_Dbg( &sys.demuxer, "| | | | + achan=%u", uint8( achan ) );
+ tk->fmt.audio.i_channels = static_cast<uint8>( achan );
+ msg_Dbg( &sys.demuxer, "| | | | + achan=%u", static_cast<uint8>( achan ) );
}
else if( MKV_IS_ID( l, KaxAudioBitDepth ) )
{
- KaxAudioBitDepth &abits = *(KaxAudioBitDepth*)l;
+ KaxAudioBitDepth &abits = *static_cast<KaxAudioBitDepth*>( l );
- tk->fmt.audio.i_bitspersample = uint8( abits );
- msg_Dbg( &sys.demuxer, "| | | | + abits=%u", uint8( abits ) );
+ tk->fmt.audio.i_bitspersample = static_cast<uint8>( abits );
+ msg_Dbg( &sys.demuxer, "| | | | + abits=%u", static_cast<uint8>( abits ) );
}
else if ( !MKV_IS_ID( l, EbmlVoid ) )
{
@@ -828,7 +828,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
if ( p_segment_uid == NULL )
p_segment_uid = new KaxSegmentUID(*static_cast<KaxSegmentUID*>(l));
- msg_Dbg( &sys.demuxer, "| | + UID=%d", *(uint32*)p_segment_uid->GetBuffer() );
+ msg_Dbg( &sys.demuxer, "| | + UID=%d", *reinterpret_cast<uint32*>( p_segment_uid->GetBuffer() ) );
}
else if( MKV_IS_ID( l, KaxPrevUID ) )
{
@@ -838,7 +838,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
b_ref_external_segments = true;
}
- msg_Dbg( &sys.demuxer, "| | + PrevUID=%d", *(uint32*)p_prev_segment_uid->GetBuffer() );
+ msg_Dbg( &sys.demuxer, "| | + PrevUID=%d", *reinterpret_cast<uint32*>( p_prev_segment_uid->GetBuffer() ) );
}
else if( MKV_IS_ID( l, KaxNextUID ) )
{
@@ -848,20 +848,20 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
b_ref_external_segments = true;
}
- msg_Dbg( &sys.demuxer, "| | + NextUID=%d", *(uint32*)p_next_segment_uid->GetBuffer() );
+ msg_Dbg( &sys.demuxer, "| | + NextUID=%d", *reinterpret_cast<uint32*>( p_next_segment_uid->GetBuffer() ) );
}
else if( MKV_IS_ID( l, KaxTimecodeScale ) )
{
- KaxTimecodeScale &tcs = *(KaxTimecodeScale*)l;
+ KaxTimecodeScale &tcs = *static_cast<KaxTimecodeScale*>( l );
- i_timescale = uint64(tcs);
+ i_timescale = static_cast<uint64>( tcs );
msg_Dbg( &sys.demuxer, "| | + TimecodeScale=%" PRId64,
i_timescale );
}
else if( MKV_IS_ID( l, KaxDuration ) )
{
- KaxDuration &dur = *(KaxDuration*)l;
+ KaxDuration &dur = *static_cast<KaxDuration*>( l );
i_duration = mtime_t( double( dur ) );
@@ -870,7 +870,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
}
else if( MKV_IS_ID( l, KaxMuxingApp ) )
{
- KaxMuxingApp &mapp = *(KaxMuxingApp*)l;
+ KaxMuxingApp &mapp = *static_cast<KaxMuxingApp*>( l );
psz_muxing_application = ToUTF8( UTFstring( mapp ) );
@@ -879,7 +879,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
}
else if( MKV_IS_ID( l, KaxWritingApp ) )
{
- KaxWritingApp &wapp = *(KaxWritingApp*)l;
+ KaxWritingApp &wapp = *static_cast<KaxWritingApp*>( l );
psz_writing_application = ToUTF8( UTFstring( wapp ) );
@@ -888,7 +888,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
}
else if( MKV_IS_ID( l, KaxSegmentFilename ) )
{
- KaxSegmentFilename &sfn = *(KaxSegmentFilename*)l;
+ KaxSegmentFilename &sfn = *static_cast<KaxSegmentFilename*>( l );
psz_segment_filename = ToUTF8( UTFstring( sfn ) );
@@ -897,7 +897,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
}
else if( MKV_IS_ID( l, KaxTitle ) )
{
- KaxTitle &title = *(KaxTitle*)l;
+ KaxTitle &title = *static_cast<KaxTitle*>( l );
psz_title = ToUTF8( UTFstring( title ) );
@@ -909,11 +909,11 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
families.push_back( new KaxSegmentFamily(*uid) );
- msg_Dbg( &sys.demuxer, "| | + family=%d", *(uint32*)uid->GetBuffer() );
+ msg_Dbg( &sys.demuxer, "| | + family=%d", *reinterpret_cast<uint32*>( uid->GetBuffer() ) );
}
else if( MKV_IS_ID( l, KaxDateUTC ) )
{
- KaxDateUTC &date = *(KaxDateUTC*)l;
+ KaxDateUTC &date = *static_cast<KaxDateUTC*>( l );
time_t i_date;
struct tm tmres;
char buffer[25];
@@ -947,11 +947,11 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
if( MKV_IS_ID( l, KaxChapterTranslateEditionUID ) )
{
- p_translate->editions.push_back( uint64( *static_cast<KaxChapterTranslateEditionUID*>( l ) ) );
+ p_translate->editions.push_back( static_cast<uint64>( *static_cast<KaxChapterTranslateEditionUID*>( l ) ) );
}
else if( MKV_IS_ID( l, KaxChapterTranslateCodec ) )
{
- p_translate->codec_id = uint32( *static_cast<KaxChapterTranslateCodec*>( l ) );
+ p_translate->codec_id = static_cast<uint32>( *static_cast<KaxChapterTranslateCodec*>( l ) );
}
else if( MKV_IS_ID( l, KaxChapterTranslateID ) )
{
@@ -990,13 +990,13 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
if( MKV_IS_ID( l, KaxChapterUID ) )
{
- chapters.i_uid = uint64_t(*(KaxChapterUID*)l);
+ chapters.i_uid = static_cast<uint64_t>( *static_cast<KaxChapterUID*>( l ) );
msg_Dbg( &sys.demuxer, "| | | | + ChapterUID: %" PRIu64, chapters.i_uid );
}
else if( MKV_IS_ID( l, KaxChapterFlagHidden ) )
{
- KaxChapterFlagHidden &flag =*(KaxChapterFlagHidden*)l;
- chapters.b_display_seekpoint = uint8( flag ) == 0;
+ KaxChapterFlagHidden &flag = *static_cast<KaxChapterFlagHidden*>( l );
+ chapters.b_display_seekpoint = static_cast<uint8>( flag ) == 0;
msg_Dbg( &sys.demuxer, "| | | | + ChapterFlagHidden: %s", chapters.b_display_seekpoint ? "no":"yes" );
}
@@ -1004,30 +1004,30 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
{
chapters.p_segment_uid = new KaxChapterSegmentUID( *static_cast<KaxChapterSegmentUID*>(l) );
b_ref_external_segments = true;
- msg_Dbg( &sys.demuxer, "| | | | + ChapterSegmentUID= %u", *(uint32*)chapters.p_segment_uid->GetBuffer() );
+ msg_Dbg( &sys.demuxer, "| | | | + ChapterSegmentUID= %u", *reinterpret_cast<uint32*>( chapters.p_segment_uid->GetBuffer() ) );
}
else if( MKV_IS_ID( l, KaxChapterSegmentEditionUID ) )
{
chapters.p_segment_edition_uid = new KaxChapterSegmentEditionUID( *static_cast<KaxChapterSegmentEditionUID*>(l) );
msg_Dbg( &sys.demuxer, "| | | | + ChapterSegmentEditionUID= %u",
#if LIBMATROSKA_VERSION < 0x010300
- *(uint32*)chapters.p_segment_edition_uid->GetBuffer()
+ *reinterpret_cast<uint32*>( chapters.p_segment_edition_uid->GetBuffer() )
#else
- *(uint32*)chapters.p_segment_edition_uid
+ static_cast<uint32>( *chapters.p_segment_edition_uid )
#endif
);
}
else if( MKV_IS_ID( l, KaxChapterTimeStart ) )
{
- KaxChapterTimeStart &start =*(KaxChapterTimeStart*)l;
- chapters.i_start_time = uint64( start ) / INT64_C(1000);
+ KaxChapterTimeStart &start = *static_cast<KaxChapterTimeStart*>( l );
+ chapters.i_start_time = static_cast<uint64>( start ) / INT64_C(1000);
msg_Dbg( &sys.demuxer, "| | | | + ChapterTimeStart: %" PRId64, chapters.i_start_time );
}
else if( MKV_IS_ID( l, KaxChapterTimeEnd ) )
{
- KaxChapterTimeEnd &end =*(KaxChapterTimeEnd*)l;
- chapters.i_end_time = uint64( end ) / INT64_C(1000);
+ KaxChapterTimeEnd &end = *static_cast<KaxChapterTimeEnd*>( l );
+ chapters.i_end_time = static_cast<uint64>( end ) / INT64_C(1000);
msg_Dbg( &sys.demuxer, "| | | | + ChapterTimeEnd: %" PRId64, chapters.i_end_time );
}
@@ -1042,7 +1042,7 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
if( MKV_IS_ID( l, KaxChapterString ) )
{
- KaxChapterString &name =*(KaxChapterString*)l;
+ KaxChapterString &name = *static_cast<KaxChapterString*>( l );
for ( int k = 0; k < i_level; k++)
chapters.psz_name += '+';
chapters.psz_name += ' ';
@@ -1055,13 +1055,13 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
}
else if( MKV_IS_ID( l, KaxChapterLanguage ) )
{
- KaxChapterLanguage &lang =*(KaxChapterLanguage*)l;
+ KaxChapterLanguage &lang = *static_cast<KaxChapterLanguage*>( l );
msg_Dbg( &sys.demuxer, "| | | | | + ChapterLanguage '%s'",
std::string( lang ).c_str() );
}
else if( MKV_IS_ID( l, KaxChapterCountry ) )
{
- KaxChapterCountry &ct =*(KaxChapterCountry*)l;
+ KaxChapterCountry &ct = *static_cast<KaxChapterCountry*>( l );
msg_Dbg( &sys.demuxer, "| | | | | + ChapterCountry '%s'",
std::string( ct ).c_str() );
}
@@ -1081,9 +1081,9 @@ void matroska_segment_c::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
if( MKV_IS_ID( k, KaxChapterProcessCodecID ) )
{
KaxChapterProcessCodecID *p_codec_id = static_cast<KaxChapterProcessCodecID*>( k );
- if ( uint32(*p_codec_id) == 0 )
+ if ( static_cast<uint32>(*p_codec_id) == 0 )
p_ccodec = new matroska_script_codec_c( sys );
- else if ( uint32(*p_codec_id) == 1 )
+ else if ( static_cast<uint32>(*p_codec_id) == 1 )
p_ccodec = new dvd_chapter_codec_c( sys );
break;
}
@@ -1226,7 +1226,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
}
else if( MKV_IS_ID( l, KaxEditionUID ) )
{
- p_edition->i_uid = uint64(*static_cast<KaxEditionUID *>( l ));
+ p_edition->i_uid = static_cast<uint64> (*static_cast<KaxEditionUID *>( l ));
}
else if( MKV_IS_ID( l, KaxEditionFlagOrdered ) )
{
@@ -1234,7 +1234,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
}
else if( MKV_IS_ID( l, KaxEditionFlagDefault ) )
{
- if (uint8(*static_cast<KaxEditionFlagDefault *>( l )) != 0)
+ if (static_cast<uint8>( *static_cast<KaxEditionFlagDefault *>( l ) ) != 0)
i_default_edition = stored_editions.size();
}
else if( MKV_IS_ID( l, KaxEditionFlagHidden ) )
@@ -1284,9 +1284,9 @@ void matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
if( MKV_IS_ID( l, KaxClusterTimecode ) )
{
- KaxClusterTimecode &ctc = *(KaxClusterTimecode*)l;
+ KaxClusterTimecode &ctc = *static_cast<KaxClusterTimecode*>( l );
- cluster->InitTimecode( uint64( ctc ), i_timescale );
+ cluster->InitTimecode( static_cast<uint64>( ctc ), i_timescale );
break;
}
}
@@ -1566,8 +1566,8 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
const uint8_t tags[16] = {'O','p','u','s','T','a','g','s',
0, 0, 0, 0, 0, 0, 0, 0};
unsigned ps[2] = { p_tk->i_extra_data, 16 };
- const void *pkt[2] = { (const void *)p_tk->p_extra_data,
- (const void *) tags };
+ const void *pkt[2] = { static_cast<const void *>( p_tk->p_extra_data ),
+ static_cast<const void *>( tags ) };
if( xiph_PackHeaders( &p_tk->fmt.i_extra,
&p_tk->fmt.p_extra,
@@ -1661,7 +1661,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
{
p_fmt->i_extra = 30;
p_fmt->p_extra = xmalloc( p_fmt->i_extra );
- uint8_t *p_extra = (uint8_t*)p_fmt->p_extra;
+ uint8_t *p_extra = static_cast<uint8_t*>( p_fmt->p_extra );
memcpy( &p_extra[ 0], "TTA1", 4 );
SetWLE( &p_extra[ 4], 1 );
SetWLE( &p_extra[ 6], p_fmt->audio.i_channels );
@@ -1717,7 +1717,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
else if( !strcmp( p_tk->psz_codec, "A_REAL/28_8" ) )
p_tk->fmt.i_codec = VLC_CODEC_RA_288;
/* FIXME RALF and SIPR */
- uint16_t version = (uint16_t) hton16(priv->version);
+ uint16_t version = static_cast<uint16_t>( hton16(priv->version) );
p_tk->p_sys =
new Cook_PrivateTrackData( hton16(priv->sub_packet_h),
hton16(priv->frame_size),
--
2.7.2
More information about the vlc-devel
mailing list