*/
inline bool LacingEnabled() const {
auto myLacing = static_cast<KaxTrackFlagLacing *>(FindFirstElt(EBML_INFO(KaxTrackFlagLacing)));
- return((myLacing == nullptr) || (uint8(*myLacing) != 0));
+ return((myLacing == nullptr) || (static_cast<uint8>(*myLacing) != 0));
}
void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
if (myBuffers.empty()) {
// first frame
Timecode = timecode;
- TrackNumber = track.TrackNumber();
+ TrackNumber = static_cast<uint64>(track.TrackNumber());
mInvisible = invisible;
mLacing = lacing;
}
}
EbmlLacingSize += CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize());
for (i = 1; i < static_cast<int>(myBuffers.size()) - 1; i++)
- EbmlLacingSize += CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i - 1]->Size()), 0);
+ EbmlLacingSize += CodedSizeLengthSigned(static_cast<int64>(myBuffers[i]->Size()) - static_cast<int64>(myBuffers[i - 1]->Size()), 0);
if (SameSize)
return LACING_FIXED;
if (XiphLacingSize < EbmlLacingSize)
case LACING_EBML:
SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize()));
for (i=1; i<myBuffers.size()-1; i++) {
- SetSize_(GetSize() + myBuffers[i]->Size() + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0));
+ SetSize_(GetSize() + myBuffers[i]->Size() + CodedSizeLengthSigned(static_cast<int64>(myBuffers[i]->Size()) - static_cast<int64>(myBuffers[i-1]->Size()), 0));
}
break;
case LACING_FIXED:
SetSize_(GetSize() + 1);
tmpSize -= 0xFF;
}
- tmpValue = binary(tmpSize);
+ tmpValue = static_cast<binary>(tmpSize);
output.writeFully(&tmpValue, 1);
SetSize_(GetSize() + 1);
}
// set the size of each member in the lace
for (i=1; i<myBuffers.size()-1; i++) {
- _Size = int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size());
+ _Size = static_cast<int64>(myBuffers[i]->Size()) - static_cast<int64>(myBuffers[i-1]->Size());
_CodedSize = CodedSizeLengthSigned(_Size, 0);
CodedValueLengthSigned(_Size, _CodedSize, _FinalHead);
output.writeFully(_FinalHead, _CodedSize);
big_int16 b16;
b16.Eval(cursor);
assert(ParentCluster != nullptr);
- Timecode = ParentCluster->GetBlockGlobalTimecode(int16(b16));
+ Timecode = ParentCluster->GetBlockGlobalTimecode(static_cast<int16>(b16));
bLocalTimecodeUsed = false;
cursor += 2;
TrackNumber &= 0x7F;
}
- LocalTimecode = int16(Mem.GetUInt16BE());
+ LocalTimecode = static_cast<int16>(Mem.GetUInt16BE());
bLocalTimecodeUsed = true;
uint8 Flags = Mem.GetUInt8();
bIsDiscardable = (Flags & 0x01) != 0;
}
mInvisible = (Flags & 0x08) >> 3;
- mLacing = LacingType((Flags & 0x06) >> 1);
+ mLacing = static_cast<LacingType>((Flags & 0x06) >> 1);
// put all Frames in the list
if (mLacing == LACING_NONE) {
big_int16 b16;
b16.Eval(cursor);
- LocalTimecode = int16(b16);
+ LocalTimecode = static_cast<int16>(b16);
bLocalTimecodeUsed = true;
cursor += 2;
bIsDiscardable = (*cursor & 0x01) != 0;
}
mInvisible = (*cursor & 0x08) >> 3;
- mLacing = LacingType((*cursor++ & 0x06) >> 1);
+ mLacing = static_cast<LacingType>((*cursor++ & 0x06) >> 1);
if (cursor == &_TempHead[4]) {
_TempHead[0] = _TempHead[4];
} else {
FrameSize = 0;
do {
Result += input.read(_TempHead, 1);
- FrameSize += uint8(_TempHead[0]);
+ FrameSize += static_cast<uint8>(_TempHead[0]);
if (FrameSize > TotalLacedSize)
throw SafeReadIOCallback::EndOfStreamX(0);
LastBufferSize--;
assert(ParentTrack != nullptr);
int64 scale = ParentTrack->GlobalTimecodeScale();
KaxBlockDuration & myDuration = *static_cast<KaxBlockDuration *>(FindFirstElt(EBML_INFO(KaxBlockDuration), true));
- *(static_cast<EbmlUInteger *>(&myDuration)) = TimeLength / uint64(scale);
+ *(static_cast<EbmlUInteger *>(&myDuration)) = TimeLength / static_cast<uint64>(scale);
}
bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const
}
assert(ParentTrack != nullptr);
- TheTimecode = uint64(*myDuration) * ParentTrack->GlobalTimecodeScale();
+ TheTimecode = static_cast<uint64>(*myDuration) * ParentTrack->GlobalTimecodeScale();
return true;
}
Block.simpleblock->SetDiscardable(false);
} else {
Block.simpleblock->SetKeyframe(false);
- if ((ForwBlock == nullptr || ((const KaxInternalBlock &)*ForwBlock).GlobalTimecode() <= timecode) &&
- (PastBlock == nullptr || ((const KaxInternalBlock &)*PastBlock).GlobalTimecode() <= timecode))
+ if ((ForwBlock == nullptr || static_cast<const KaxInternalBlock &>(*ForwBlock).GlobalTimecode() <= timecode) &&
+ (PastBlock == nullptr || static_cast<const KaxInternalBlock &>(*PastBlock).GlobalTimecode() <= timecode))
Block.simpleblock->SetDiscardable(false);
else
Block.simpleblock->SetDiscardable(true);
assert(ParentBlock != nullptr);
const KaxInternalBlock &block = *RefdBlock;
- *static_cast<EbmlSInteger*>(this) = (int64(block.GlobalTimecode()) - int64(ParentBlock->GlobalTimecode())) / int64(ParentBlock->GlobalTimecodeScale());
+ *static_cast<EbmlSInteger*>(this) = (static_cast<int64>(block.GlobalTimecode()) - static_cast<int64>(ParentBlock->GlobalTimecode())) / static_cast<int64>(ParentBlock->GlobalTimecodeScale());
}
return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender);
}
}
// force creation of a new block
- if (currentNewBlock == nullptr || uint32(track.TrackNumber()) != uint32(currentNewBlock->TrackNumber()) || PastBlock != nullptr || ForwBlock != nullptr) {
+ if (currentNewBlock == nullptr || static_cast<uint32>(track.TrackNumber()) != static_cast<uint32>(currentNewBlock->TrackNumber()) || PastBlock != nullptr || ForwBlock != nullptr) {
KaxBlockGroup & aNewBlock = GetNewBlock();
MyNewBlock = currentNewBlock = &aNewBlock;
}
// new school, using KaxBlockBlob
for (Index = 0; Index<Blobs.size(); Index++) {
if (Blobs[Index]->IsSimpleBlock())
- PushElement( (KaxSimpleBlock&) *Blobs[Index] );
+ PushElement( static_cast<KaxSimpleBlock&>(*Blobs[Index]));
else
- PushElement( (KaxBlockGroup&) *Blobs[Index] );
+ PushElement( static_cast<KaxBlockGroup&>(*Blobs[Index]));
}
// SilentTracks handling
KaxTrackEntry & entry = *static_cast<KaxTrackEntry *>(Trk);
auto tracknum = static_cast<uint32>(entry.TrackNumber());
for (Index = 0; Index<Blobs.size(); Index++) {
- if (((KaxInternalBlock&)*Blobs[Index]).TrackNum() == tracknum)
+ if (static_cast<KaxInternalBlock&>(*Blobs[Index]).TrackNum() == tracknum)
break; // this track is used
}
// the track wasn't found in this cluster
*/
int16 KaxCluster::GetBlockLocalTimecode(uint64 aGlobalTimecode) const
{
- int64 TimecodeDelay = (int64(aGlobalTimecode) - int64(GlobalTimecode())) / int64(GlobalTimecodeScale());
+ int64 TimecodeDelay = (static_cast<int64>(aGlobalTimecode) - static_cast<int64>(GlobalTimecode())) / static_cast<int64>(GlobalTimecodeScale());
assert(TimecodeDelay >= int16(0x8000) && TimecodeDelay <= int16(0x7FFF));
- return int16(TimecodeDelay);
+ return static_cast<int16>(TimecodeDelay);
}
uint64 KaxCluster::GetBlockGlobalTimecode(int16 LocalTimecode)
if (!bFirstFrameInside) {
auto Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
assert (bFirstFrameInside); // use the InitTimecode() hack for now
- MinTimecode = MaxTimecode = PreviousTimecode = *static_cast<EbmlUInteger *>(Timecode);
+ MinTimecode = MaxTimecode = PreviousTimecode = static_cast<uint64>(*static_cast<EbmlUInteger *>(Timecode));
bFirstFrameInside = true;
bPreviousTimecodeIsSet = true;
}
- return int64(LocalTimecode * GlobalTimecodeScale()) + GlobalTimecode();
+ return static_cast<int64>(LocalTimecode * GlobalTimecodeScale()) + GlobalTimecode();
}
KaxBlockGroup & KaxCluster::GetNewBlock()
// check the tile
auto aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
if (aTime != nullptr) {
- auto _Time = uint64(*aTime);
+ auto _Time = static_cast<uint64>(*aTime);
if (_Time > aPrevTime && _Time < TimecodeToLocate) {
aPrevTime = _Time;
aPointPrev = tmp;
auto aTime = static_cast<const KaxCueTime *>(FindFirstElt(EBML_INFO(KaxCueTime)));
if (aTime == nullptr)
return false;
- aTimecode = uint64(*aTime) * GlobalTimecodeScale;
+ aTimecode = static_cast<uint64>(*aTime) * GlobalTimecodeScale;
return true;
}
auto aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
while (aPoss != nullptr) {
auto aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
- if (aPos != nullptr && uint64(*aPos) < aPosition) {
- aPosition = uint64(*aPos);
+ if (aPos != nullptr && static_cast<uint64>(*aPos) < aPosition) {
+ aPosition = static_cast<uint64>(*aPos);
result = aPoss;
}
if (aPos == nullptr)
return 0;
- return uint64(*aPos);
+ return static_cast<uint64>(*aPos);
}
uint16 KaxCueTrackPositions::TrackNumber() const
if (aTrack == nullptr)
return 0;
- return uint16(*aTrack);
+ return static_cast<uint16>(*aTrack);
}
auto & aNewID = GetChild<KaxSeekID>(aNewPoint);
binary ID[4];
- ((const EbmlId&)aElt).Fill(ID);
+ static_cast<const EbmlId&>(aElt).Fill(ID);
aNewID.CopyBuffer(ID, EBML_ID_LENGTH((const EbmlId&)aElt));
return &aNewPoint;
++Itr;
for (; Itr != end(); ++Itr) {
if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek)) {
- tmp = (KaxSeek *)(*Itr);
+ tmp = static_cast<KaxSeek *>(*Itr);
if (tmp->IsEbmlId(aPrev))
return tmp;
}
auto aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition)));
if (aPos == nullptr)
return 0;
- return uint64(*aPos);
+ return static_cast<uint64>(*aPos);
}
bool KaxSeek::IsEbmlId(const EbmlId & aId) const