]> granicus.if.org Git - libmatroska/commitdiff
cosmetics: unify indentation
authorMoritz Bunkus <moritz@bunkus.org>
Fri, 19 Dec 2014 14:07:32 +0000 (15:07 +0100)
committerMoritz Bunkus <moritz@bunkus.org>
Fri, 19 Dec 2014 14:17:48 +0000 (15:17 +0100)
src/FileKax.cpp
src/KaxAttached.cpp
src/KaxAttachments.cpp
src/KaxBlock.cpp
src/KaxBlockData.cpp
src/KaxCluster.cpp
src/KaxCues.cpp
src/KaxCuesData.cpp
src/KaxInfoData.cpp
src/KaxSeekHead.cpp
src/KaxSegment.cpp

index 91cae1ed241615a1405b657766724d0257770098..5f88d4f5aec16c4c824a3bfb226dd8f23bcef5ae 100644 (file)
@@ -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; i<myTracks.size(); i++)
-    {
-  track_entries_size += myTracks[i]->default_size();
-    }
+  // get the Track-entry size
+  uint32 track_entries_size = 0;
+  for (size_t i=0; i<myTracks.size(); i++) {
+    track_entries_size += myTracks[i]->default_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; i<myTracks.size(); i++)
-    {
-  delete myTracks[i];
-    }
+  for (i=0; i<myTracks.size(); i++) {
+    delete myTracks[i];
+  }
 }
 
 /*!
-    \warning after rendering the head, some parameters are locked
+  \warning after rendering the head, some parameters are locked
 */
 filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp)
 {
-    try {
-  uint32 track_entries_size = 0;
-  for (size_t i=0; i<myTracks.size(); i++)
-  {
+  try {
+    uint32 track_entries_size = 0;
+    for (size_t i=0; i<myTracks.size(); i++) {
       track_entries_size += myTracks[i]->default_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; i<myTracks.size(); i++)
-  {
+    myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize;
+    myStreamInfo.CodecEntrySize = 4;
+    for (i=0; i<myTracks.size(); i++) {
       myStreamInfo.CodecEntrySize += myTracks[i]->CodecSize();
-  }
+    }
 
-  // Main Header
-  filepos_t result = myMainHeader.Render(myFile, myStreamInfo);
+    // Main Header
+    filepos_t result = myMainHeader.Render(myFile, myStreamInfo);
 
-  // Track Entries
-  for (i=0; i<myTracks.size(); i++)
-  {
+    // Track Entries
+    for (i=0; i<myTracks.size(); i++) {
       myTracks[i]->RenderEntry(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; i<myTracks.size(); i++)
-    {
+/*Track *FileMatroska::findTrack(Track * aTrack) const {
+  for (size_t i=0; i<myTracks.size(); i++) {
   if (myTracks[i] == aTrack)
-      return myTracks[i];
-    }
+  return myTracks[i];
+  }
 
-    return NULL;
-}*/
+  return NULL;
+  }*/
 
 void FileMatroska::track_SetName(Track * aTrack, const std::string & aName)
 {
-    if (IsMyTrack(aTrack))
-    {
-        aTrack->SetName(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<TrackNumber; TrackIdx ++) {
+  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<TrackNumber; TrackIdx ++) {
       Track * tmpTrack = Track::ReadEntry(myFile, TrackIdx+1, myStreamInfo);
       if (tmpTrack == NULL)
-    throw 0;
+        throw 0;
 
       myTracks.push_back(tmpTrack);
-  }
-
-  return result;
-    }
-    catch (exception & Ex)
-    {
-  throw Ex;
     }
+
+    return result;
+  }
+  catch (exception & Ex) {
+    throw Ex;
+  }
 }
 
 uint32 FileMatroska::ReadCodec()
 {
-    try {
-  // seek to the start of the Track Entries
-  myFile.setFilePointer(myStreamInfo.CodecEntryPosition);
+  try {
+    // seek to the start of the Track Entries
+    myFile.setFilePointer(myStreamInfo.CodecEntryPosition);
 
-  uint32 result = CodecHeader::Read(myFile, myTracks);
+    uint32 result = CodecHeader::Read(myFile, myTracks);
 
-  return result;
-    }
-    catch (exception & Ex)
-    {
-  throw Ex;
-    }
+    return result;
+  }
+  catch (exception & Ex) {
+    throw Ex;
+  }
 }
 
 inline bool FileMatroska::IsMyTrack(const Track * aTrack) const
 {
-    if (aTrack == 0)
-  throw 0;
+  if (aTrack == 0)
+    throw 0;
 
-    for (std::vector<Track*>::const_iterator i = myTracks.begin(); i != myTracks.end(); i ++)
-    {
-  if (*i == aTrack)
+  for (std::vector<Track*>::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<uint8>::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<uint8>::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<uint8>::const_iterator trackIdx = mySelectedTracks.begin();
-         trackIdx != mySelectedTracks.end() && *trackIdx < aTrackNumber;
-   trackIdx++)
-    {}
-
-    if (trackIdx == mySelectedTracks.end())
-  return false;
-    else
-  return true;
+  for (std::vector<uint8>::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
 }
index cef09a1487946a7c64135a96124aa86f9a4eae26..44f8584a5795c2afb23574afa7a39a09c89bf993 100644 (file)
@@ -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)
 }
index 4f3456580690a4c23b7c216983a3246847fd059e..350452080b6c145fda3800f693fd04fc28be36d0 100644 (file)
@@ -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)
 }
index 95407b029133fe6c02c348cf372bb53fd2bec783..fe0c22b21e55f41f96da565f24be1bb26df480d1 100644 (file)
@@ -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<DataBuffer *>::const_iterator Itr = ElementToClone.myBuffers.begin();
   std::vector<DataBuffer *>::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; i<myBuffers.size()-1; i++) {
-          SetSize_(GetSize() + myBuffers[i]->Size() + (myBuffers[i]->Size() / 0xFF + 1));
-        }
-        break;
-      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));
-        }
-        break;
-      case LACING_FIXED:
-        for (i=0; i<myBuffers.size()-1; i++) {
-          SetSize_(GetSize() + myBuffers[i]->Size());
-        }
-        break;
-      default:
-        i = 0;
-        assert(0);
+      switch (LacingHere) {
+        case LACING_XIPH:
+          for (i=0; i<myBuffers.size()-1; i++) {
+            SetSize_(GetSize() + myBuffers[i]->Size() + (myBuffers[i]->Size() / 0xFF + 1));
+          }
+          break;
+        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));
+          }
+          break;
+        case LACING_FIXED:
+          for (i=0; i<myBuffers.size()-1; i++) {
+            SetSize_(GetSize() + myBuffers[i]->Size());
+          }
+          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; i<myBuffers.size()-1; i++) {
-        tmpValue = 0xFF;
-        uint16 tmpSize = myBuffers[i]->Size();
-        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; i<myBuffers.size()-1; i++) {
+          tmpValue = 0xFF;
+          uint16 tmpSize = myBuffers[i]->Size();
+          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; i<myBuffers.size()-1; i++) {
-          _Size = int64(myBuffers[i]->Size()) - 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; i<myBuffers.size()-1; i++) {
+            _Size = int64(myBuffers[i]->Size()) - 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<FrameNum; Index++) {
-          // get the size of the frame
-          FrameSize = 0;
-          do {
-            FrameSize += uint8(*cursor);
-            LastBufferSize--;
-          } while (*cursor++ == 0xFF);
-          SizeList[Index] = FrameSize;
-          LastBufferSize -= FrameSize;
-        }
-        SizeList[Index] = LastBufferSize;
-        break;
-      case LACING_EBML:
-        SizeRead = LastBufferSize;
-        FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
-        SizeList[0] = FrameSize;
-        cursor += SizeRead;
-        LastBufferSize -= FrameSize + SizeRead;
-
-        for (Index=1; Index<FrameNum; Index++) {
-          // get the size of the frame
+      switch (mLacing) {
+        case LACING_XIPH:
+          for (Index=0; Index<FrameNum; Index++) {
+            // get the size of the frame
+            FrameSize = 0;
+            do {
+              FrameSize += uint8(*cursor);
+              LastBufferSize--;
+            } while (*cursor++ == 0xFF);
+            SizeList[Index] = FrameSize;
+            LastBufferSize -= FrameSize;
+          }
+          SizeList[Index] = LastBufferSize;
+          break;
+        case LACING_EBML:
           SizeRead = LastBufferSize;
-          FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
-          SizeList[Index] = FrameSize;
+          FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
+          SizeList[0] = FrameSize;
           cursor += SizeRead;
           LastBufferSize -= FrameSize + SizeRead;
-        }
-        if (Index <= FrameNum) // Safety check if FrameNum == 0
-          SizeList[Index] = LastBufferSize;
-        break;
-      case LACING_FIXED:
-        for (Index=0; Index<=FrameNum; Index++) {
-          // get the size of the frame
-          SizeList[Index] = LastBufferSize / (FrameNum + 1);
-        }
-        break;
-      default: // other lacing not supported
-        assert(0);
+
+          for (Index=1; Index<FrameNum; Index++) {
+            // get the size of the frame
+            SizeRead = LastBufferSize;
+            FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
+            SizeList[Index] = FrameSize;
+            cursor += SizeRead;
+            LastBufferSize -= FrameSize + SizeRead;
+          }
+          if (Index <= FrameNum) // Safety check if FrameNum == 0
+            SizeList[Index] = LastBufferSize;
+          break;
+        case LACING_FIXED:
+          for (Index=0; Index<=FrameNum; Index++) {
+            // get the size of the frame
+            SizeList[Index] = LastBufferSize / (FrameNum + 1);
+          }
+          break;
+        default: // other lacing not supported
+          assert(0);
       }
 
       FirstFrameLocation += cursor - EbmlBinary::GetBuffer();
