From 2e960b9b6321f23c135708582fcf4115f9c635a0 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 19 Dec 2014 15:07:32 +0100 Subject: [PATCH] cosmetics: unify indentation --- src/FileKax.cpp | 458 +++++++++++++++++++---------------------- src/KaxAttached.cpp | 2 +- src/KaxAttachments.cpp | 2 +- src/KaxBlock.cpp | 430 ++++++++++++++++++-------------------- src/KaxBlockData.cpp | 38 ++-- src/KaxCluster.cpp | 53 ++--- src/KaxCues.cpp | 17 +- src/KaxCuesData.cpp | 12 +- src/KaxInfoData.cpp | 6 +- src/KaxSeekHead.cpp | 27 +-- src/KaxSegment.cpp | 7 +- 11 files changed, 485 insertions(+), 567 deletions(-) diff --git a/src/FileKax.cpp b/src/FileKax.cpp index 91cae1e..5f88d4f 100644 --- a/src/FileKax.cpp +++ b/src/FileKax.cpp @@ -47,404 +47,370 @@ START_LIBMATROSKA_NAMESPACE //typedef Track *TrackID; FileMatroska::FileMatroska(IOCallback & output) - :myFile(output) + :myFile(output) #ifdef OLD - ,myCurrReadBlock(NULL) - ,myMinClusterSize(5*1024) // 5KB is the min size of a cluster - ,myMaxClusterSize(2*1024*1024) // 2MB is the max size of a cluster - ,myCurrReadBlockTrack(0) - ,myCurrWriteCluster(2*1024*1024) // myMaxClusterSize - ,myCurrReadCluster(NULL) - ,myReadBlockNumber(0) + ,myCurrReadBlock(NULL) + ,myMinClusterSize(5*1024) // 5KB is the min size of a cluster + ,myMaxClusterSize(2*1024*1024) // 2MB is the max size of a cluster + ,myCurrReadBlockTrack(0) + ,myCurrWriteCluster(2*1024*1024) // myMaxClusterSize + ,myCurrReadCluster(NULL) + ,myReadBlockNumber(0) #endif // OLD { #ifdef OLD - myStreamInfo.MainHeaderSize = TypeHeader::default_size() + + myStreamInfo.MainHeaderSize = TypeHeader::default_size() + ActualHeader::default_size() + ExtendedInfo::default_size() + ContentInfo::default_size(); - myStreamInfo.TrackEntrySize = Track::default_size(); - myStreamInfo.BlockHeadSize = BLOCK_HEADER_SIZE; - myStreamInfo.ClusterHeadSize = CLUSTER_HEADER_SIZE; - myStreamInfo.ClusterFootSize = CLUSTER_TRAILER_SIZE; + myStreamInfo.TrackEntrySize = Track::default_size(); + myStreamInfo.BlockHeadSize = BLOCK_HEADER_SIZE; + myStreamInfo.ClusterHeadSize = CLUSTER_HEADER_SIZE; + myStreamInfo.ClusterFootSize = CLUSTER_TRAILER_SIZE; #endif // OLD } FileMatroska::~FileMatroska() { -// if (myCurrCluster != NULL) -// throw 0; // there are some data left to write -// if (myCurrReadCluster != NULL || myCurrReadBlock != NULL) -// throw 0; // there are some data left to write + // if (myCurrCluster != NULL) + // throw 0; // there are some data left to write + // if (myCurrReadCluster != NULL || myCurrReadBlock != NULL) + // throw 0; // there are some data left to write } #ifdef OLD void FileMatroska::SetMaxClusterSize(const uint32 value) { - myMaxClusterSize = value; - myCurrWriteCluster.setMaxSize(value); + myMaxClusterSize = value; + myCurrWriteCluster.setMaxSize(value); } void FileMatroska::Close(const uint32 aTimeLength) { - Flush(); + Flush(); - // get the file size - myFile.setFilePointer(0,seek_end); - myMainHeader.type_SetSize(myFile.getFilePointer()); + // get the file size + myFile.setFilePointer(0,seek_end); + myMainHeader.type_SetSize(myFile.getFilePointer()); - // rewrite the header at the beginning - myFile.setFilePointer(0,seek_beginning); + // rewrite the header at the beginning + myFile.setFilePointer(0,seek_beginning); - // get the Track-entry size - uint32 track_entries_size = 0; - for (size_t i=0; idefault_size(); - } + // get the Track-entry size + uint32 track_entries_size = 0; + for (size_t i=0; idefault_size(); + } - myStreamInfo.TrackEntriesSize = track_entries_size; - myStreamInfo.TimeLength = aTimeLength; - myMainHeader.Render(myFile, myStreamInfo); + myStreamInfo.TrackEntriesSize = track_entries_size; + myStreamInfo.TimeLength = aTimeLength; + myMainHeader.Render(myFile, myStreamInfo); - for (i=0; idefault_size(); - } + } - std::string aStr = LIB_NAME; - aStr += " "; - aStr += VERSION; - myStreamInfo.EncoderLib = aStr; + std::string aStr = LIB_NAME; + aStr += " "; + aStr += VERSION; + myStreamInfo.EncoderLib = aStr; - myStreamInfo.EncoderApp = aEncoderApp; + myStreamInfo.EncoderApp = aEncoderApp; - myStreamInfo.TrackEntryPosition = 0 + myStreamInfo.MainHeaderSize; - myStreamInfo.TrackEntriesSize = myTracks.size() * myStreamInfo.TrackEntrySize; + myStreamInfo.TrackEntryPosition = 0 + myStreamInfo.MainHeaderSize; + myStreamInfo.TrackEntriesSize = myTracks.size() * myStreamInfo.TrackEntrySize; - myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize; - myStreamInfo.CodecEntrySize = 4; - for (i=0; iCodecSize(); - } + } - // Main Header - filepos_t result = myMainHeader.Render(myFile, myStreamInfo); + // Main Header + filepos_t result = myMainHeader.Render(myFile, myStreamInfo); - // Track Entries - for (i=0; iRenderEntry(myFile, i+1); - } - myStreamInfo.ClusterPosition = myStreamInfo.CodecEntryPosition + myStreamInfo.CodecEntrySize; + } + myStreamInfo.ClusterPosition = myStreamInfo.CodecEntryPosition + myStreamInfo.CodecEntrySize; - // Codec Header - result = CodecHeader::Render(myFile, myTracks); + // Codec Header + result = CodecHeader::Render(myFile, myTracks); - return result; - } - catch (exception & Ex) - { - throw Ex; - } + return result; + } + catch (exception & Ex) { + throw Ex; + } } /*! - \return 0 if the track was not created, or a valid track number + \return 0 if the track was not created, or a valid track number */ Track * FileMatroska::CreateTrack(const track_type aType) { - myTracks.push_back(new Track(aType)); - return myTracks.back(); + myTracks.push_back(new Track(aType)); + return myTracks.back(); } -/*Track *FileMatroska::findTrack(Track * aTrack) const -{ - for (size_t i=0; iSetName(aName); - } + if (IsMyTrack(aTrack)) { + aTrack->SetName(aName); + } } void FileMatroska::track_SetLaced(Track * aTrack, bool bLaced) { - if (IsMyTrack(aTrack)) - { - aTrack->SetLaced(bLaced); - } + if (IsMyTrack(aTrack)) { + aTrack->SetLaced(bLaced); + } } bool FileMatroska::AddFrame(Track * aTrack, const uint32 aTimecode, const binary *aFrame, const uint32 aFrameSize, - bool aKeyFrame, bool aBFrame) + bool aKeyFrame, bool aBFrame) { - try { - // make sure we know that track - if (IsMyTrack(aTrack)) - { + try { + // make sure we know that track + if (IsMyTrack(aTrack)) { // pass the cluster to the track // handle the creation of a new cluster if needed - if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame)) - { - while (!aTrack->SerialiseBlock(myCurrWriteCluster)) - { - /// \todo handle errors - uint32 aNbBlock; - myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock); - myStreamInfo.NumberBlock += aNbBlock; - myCurrWriteCluster.Flush(); - } + if (aTrack->AddFrame(aTimecode, aFrame, aFrameSize, aKeyFrame, aBFrame)) { + while (!aTrack->SerialiseBlock(myCurrWriteCluster)) { + /// \todo handle errors + uint32 aNbBlock; + myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile, aNbBlock); + myStreamInfo.NumberBlock += aNbBlock; + myCurrWriteCluster.Flush(); + } } - return true; - } - return false; - } - catch (exception & Ex) - { - throw Ex; + return true; } + return false; + } + catch (exception & Ex) { + throw Ex; + } } void FileMatroska::Flush() { - uint32 aNbBlock; - myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile,aNbBlock); - myStreamInfo.NumberBlock += aNbBlock; + uint32 aNbBlock; + myStreamInfo.ClusterSize += myCurrWriteCluster.Render(myFile,aNbBlock); + myStreamInfo.NumberBlock += aNbBlock; } uint32 FileMatroska::ReadHead() { - try { - uint32 result = myMainHeader.Read(myFile, myStreamInfo); + try { + uint32 result = myMainHeader.Read(myFile, myStreamInfo); - return result; - } - catch (exception & Ex) - { - throw Ex; - } + return result; + } + catch (exception & Ex) { + throw Ex; + } } uint32 FileMatroska::ReadTracks() { - try { - uint32 result = 0; - - // seek to the start of the Track Entries - myFile.setFilePointer(myStreamInfo.TrackEntryPosition); - // get the number of Track Entries - uint8 TrackNumber = myStreamInfo.TrackEntriesSize / myStreamInfo.TrackEntrySize; - // read all the Track Entries - myTracks.clear(); - for (uint8 TrackIdx = 0; TrackIdx::const_iterator i = myTracks.begin(); i != myTracks.end(); i ++) - { - if (*i == aTrack) + for (std::vector::const_iterator i = myTracks.begin(); i != myTracks.end(); i ++) { + if (*i == aTrack) break; - } + } - if (i != myTracks.end()) - return true; - else - return false; + if (i != myTracks.end()) + return true; + else + return false; } void FileMatroska::SelectReadingTrack(Track * aTrack, bool select) { - if (IsMyTrack(aTrack)) - { - // here we have the right track - // check if it's not already selected - for (std::vector::iterator j = mySelectedTracks.begin(); - j != mySelectedTracks.end(); j ++) - { + if (IsMyTrack(aTrack)) { + // here we have the right track + // check if it's not already selected + for (std::vector::iterator j = mySelectedTracks.begin(); j != mySelectedTracks.end(); j ++) { if (*j == aTrack->TrackNumber()) - break; - } + break; + } - if (select && j == mySelectedTracks.end()) + if (select && j == mySelectedTracks.end()) mySelectedTracks.push_back(aTrack->TrackNumber()); - else if (!select && j != mySelectedTracks.end()) + else if (!select && j != mySelectedTracks.end()) mySelectedTracks.erase(j); - std::sort(mySelectedTracks.begin(), mySelectedTracks.end()); - } + std::sort(mySelectedTracks.begin(), mySelectedTracks.end()); + } } inline bool FileMatroska::IsReadingTrack(const uint8 aTrackNumber) const { - for (std::vector::const_iterator trackIdx = mySelectedTracks.begin(); - trackIdx != mySelectedTracks.end() && *trackIdx < aTrackNumber; - trackIdx++) - {} - - if (trackIdx == mySelectedTracks.end()) - return false; - else - return true; + for (std::vector::const_iterator trackIdx = mySelectedTracks.begin(); + trackIdx != mySelectedTracks.end() && *trackIdx < aTrackNumber; + trackIdx++) {} + + if (trackIdx == mySelectedTracks.end()) + return false; + else + return true; } // void FileMatroska::Track_GetInfo(const Track * aTrack, TrackInfo & aTrackInfo) const { - if (IsMyTrack(aTrack)) - { - aTrack->GetInfo(aTrackInfo); - } + if (IsMyTrack(aTrack)) { + aTrack->GetInfo(aTrackInfo); + } } // Audio related getters/setters void FileMatroska::Track_GetInfo_Audio(const Track * aTrack, TrackInfoAudio & aTrackInfo) const { - if (IsMyTrack(aTrack)) - { - aTrack->GetInfoAudio(aTrackInfo); - } + if (IsMyTrack(aTrack)) { + aTrack->GetInfoAudio(aTrackInfo); + } } void FileMatroska::Track_SetInfo_Audio(Track * aTrack, const TrackInfoAudio & aTrackInfo) { - if (IsMyTrack(aTrack)) - { - aTrack->SetInfoAudio(aTrackInfo); - } + if (IsMyTrack(aTrack)) { + aTrack->SetInfoAudio(aTrackInfo); + } } // Video related getters/setters void FileMatroska::Track_GetInfo_Video(const Track * aTrack, TrackInfoVideo & aTrackInfo) const { - if (IsMyTrack(aTrack)) - { - aTrack->GetInfoVideo(aTrackInfo); - } + if (IsMyTrack(aTrack)) { + aTrack->GetInfoVideo(aTrackInfo); + } } void FileMatroska::Track_SetInfo_Video(Track * aTrack, const TrackInfoVideo & aTrackInfo) { - if (IsMyTrack(aTrack)) - { - aTrack->SetInfoVideo(aTrackInfo); - } + if (IsMyTrack(aTrack)) { + aTrack->SetInfoVideo(aTrackInfo); + } } /*! - \todo exit when there is no Block left + \todo exit when there is no Block left */ bool FileMatroska::ReadFrame(Track * & aTrack, uint32 & aTimecode, const binary * & aFrame, uint32 & aFrameSize, - bool & aKeyFrame, bool & aBFrame) + bool & aKeyFrame, bool & aBFrame) { - if (myCurrReadBlockTrack == 0) - { - do { - if (myReadBlockNumber >= myStreamInfo.NumberBlock) - { -// myReadBlockNumber = myStreamInfo.NumberBlock; - return false; + if (myCurrReadBlockTrack == 0) { + do { + if (myReadBlockNumber >= myStreamInfo.NumberBlock) { + // myReadBlockNumber = myStreamInfo.NumberBlock; + return false; } // get the next frame in the file - if (!myCurrReadCluster.BlockLeft()) - { - myCurrReadCluster.Flush(); - try { - myCurrReadCluster.FindHead(myFile); - } - catch (exception & Ex) - { - return false; - } + if (!myCurrReadCluster.BlockLeft()) { + myCurrReadCluster.Flush(); + try { + myCurrReadCluster.FindHead(myFile); + } + catch (exception & Ex) { + return false; + } } myCurrReadCluster.GetBlock( myCurrReadBlock, myCurrReadBlockSize, myCurrReadBlockTrack ); myReadBlockNumber++; - } while (!IsReadingTrack(myCurrReadBlockTrack)); - - // get the track associated (normally from myTracks) - aTrack = myTracks[myCurrReadBlockTrack-1]; - // get the next frame from the current block - aTrack->HandleBlock(myCurrReadBlock, myCurrReadBlockSize); - } - else - { - // get the track associated (normally from myTracks) - aTrack = myTracks[myCurrReadBlockTrack-1]; - } + } while (!IsReadingTrack(myCurrReadBlockTrack)); + + // get the track associated (normally from myTracks) + aTrack = myTracks[myCurrReadBlockTrack-1]; + // get the next frame from the current block + aTrack->HandleBlock(myCurrReadBlock, myCurrReadBlockSize); + } else { + // get the track associated (normally from myTracks) + aTrack = myTracks[myCurrReadBlockTrack-1]; + } - Frame * myReadFrame; - aTrack->GetNextFrame(aTimecode, myReadFrame, aKeyFrame, aBFrame); - aFrame = myReadFrame->buf(); - aFrameSize = myReadFrame->length(); + Frame * myReadFrame; + aTrack->GetNextFrame(aTimecode, myReadFrame, aKeyFrame, aBFrame); + aFrame = myReadFrame->buf(); + aFrameSize = myReadFrame->length(); - if (aTrack->NoFrameLeft()) - { - aTrack->FlushBlock(); - myCurrReadBlockTrack = 0; - } + if (aTrack->NoFrameLeft()) { + aTrack->FlushBlock(); + myCurrReadBlockTrack = 0; + } - return true; + return true; } #endif // OLD @@ -453,13 +419,13 @@ END_LIBMATROSKA_NAMESPACE void matroska_init() { #if defined(HAVE_EBML2) || defined(HAS_EBML2) - ebml_init(); + ebml_init(); #endif } void matroska_done() { #if defined(HAVE_EBML2) || defined(HAS_EBML2) - ebml_done(); + ebml_done(); #endif } diff --git a/src/KaxAttached.cpp b/src/KaxAttached.cpp index cef09a1..44f8584 100644 --- a/src/KaxAttached.cpp +++ b/src/KaxAttached.cpp @@ -43,7 +43,7 @@ using namespace LIBEBML_NAMESPACE; START_LIBMATROSKA_NAMESPACE KaxAttached::KaxAttached(EBML_EXTRA_DEF) - :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached) EBML_DEF_SEP EBML_EXTRA_CALL) + :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttached) EBML_DEF_SEP EBML_EXTRA_CALL) { SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko) } diff --git a/src/KaxAttachments.cpp b/src/KaxAttachments.cpp index 4f34565..3504520 100644 --- a/src/KaxAttachments.cpp +++ b/src/KaxAttachments.cpp @@ -42,7 +42,7 @@ using namespace LIBEBML_NAMESPACE; START_LIBMATROSKA_NAMESPACE KaxAttachments::KaxAttachments(EBML_EXTRA_DEF) - :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttachments) EBML_DEF_SEP EBML_EXTRA_CALL) + :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxAttachments) EBML_DEF_SEP EBML_EXTRA_CALL) { SetSizeLength(2); // mandatory min size support (for easier updating) (2^(7*2)-2 = 16Ko) } diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 95407b0..fe0c22b 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -55,7 +55,7 @@ DataBuffer * DataBuffer::Clone() } SimpleDataBuffer::SimpleDataBuffer(const SimpleDataBuffer & ToClone) - :DataBuffer((binary *)malloc(ToClone.mySize * sizeof(binary)), ToClone.mySize, myFreeBuffer) + :DataBuffer((binary *)malloc(ToClone.mySize * sizeof(binary)), ToClone.mySize, myFreeBuffer) { assert(myBuffer != NULL); memcpy(myBuffer, ToClone.myBuffer ,mySize ); @@ -73,19 +73,18 @@ KaxInternalBlock::~KaxInternalBlock() } KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone) - :EbmlBinary(ElementToClone) - ,myBuffers(ElementToClone.myBuffers.size()) - ,Timecode(ElementToClone.Timecode) - ,LocalTimecode(ElementToClone.LocalTimecode) - ,bLocalTimecodeUsed(ElementToClone.bLocalTimecodeUsed) - ,TrackNumber(ElementToClone.TrackNumber) - ,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly + :EbmlBinary(ElementToClone) + ,myBuffers(ElementToClone.myBuffers.size()) + ,Timecode(ElementToClone.Timecode) + ,LocalTimecode(ElementToClone.LocalTimecode) + ,bLocalTimecodeUsed(ElementToClone.bLocalTimecodeUsed) + ,TrackNumber(ElementToClone.TrackNumber) + ,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly { // add a clone of the list std::vector::const_iterator Itr = ElementToClone.myBuffers.begin(); std::vector::iterator myItr = myBuffers.begin(); - while (Itr != ElementToClone.myBuffers.end()) - { + while (Itr != ElementToClone.myBuffers.end()) { *myItr = (*Itr)->Clone(); Itr++; myItr++; } @@ -94,13 +93,13 @@ KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone) KaxBlockGroup::~KaxBlockGroup() { -//NOTE("KaxBlockGroup::~KaxBlockGroup"); + //NOTE("KaxBlockGroup::~KaxBlockGroup"); } KaxBlockGroup::KaxBlockGroup(EBML_EXTRA_DEF) - :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxBlockGroup) EBML_DEF_SEP EBML_EXTRA_CALL) - ,ParentCluster(NULL) - ,ParentTrack(NULL) + :EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxBlockGroup) EBML_DEF_SEP EBML_EXTRA_CALL) + ,ParentCluster(NULL) + ,ParentTrack(NULL) {} /*! @@ -134,7 +133,7 @@ bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, Da } /*! - \return Returns the lacing type that produces the smallest footprint. + \return Returns the lacing type that produces the smallest footprint. */ LacingType KaxInternalBlock::GetBestLacingType() const { int XiphLacingSize, EbmlLacingSize, i; @@ -164,7 +163,7 @@ LacingType KaxInternalBlock::GetBestLacingType() const { filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */) { LacingType LacingHere; - assert(EbmlBinary::GetBuffer() == NULL); // Data is not used for KaxInternalBlock + assert(EbmlBinary::GetBuffer() == NULL); // Data is not used for KaxInternalBlock assert(TrackNumber < 0x4000); // no more allowed for the moment unsigned int i; @@ -182,27 +181,26 @@ filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRe LacingHere = GetBestLacingType(); else LacingHere = mLacing; - switch (LacingHere) - { - case LACING_XIPH: - for (i=0; iSize() + (myBuffers[i]->Size() / 0xFF + 1)); - } - break; - case LACING_EBML: - SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize())); - for (i=1; iSize() + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0)); - } - break; - case LACING_FIXED: - for (i=0; iSize()); - } - break; - default: - i = 0; - assert(0); + switch (LacingHere) { + case LACING_XIPH: + for (i=0; iSize() + (myBuffers[i]->Size() / 0xFF + 1)); + } + break; + case LACING_EBML: + SetSize_(GetSize() + myBuffers[0]->Size() + CodedSizeLength(myBuffers[0]->Size(), 0, IsFiniteSize())); + for (i=1; iSize() + CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i-1]->Size()), 0)); + } + break; + case LACING_FIXED: + for (i=0; iSize()); + } + break; + default: + i = 0; + assert(0); } // Size of the last frame (not in lace) SetSize_(GetSize() + myBuffers[i]->Size()); @@ -217,26 +215,26 @@ filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRe #if MATROSKA_VERSION >= 2 KaxBlockVirtual::KaxBlockVirtual(const KaxBlockVirtual & ElementToClone) - :EbmlBinary(ElementToClone) - ,Timecode(ElementToClone.Timecode) - ,TrackNumber(ElementToClone.TrackNumber) - ,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly + :EbmlBinary(ElementToClone) + ,Timecode(ElementToClone.Timecode) + ,TrackNumber(ElementToClone.TrackNumber) + ,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly { - SetBuffer(DataBlock,sizeof(DataBlock)); - SetValueIsSet(false); + SetBuffer(DataBlock,sizeof(DataBlock)); + SetValueIsSet(false); } KaxBlockVirtual::KaxBlockVirtual(EBML_EXTRA_DEF) -:EBML_DEF_BINARY(KaxBlockVirtual)EBML_DEF_SEP ParentCluster(NULL) + :EBML_DEF_BINARY(KaxBlockVirtual)EBML_DEF_SEP ParentCluster(NULL) { - SetBuffer(DataBlock,sizeof(DataBlock)); - SetValueIsSet(false); + SetBuffer(DataBlock,sizeof(DataBlock)); + SetValueIsSet(false); } KaxBlockVirtual::~KaxBlockVirtual() { - if(GetBuffer() == DataBlock) - SetBuffer( NULL, 0 ); + if(GetBuffer() == DataBlock) + SetBuffer( NULL, 0 ); } filepos_t KaxBlockVirtual::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */) @@ -245,10 +243,10 @@ filepos_t KaxBlockVirtual::UpdateSize(bool /* bSaveDefault */, bool /* bForceRen binary *cursor = EbmlBinary::GetBuffer(); // fill data if (TrackNumber < 0x80) { - assert(GetSize() >= 4); + assert(GetSize() >= 4); *cursor++ = TrackNumber | 0x80; // set the first bit to 1 } else { - assert(GetSize() >= 5); + assert(GetSize() >= 5); *cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1 *cursor++ = TrackNumber & 0xFF; } @@ -321,85 +319,82 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender } // lacing flag - switch (mLacing) - { - case LACING_XIPH: - *cursor++ |= 0x02; - break; - case LACING_EBML: - *cursor++ |= 0x06; - break; - case LACING_FIXED: - *cursor++ |= 0x04; - break; - case LACING_NONE: - break; + switch (mLacing) { + case LACING_XIPH: + *cursor++ |= 0x02; + break; + case LACING_EBML: + *cursor++ |= 0x06; + break; + case LACING_FIXED: + *cursor++ |= 0x04; + break; + case LACING_NONE: + break; default: - assert(0); + assert(0); } output.writeFully(BlockHead, 4 + ((TrackNumber > 0x80) ? 1 : 0)); binary tmpValue; - switch (mLacing) - { - case LACING_XIPH: - // number of laces - tmpValue = myBuffers.size()-1; - output.writeFully(&tmpValue, 1); - - // set the size of each member in the lace - for (i=0; iSize(); - while (tmpSize >= 0xFF) { + switch (mLacing) { + case LACING_XIPH: + // number of laces + tmpValue = myBuffers.size()-1; + output.writeFully(&tmpValue, 1); + + // set the size of each member in the lace + for (i=0; iSize(); + while (tmpSize >= 0xFF) { + output.writeFully(&tmpValue, 1); + SetSize_(GetSize() + 1); + tmpSize -= 0xFF; + } + tmpValue = binary(tmpSize); output.writeFully(&tmpValue, 1); SetSize_(GetSize() + 1); - tmpSize -= 0xFF; } - tmpValue = binary(tmpSize); + break; + case LACING_EBML: + // number of laces + tmpValue = myBuffers.size()-1; output.writeFully(&tmpValue, 1); - SetSize_(GetSize() + 1); - } - break; - case LACING_EBML: - // number of laces - tmpValue = myBuffers.size()-1; - output.writeFully(&tmpValue, 1); + { + int64 _Size; + int _CodedSize; + binary _FinalHead[8]; // 64 bits max coded size - { - int64 _Size; - int _CodedSize; - binary _FinalHead[8]; // 64 bits max coded size + _Size = myBuffers[0]->Size(); - _Size = myBuffers[0]->Size(); + _CodedSize = CodedSizeLength(_Size, 0, IsFiniteSize()); - _CodedSize = CodedSizeLength(_Size, 0, IsFiniteSize()); - - // first size in the lace is not a signed - CodedValueLength(_Size, _CodedSize, _FinalHead); - output.writeFully(_FinalHead, _CodedSize); - SetSize_(GetSize() + _CodedSize); - - // set the size of each member in the lace - for (i=1; iSize()) - int64(myBuffers[i-1]->Size()); - _CodedSize = CodedSizeLengthSigned(_Size, 0); - CodedValueLengthSigned(_Size, _CodedSize, _FinalHead); + // first size in the lace is not a signed + CodedValueLength(_Size, _CodedSize, _FinalHead); output.writeFully(_FinalHead, _CodedSize); SetSize_(GetSize() + _CodedSize); + + // set the size of each member in the lace + for (i=1; iSize()) - int64(myBuffers[i-1]->Size()); + _CodedSize = CodedSizeLengthSigned(_Size, 0); + CodedValueLengthSigned(_Size, _CodedSize, _FinalHead); + output.writeFully(_FinalHead, _CodedSize); + SetSize_(GetSize() + _CodedSize); + } } - } - break; - case LACING_FIXED: - // number of laces - tmpValue = myBuffers.size()-1; - output.writeFully(&tmpValue, 1); - break; - case LACING_NONE: - break; + break; + case LACING_FIXED: + // number of laces + tmpValue = myBuffers.size()-1; + output.writeFully(&tmpValue, 1); + break; + case LACING_NONE: + break; default: - assert(0); + assert(0); } // put the data of each frame @@ -454,10 +449,9 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) FirstFrameLocation = input.getFilePointer(); // will be updated accordingly below - if (ReadFully == SCOPE_ALL_DATA) - { + if (ReadFully == SCOPE_ALL_DATA) { Result = EbmlBinary::ReadData(input, ReadFully); - binary *cursor = EbmlBinary::GetBuffer(); + binary *cursor = EbmlBinary::GetBuffer(); uint8 BlockHeadSize = 4; // update internal values @@ -507,47 +501,46 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) SizeList.resize(FrameNum + 1); - switch (mLacing) - { - case LACING_XIPH: - for (Index=0; Index> 3; mLacing = LacingType((*cursor++ & 0x06) >> 1); - if (cursor == &_TempHead[4]) - { + if (cursor == &_TempHead[4]) { _TempHead[0] = _TempHead[4]; } else { Result += input.read(_TempHead, 1); @@ -617,57 +608,56 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully) SizeList.resize(FrameNum + 1); - switch (mLacing) - { - case LACING_XIPH: - for (Index=0; Index(*this); assert(ParentCluster != NULL); @@ -711,9 +701,9 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing) { -// assert(past_timecode < 0); + // assert(past_timecode < 0); -// assert(forw_timecode > 0); + // assert(forw_timecode > 0); KaxBlock & theBlock = GetChild(*this); assert(ParentCluster != NULL); @@ -740,15 +730,13 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB ParentTrack = &track; bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing); - if (PastBlock != NULL) - { + if (PastBlock != NULL) { KaxReferenceBlock & thePastRef = GetChild(*this); thePastRef.SetReferencedBlock(PastBlock); thePastRef.SetParentBlock(*this); } - if (ForwBlock != NULL) - { + if (ForwBlock != NULL) { KaxReferenceBlock & theFutureRef = AddNewChild(*this); theFutureRef.SetReferencedBlock(ForwBlock); theFutureRef.SetParentBlock(*this); @@ -792,8 +780,7 @@ unsigned int KaxBlockGroup::ReferenceCount() const KaxReferenceBlock * MyBlockAdds = static_cast(FindFirstElt(EBML_INFO(KaxReferenceBlock))); if (MyBlockAdds != NULL) { Result++; - while ((MyBlockAdds = static_cast(FindNextElt(*MyBlockAdds))) != NULL) - { + while ((MyBlockAdds = static_cast(FindNextElt(*MyBlockAdds))) != NULL) { Result++; } } @@ -880,13 +867,11 @@ int64 KaxInternalBlock::GetDataPosition(size_t FrameNumber) { int64 _Result = -1; - if (ValueIsSet() && FrameNumber < SizeList.size()) - { + if (ValueIsSet() && FrameNumber < SizeList.size()) { _Result = FirstFrameLocation; size_t _Idx = 0; - while(FrameNumber--) - { + while(FrameNumber--) { _Result += SizeList[_Idx++]; } } @@ -898,8 +883,7 @@ int64 KaxInternalBlock::GetFrameSize(size_t FrameNumber) { int64 _Result = -1; - if (/*bValueIsSet &&*/ FrameNumber < SizeList.size()) - { + if (/*bValueIsSet &&*/ FrameNumber < SizeList.size()) { _Result = SizeList[FrameNumber]; } @@ -969,7 +953,7 @@ bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, Da } else { Block.simpleblock->SetKeyframe(false); if ((ForwBlock == NULL || ((const KaxInternalBlock &)*ForwBlock).GlobalTimecode() <= timecode) && - (PastBlock == NULL || ((const KaxInternalBlock &)*PastBlock).GlobalTimecode() <= timecode)) + (PastBlock == NULL || ((const KaxInternalBlock &)*PastBlock).GlobalTimecode() <= timecode)) Block.simpleblock->SetDiscardable(false); else Block.simpleblock->SetDiscardable(true); @@ -977,11 +961,8 @@ bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, Da } else #endif - { - if (ReplaceSimpleByGroup()) { + if (ReplaceSimpleByGroup()) bResult = Block.group->AddFrame(track, timecode, buffer, PastBlock, ForwBlock, lacing); - } - } return bResult; } @@ -1008,8 +989,7 @@ bool KaxBlockBlob::ReplaceSimpleByGroup() } } #if MATROSKA_VERSION >= 2 - else - { + else { if (Block.simpleblock != NULL) { KaxSimpleBlock *old_simpleblock = Block.simpleblock; @@ -1038,8 +1018,8 @@ void KaxBlockBlob::SetBlockGroup( KaxBlockGroup &BlockRef ) filepos_t KaxBlockVirtual::ReadData(IOCallback & input, ScopeMode /* ReadFully */) { - input.setFilePointer(SizePosition + CodedSizeLength(Size, SizeLength, bSizeIsFinite) + Size, seek_beginning); - return GetSize(); + input.setFilePointer(SizePosition + CodedSizeLength(Size, SizeLength, bSizeIsFinite) + Size, seek_beginning); + return GetSize(); } END_LIBMATROSKA_NAMESPACE diff --git a/src/KaxBlockData.cpp b/src/KaxBlockData.cpp index 1cb308a..9589713 100644 --- a/src/KaxBlockData.cpp +++ b/src/KaxBlockData.cpp @@ -49,34 +49,34 @@ const KaxBlockBlob & KaxReferenceBlock::RefBlock() const } KaxReferenceBlock::KaxReferenceBlock(EBML_EXTRA_DEF) -:EBML_DEF_SINTEGER(KaxReferenceBlock)EBML_DEF_SEP -RefdBlock(NULL) -,ParentBlock(NULL) -,bTimecodeSet(false) -,bOurBlob(false) + :EBML_DEF_SINTEGER(KaxReferenceBlock)EBML_DEF_SEP + RefdBlock(NULL) + ,ParentBlock(NULL) + ,bTimecodeSet(false) + ,bOurBlob(false) { - bTimecodeSet = false; + bTimecodeSet = false; } KaxReferenceBlock::KaxReferenceBlock(const KaxReferenceBlock & ElementToClone) -:EbmlSInteger(ElementToClone) -,RefdBlock(NULL) -,ParentBlock(NULL) -,bTimecodeSet(ElementToClone.bTimecodeSet) -,bOurBlob(false) + :EbmlSInteger(ElementToClone) + ,RefdBlock(NULL) + ,ParentBlock(NULL) + ,bTimecodeSet(ElementToClone.bTimecodeSet) + ,bOurBlob(false) { } KaxReferenceBlock::~KaxReferenceBlock() { - FreeBlob(); + FreeBlob(); } void KaxReferenceBlock::FreeBlob() { - if (bOurBlob && RefdBlock!=NULL) - delete RefdBlock; - RefdBlock = NULL; + if (bOurBlob && RefdBlock!=NULL) + delete RefdBlock; + RefdBlock = NULL; } filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender) @@ -95,19 +95,19 @@ void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock) { assert(RefdBlock == NULL); assert(aRefdBlock != NULL); - FreeBlob(); + FreeBlob(); RefdBlock = aRefdBlock; - bOurBlob = true; + bOurBlob = true; SetValueIsSet(); } void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock) { - FreeBlob(); + FreeBlob(); KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE); block_blob->SetBlockGroup(*const_cast(&aRefdBlock)); RefdBlock = block_blob; - bOurBlob = true; + bOurBlob = true; SetValueIsSet(); } diff --git a/src/KaxCluster.cpp b/src/KaxCluster.cpp index a1d6514..96d3675 100644 --- a/src/KaxCluster.cpp +++ b/src/KaxCluster.cpp @@ -50,13 +50,12 @@ KaxCluster::KaxCluster(EBML_EXTRA_DEF) {} KaxCluster::KaxCluster(const KaxCluster & ElementToClone) - :EbmlMaster(ElementToClone) - ,bSilentTracksUsed(ElementToClone.bSilentTracksUsed) + :EbmlMaster(ElementToClone) + ,bSilentTracksUsed(ElementToClone.bSilentTracksUsed) { // update the parent of each children EBML_MASTER_ITERATOR Itr = begin(); - while (Itr != end()) - { + while (Itr != end()) { if (EbmlId(**Itr) == EBML_ID(KaxBlockGroup)) { static_cast(*Itr)->SetParent(*this); } else if (EbmlId(**Itr) == EBML_ID(KaxBlock)) { @@ -66,7 +65,7 @@ KaxCluster::KaxCluster(const KaxCluster & ElementToClone) static_cast(*Itr)->SetParent(*this); #endif // MATROSKA_VERSION } - ++Itr; + ++Itr; } } @@ -153,8 +152,8 @@ bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuff filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault) { filepos_t Result = 0; - size_t Index; - EBML_MASTER_ITERATOR TrkItr, Itr; + size_t Index; + EBML_MASTER_ITERATOR TrkItr, Itr; // update the Timecode of the Cluster before writing KaxClusterTimecode * Timecode = static_cast(this->FindElt(EBML_INFO(KaxClusterTimecode))); @@ -165,17 +164,13 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS // SilentTracks handling // check the parent cluster for existing tracks and see if they are contained in this cluster or not - if (bSilentTracksUsed) - { + if (bSilentTracksUsed) { KaxTracks & MyTracks = *static_cast(ParentSegment->FindElt(EBML_INFO(KaxTracks))); - for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr) - { - if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry)) - { + for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr) { + if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry)) { KaxTrackEntry & entry = *static_cast(*TrkItr); uint32 tracknum = entry.TrackNumber(); - for (Itr = begin(); Itr != end(); ++Itr) - { + for (Itr = begin(); Itr != end(); ++Itr) { if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) { KaxBlockGroup & group = *static_cast(*Itr); if (group.TrackNumber() == tracknum) @@ -183,8 +178,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS } } // the track wasn't found in this cluster - if (Itr == end()) - { + if (Itr == end()) { KaxClusterSilentTracks * SilentTracks = static_cast(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks))); assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster KaxClusterSilentTrackNumber * trackelt = static_cast(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber))); @@ -197,16 +191,14 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS Result = EbmlMaster::Render(output, bSaveDefault); // For all Blocks add their position on the CueEntry - for (Itr = begin(); Itr != end(); ++Itr) - { + for (Itr = begin(); Itr != end(); ++Itr) { if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) { CueToUpdate.PositionSet(*static_cast(*Itr)); } } } else { // new school, using KaxBlockBlob - for (Index = 0; Index= 2 if (Blobs[Index]->IsSimpleBlock()) PushElement( (KaxSimpleBlock&) *Blobs[Index] ); @@ -217,22 +209,18 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS // SilentTracks handling // check the parent cluster for existing tracks and see if they are contained in this cluster or not - if (bSilentTracksUsed) - { + if (bSilentTracksUsed) { KaxTracks & MyTracks = *static_cast(ParentSegment->FindElt(EBML_INFO(KaxTracks))); - for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr) - { - if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry)) - { + for (TrkItr = MyTracks.begin(); TrkItr != MyTracks.end(); ++TrkItr) { + if (EbmlId(*(*TrkItr)) == EBML_ID(KaxTrackEntry)) { KaxTrackEntry & entry = *static_cast(*TrkItr); uint32 tracknum = entry.TrackNumber(); for (Index = 0; Index(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks))); assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster KaxClusterSilentTrackNumber * trackelt = static_cast(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber))); @@ -301,9 +289,8 @@ KaxBlockGroup & KaxCluster::GetNewBlock() void KaxCluster::ReleaseFrames() { - EBML_MASTER_ITERATOR Itr; - for (Itr = begin(); Itr != end(); ++Itr) - { + EBML_MASTER_ITERATOR Itr; + for (Itr = begin(); Itr != end(); ++Itr) { if (EbmlId(*(*Itr)) == EBML_ID(KaxBlockGroup)) { static_cast(*Itr)->ReleaseFrames(); } diff --git a/src/KaxCues.cpp b/src/KaxCues.cpp index 9569244..ff35f70 100644 --- a/src/KaxCues.cpp +++ b/src/KaxCues.cpp @@ -55,11 +55,10 @@ bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef) BlockReference->SetBlockGroup(*const_cast(&BlockRef)); for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) - if (&(KaxBlockGroup&)*ListIdx == &BlockRef) - { - delete BlockReference; + if (&(KaxBlockGroup&)*ListIdx == &BlockRef) { + delete BlockReference; return true; - } + } myTempReferences.push_back(BlockReference); return true; @@ -102,7 +101,7 @@ void KaxCues::PositionSet(const KaxBlockGroup & BlockRef) for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) { const KaxInternalBlock &refTmp = **ListIdx; if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() && - refTmp.TrackNum() == BlockRef.TrackNumber()) { + refTmp.TrackNum() == BlockRef.TrackNumber()) { // found, now add the element to the entry list KaxCuePoint & NewPoint = AddNewChild(*this); NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale()); @@ -122,15 +121,13 @@ const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const uint64 aPrevTime = 0; uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF); - EBML_MASTER_CONST_ITERATOR Itr; - for (Itr = begin(); Itr != end(); ++Itr) - { + EBML_MASTER_CONST_ITERATOR Itr; + for (Itr = begin(); Itr != end(); ++Itr) { if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) { const KaxCuePoint *tmp = static_cast(*Itr); // check the tile const KaxCueTime *aTime = static_cast(tmp->FindFirstElt(EBML_INFO(KaxCueTime))); - if (aTime != NULL) - { + if (aTime != NULL) { uint64 _Time = uint64(*aTime); if (_Time > aPrevTime && _Time < TimecodeToLocate) { aPrevTime = _Time; diff --git a/src/KaxCuesData.cpp b/src/KaxCuesData.cpp index e0b5bbf..924eaf5 100644 --- a/src/KaxCuesData.cpp +++ b/src/KaxCuesData.cpp @@ -62,8 +62,7 @@ void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 Globa #if MATROSKA_VERSION >= 2 // handle reference use - if (BlockReference.ReferenceCount() != 0) - { + if (BlockReference.ReferenceCount() != 0) { unsigned int i; for (i=0; i(NewPositions); @@ -98,8 +97,7 @@ void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalT #if 0 // MATROSKA_VERSION >= 2 // handle reference use - if (BlockReference.ReferenceCount() != 0) - { + if (BlockReference.ReferenceCount() != 0) { unsigned int i; for (i=0; i(NewPositions); @@ -137,8 +135,7 @@ void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 G #ifdef OLD // handle recursive reference use - if (BlockReference.ReferenceCount() != 0) - { + if (BlockReference.ReferenceCount() != 0) { unsigned int i; for (i=0; i(FindFirstElt(EBML_INFO(KaxCueTrackPositions))); - while (aPoss != NULL) - { + while (aPoss != NULL) { const KaxCueClusterPosition *aPos = static_cast(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition))); if (aPos != NULL && uint64(*aPos) < aPosition) { aPosition = uint64(*aPos); diff --git a/src/KaxInfoData.cpp b/src/KaxInfoData.cpp index fffc9f1..f074576 100644 --- a/src/KaxInfoData.cpp +++ b/src/KaxInfoData.cpp @@ -41,18 +41,18 @@ START_LIBMATROSKA_NAMESPACE KaxPrevUID::KaxPrevUID(EBML_EXTRA_DEF) -:KaxSegmentUID(EBML_DEF_BINARY_CTX(KaxPrevUID) EBML_DEF_SEP EBML_EXTRA_CALL) + :KaxSegmentUID(EBML_DEF_BINARY_CTX(KaxPrevUID) EBML_DEF_SEP EBML_EXTRA_CALL) { } KaxNextUID::KaxNextUID(EBML_EXTRA_DEF) -:KaxSegmentUID(EBML_DEF_BINARY_CTX(KaxNextUID) EBML_DEF_SEP EBML_EXTRA_CALL) + :KaxSegmentUID(EBML_DEF_BINARY_CTX(KaxNextUID) EBML_DEF_SEP EBML_EXTRA_CALL) { } #if defined(HAVE_EBML2) || defined(HAS_EBML2) KaxSegmentUID::KaxSegmentUID(EBML_DEF_CONS EBML_DEF_SEP EBML_EXTRA_DEF) -:EbmlBinary(EBML_DEF_PARAM EBML_DEF_SEP EBML_EXTRA_CALL) + :EbmlBinary(EBML_DEF_PARAM EBML_DEF_SEP EBML_EXTRA_CALL) { } #endif diff --git a/src/KaxSeekHead.cpp b/src/KaxSeekHead.cpp index 6f6201a..5cc131c 100644 --- a/src/KaxSeekHead.cpp +++ b/src/KaxSeekHead.cpp @@ -57,7 +57,7 @@ void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentS KaxSeekID & aNewID = GetChild(aNewPoint); binary ID[4]; - ((const EbmlId&)aElt).Fill(ID); + ((const EbmlId&)aElt).Fill(ID); aNewID.CopyBuffer(ID, EBML_ID_LENGTH((const EbmlId&)aElt)); } @@ -65,17 +65,14 @@ KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const { // parse all the Entries and find the first to match the type KaxSeek * aElt = static_cast(FindFirstElt(EBML_INFO(KaxSeek))); - while (aElt != NULL) - { + while (aElt != NULL) { KaxSeekID * aId = NULL; - EBML_MASTER_ITERATOR Itr; - for (Itr = aElt->begin(); Itr != aElt->end(); ++Itr) - { + EBML_MASTER_ITERATOR Itr; + for (Itr = aElt->begin(); Itr != aElt->end(); ++Itr) { if (EbmlId(*(*Itr)) == EBML_ID(KaxSeekID)) { aId = static_cast(*Itr); EbmlId aEbmlId(aId->GetBuffer(), aId->GetSize()); - if (aEbmlId == EBML_INFO_ID(Callbacks)) - { + if (aEbmlId == EBML_INFO_ID(Callbacks)) { return aElt; } break; @@ -89,23 +86,19 @@ KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const { - EBML_MASTER_CONST_ITERATOR Itr; + EBML_MASTER_CONST_ITERATOR Itr; KaxSeek *tmp; // look for the previous in the list - for (Itr = begin(); Itr != end(); ++Itr) - { + for (Itr = begin(); Itr != end(); ++Itr) { if (*Itr == static_cast(&aPrev)) break; } - if (Itr != end()) - { + if (Itr != end()) { ++Itr; - for (; Itr != end(); ++Itr) - { - if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek)) - { + for (; Itr != end(); ++Itr) { + if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek)) { tmp = (KaxSeek *)(*Itr); if (tmp->IsEbmlId(aPrev)) return tmp; diff --git a/src/KaxSegment.cpp b/src/KaxSegment.cpp index bd586cf..d364c57 100644 --- a/src/KaxSegment.cpp +++ b/src/KaxSegment.cpp @@ -53,16 +53,15 @@ KaxSegment::KaxSegment(EBML_EXTRA_DEF) } KaxSegment::KaxSegment(const KaxSegment & ElementToClone) - :EbmlMaster(ElementToClone) + :EbmlMaster(ElementToClone) { // update the parent of each children EBML_MASTER_ITERATOR Itr = begin(); - while (Itr != end()) - { + while (Itr != end()) { if (EbmlId(**Itr) == EBML_ID(KaxCluster)) { static_cast(*Itr)->SetParent(*this); } - ++Itr; + ++Itr; } } -- 2.40.0