Pointers are already used.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
uint64 KaxBlockGroup::GlobalTimecode() const
{
assert(ParentCluster != nullptr); // impossible otherwise
- const auto& MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
- return MyBlock.GlobalTimecode();
-
+ auto MyBlock = static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
+ return MyBlock->GlobalTimecode();
}
uint16 KaxBlockGroup::TrackNumber() const
{
- const auto& MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
- return MyBlock.TrackNum();
+ auto MyBlock = static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
+ return MyBlock->TrackNum();
}
uint64 KaxBlockGroup::ClusterPosition() const
void KaxBlockGroup::ReleaseFrames()
{
- auto& MyBlock = *static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
- MyBlock.ReleaseFrames();
+ auto MyBlock = static_cast<KaxBlock *>(this->FindElt(EBML_INFO(KaxBlock)));
+ MyBlock->ReleaseFrames();
}
void KaxInternalBlock::ReleaseFrames()
{
assert(ParentTrack != nullptr);
const int64 scale = ParentTrack->GlobalTimecodeScale();
- auto& myDuration = *static_cast<KaxBlockDuration *>(FindFirstElt(EBML_INFO(KaxBlockDuration), true));
- *(static_cast<EbmlUInteger *>(&myDuration)) = TimeLength / static_cast<uint64>(scale);
+ const auto& myDuration = static_cast<KaxBlockDuration *>(FindFirstElt(EBML_INFO(KaxBlockDuration), true));
+ *(static_cast<EbmlUInteger *>(myDuration)) = TimeLength / static_cast<uint64>(scale);
}
bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const
// SilentTracks handling
// check the parent cluster for existing tracks and see if they are contained in this cluster or not
if (bSilentTracksUsed) {
- const auto& MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
- for (auto&& Trk : MyTracks) {
+ auto MyTracks = static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
+ for (auto&& Trk : *MyTracks) {
if (EbmlId(*Trk) == EBML_ID(KaxTrackEntry)) {
- const auto& entry = *static_cast<KaxTrackEntry *>(Trk);
- auto tracknum = static_cast<uint32>(entry.TrackNumber());
+ auto entry = static_cast<KaxTrackEntry *>(Trk);
+ auto tracknum = static_cast<uint32>(entry->TrackNumber());
auto track = std::find_if(ElementList.begin(), ElementList.end(), [=](EbmlElement *element)
{ return EbmlId(*element) == EBML_ID(KaxBlockGroup) && static_cast<KaxBlockGroup *>(element)->TrackNumber() == tracknum; });
// the track wasn't found in this cluster
// SilentTracks handling
// check the parent cluster for existing tracks and see if they are contained in this cluster or not
if (bSilentTracksUsed) {
- const auto& MyTracks = *static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
- for (auto&& Trk : MyTracks) {
+ auto MyTracks = static_cast<KaxTracks *>(ParentSegment->FindElt(EBML_INFO(KaxTracks)));
+ for (auto&& Trk : *MyTracks) {
if (EbmlId(*Trk) == EBML_ID(KaxTrackEntry)) {
- const auto& entry = *static_cast<KaxTrackEntry *>(Trk);
- auto tracknum = static_cast<uint32>(entry.TrackNumber());
+ auto entry = static_cast<KaxTrackEntry *>(Trk);
+ auto tracknum = static_cast<uint32>(entry->TrackNumber());
for (Index = 0; Index<Blobs.size(); Index++) {
if (static_cast<KaxInternalBlock&>(*Blobs[Index]).TrackNum() == tracknum)
break; // this track is used
assert(EbmlId(*this) == EBML_ID(KaxCuePoint));
assert(EbmlId(*Cmp) == EBML_ID(KaxCuePoint));
- const auto& theCmp = *static_cast<const KaxCuePoint *>(Cmp);
+ auto theCmp = static_cast<const KaxCuePoint *>(Cmp);
// compare timecode
auto TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime)));
if (TimeCodeA == nullptr)
return false;
- auto TimeCodeB = static_cast<const KaxCueTime *>(theCmp.FindElt(EBML_INFO(KaxCueTime)));
+ auto TimeCodeB = static_cast<const KaxCueTime *>(theCmp->FindElt(EBML_INFO(KaxCueTime)));
if (TimeCodeB == nullptr)
return false;
if (TrackA == nullptr)
return false;
- auto TrackB = static_cast<const KaxCueTrack *>(theCmp.FindElt(EBML_INFO(KaxCueTrack)));
+ auto TrackB = static_cast<const KaxCueTrack *>(theCmp->FindElt(EBML_INFO(KaxCueTrack)));
if (TrackB == nullptr)
return false;