@@ -560,8 +553,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
     }
     SetValueIsSet();
   }
-  else if (ReadFully == SCOPE_PARTIAL_DATA)
-  {
+  else if (ReadFully == SCOPE_PARTIAL_DATA) {
     binary _TempHead[5];
     Result = input.read(_TempHead, 5);
     binary *cursor = _TempHead;
@@ -595,8 +587,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
     }
     mInvisible = (*cursor & 0x08) >> 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<FrameNum; Index++) {
-          // get the size of the frame
-          FrameSize = 0;
-          do {
-            Result += input.read(_TempHead, 1);
-            FrameSize += uint8(_TempHead[0]);
-            LastBufferSize--;
+      switch (mLacing) {
+        case LACING_XIPH:
+          for (Index=0; Index<FrameNum; Index++) {
+            // get the size of the frame
+            FrameSize = 0;
+            do {
+              Result += input.read(_TempHead, 1);
+              FrameSize += uint8(_TempHead[0]);
+              LastBufferSize--;
 
-            FirstFrameLocation++;
-          } while (_TempHead[0] == 0xFF);
+              FirstFrameLocation++;
+            } while (_TempHead[0] == 0xFF);
 
-          FirstFrameLocation++;
-          SizeList[Index] = FrameSize;
-          LastBufferSize -= FrameSize;
-        }
-        SizeList[Index] = LastBufferSize;
-        break;
-      case LACING_EBML:
-        SizeRead = LastBufferSize;
-        cursor = _tmpBuf = new binary[FrameNum*4]; /// \warning assume the mean size will be coded in less than 4 bytes
-        Result += input.read(cursor, FrameNum*4);
-        FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
-        SizeList[0] = FrameSize;
-        cursor += SizeRead;
-        LastBufferSize -= FrameSize + SizeRead;
-
-        for (Index=1; Index<FrameNum; Index++) {
-          // get the size of the frame
+            FirstFrameLocation++;
+            SizeList[Index] = FrameSize;
+            LastBufferSize -= FrameSize;
+          }
+          SizeList[Index] = LastBufferSize;
+          break;
+        case LACING_EBML:
           SizeRead = LastBufferSize;
-          FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
-          SizeList[Index] = FrameSize;
+          cursor = _tmpBuf = new binary[FrameNum*4]; /// \warning assume the mean size will be coded in less than 4 bytes
+          Result += input.read(cursor, FrameNum*4);
+          FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
+          SizeList[0] = FrameSize;
           cursor += SizeRead;
           LastBufferSize -= FrameSize + SizeRead;
-        }
 
-        FirstFrameLocation += cursor - _tmpBuf;
+          for (Index=1; Index<FrameNum; Index++) {
+            // get the size of the frame
+            SizeRead = LastBufferSize;
+            FrameSize += ReadCodedSizeSignedValue(cursor, SizeRead, SizeUnknown);
+            SizeList[Index] = FrameSize;
+            cursor += SizeRead;
+            LastBufferSize -= FrameSize + SizeRead;
+          }
 
-        SizeList[Index] = LastBufferSize;
-        delete [] _tmpBuf;
-        break;
-      case LACING_FIXED:
-        for (Index=0; Index<=FrameNum; Index++) {
-          // get the size of the frame
-          SizeList[Index] = LastBufferSize / (FrameNum + 1);
-        }
-        break;
-      default: // other lacing not supported
-        assert(0);
+          FirstFrameLocation += cursor - _tmpBuf;
+
+          SizeList[Index] = LastBufferSize;
+          delete [] _tmpBuf;
+          break;
+        case LACING_FIXED:
+          for (Index=0; Index<=FrameNum; Index++) {
+            // get the size of the frame
+            SizeList[Index] = LastBufferSize / (FrameNum + 1);
+          }
+          break;
+        default: // other lacing not supported
+          assert(0);
       }
     } else {
       SizeList.resize(1);
@@ -694,7 +684,7 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB
 
 bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, LacingType lacing)
 {
-//  assert(past_timecode < 0);
+  //  assert(past_timecode < 0);
 
   KaxBlock & theBlock = GetChild<KaxBlock>(*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<KaxBlock>(*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<KaxReferenceBlock>(*this);
     thePastRef.SetReferencedBlock(PastBlock);
     thePastRef.SetParentBlock(*this);
   }
 
-  if (ForwBlock != NULL)
-  {
+  if (ForwBlock != NULL) {
     KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
     theFutureRef.SetReferencedBlock(ForwBlock);
     theFutureRef.SetParentBlock(*this);
@@ -792,8 +780,7 @@ unsigned int KaxBlockGroup::ReferenceCount() const
   KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
   if (MyBlockAdds != NULL) {
     Result++;
-    while ((MyBlockAdds = static_cast<KaxReferenceBlock *>(FindNextElt(*MyBlockAdds))) != NULL)
-    {
+    while ((MyBlockAdds = static_cast<KaxReferenceBlock *>(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
index 1cb308afa107d3066d93876fffb98f55a0e2539e..9589713928db399208d8773cbda7fa6029a85cb3 100644 (file)
@@ -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<KaxBlockGroup*>(&aRefdBlock));
   RefdBlock = block_blob;
-    bOurBlob = true;
+  bOurBlob = true;
   SetValueIsSet();
 }
 
index a1d6514456196285e59c20301fe46386d6f8cd38..96d3675e3264a3fc653a2e5932afb00902f8bda9 100644 (file)
@@ -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<KaxBlockGroup   *>(*Itr)->SetParent(*this);
     } else if (EbmlId(**Itr) == EBML_ID(KaxBlock)) {
@@ -66,7 +65,7 @@ KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
       static_cast<KaxBlockVirtual *>(*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<KaxClusterTimecode *>(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<KaxTracks *>(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<KaxTrackEntry *>(*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<KaxBlockGroup *>(*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<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
             assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
             KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(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<const KaxBlockGroup *>(*Itr));
       }
     }
   } else {
     // new school, using KaxBlockBlob
-    for (Index = 0; Index<Blobs.size(); Index++)
-    {
+    for (Index = 0; Index<Blobs.size(); Index++) {
 #if MATROSKA_VERSION >= 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<KaxTracks *>(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<KaxTrackEntry *>(*TrkItr);
           uint32 tracknum = entry.TrackNumber();
           for (Index = 0; Index<Blobs.size(); Index++) {
             if (((KaxInternalBlock&)*Blobs[Index]).TrackNum() == tracknum)
-                break; // this track is used
+              break; // this track is used
           }
           // the track wasn't found in this cluster
-          if (Index == ListSize())
-          {
+          if (Index == ListSize()) {
             KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
             assert(SilentTracks != NULL); // the flag bSilentTracksUsed should be set when creating the Cluster
             KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(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<KaxBlockGroup*>(*Itr)->ReleaseFrames();
     }
index 956924409017d0681a1740dd1230b83e70947bf3..ff35f709a699d19eb5044f975a88f3214d92284a 100644 (file)
@@ -55,11 +55,10 @@ bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef)
   BlockReference->SetBlockGroup(*const_cast<KaxBlockGroup*>(&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<KaxCuePoint>(*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<const KaxCuePoint *>(*Itr);
       // check the tile
       const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
-      if (aTime != NULL)
-      {
+      if (aTime != NULL) {
         uint64 _Time = uint64(*aTime);
         if (_Time > aPrevTime && _Time < TimecodeToLocate) {
           aPrevTime = _Time;
index e0b5bbf65bf77c2d73cda97be647ec73febd8e25..924eaf5bcde7a460bc988bc4c052d90896bbd79c 100644 (file)
@@ -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<BlockReference.ReferenceCount(); i++) {
       KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(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<BlockReference.ReferenceCount(); i++) {
       KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(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<BlockReference.ReferenceCount(); i++) {
       AddReference(BlockReference.Reference(i).RefBlock());
@@ -206,8 +203,7 @@ const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const
   uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF);
   // find the position of the "earlier" Cluster
   const KaxCueTrackPositions *aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
-  while (aPoss != NULL)
-  {
+  while (aPoss != NULL) {
     const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
     if (aPos != NULL && uint64(*aPos) < aPosition) {
       aPosition = uint64(*aPos);
index fffc9f128ca5b25f3ad7a1259a8fb01ea32b5b0e..f074576cfea419e041261ac6dbb7b892d6a6953b 100644 (file)
 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
index 6f6201ae29518e877e3ffc826a17b9a846c8702f..5cc131c5e731cb09b3dbcc63136d2830ece2c58f 100644 (file)
@@ -57,7 +57,7 @@ void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentS
 
   KaxSeekID & aNewID = GetChild<KaxSeekID>(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<KaxSeek *>(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<KaxSeekID*>(*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<const EbmlElement*>(&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;
index bd586cf9592b2b913cb0daf570448ae83fafa6c7..d364c57893617a214b4a1b6f3f8cd980c4fc7c06 100644 (file)
@@ -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<KaxCluster *>(*Itr)->SetParent(*this);
     }
-        ++Itr;
+    ++Itr;
   }
 }