]> granicus.if.org Git - libmatroska/commitdiff
libmatroska: KaxCues::AddBlockGroup() was removed as it's broken beyond repair
authorSteve Lhomme <slhomme@matroska.org>
Thu, 29 Jul 2010 19:06:19 +0000 (19:06 +0000)
committerSteve Lhomme <slhomme@matroska.org>
Thu, 29 Jul 2010 19:06:19 +0000 (19:06 +0000)
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libmatroska@453 a6f86f6d-0131-4f8e-9e7b-e335508773d5

ChangeLog
matroska/KaxBlock.h
matroska/KaxCues.h
src/KaxCues.cpp
test/mux/test6.cpp

index 7e8dd90c4897d1eb9fd84b43819c52d6ed91061f..0a0464830c53965902331d99ceb675cd2f6c0f7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ New 1.1.0 version:
     - change the placement of a MATROSKA_DLL_API so that it actually works
     - remove all references to the old/outdated/previous tag system
     - add the possibility for a DataBuffer class to use its own internal memory
+    - KaxCues::AddBlockGroup() was removed as it's broken beyond repair
 
 2010-06-04 robux4/mosu
 New 1.0.0 version:
index 1ba47fb10bffaafacb5e7af810fe29011005a5ac..576ca1951bcc9a79a57afc4a57e3ebb4cbd58dad 100644 (file)
@@ -312,6 +312,7 @@ class MATROSKA_DLL_API KaxSimpleBlock : public KaxInternalBlock {
 };
 #endif // MATROSKA_VERSION
 
+/// Placeholder class for either a BlockGroup or a SimpleBlock
 class MATROSKA_DLL_API KaxBlockBlob {
 public:
        KaxBlockBlob(BlockBlobType sblock_mode) :ParentCluster(NULL), SimpleBlockMode(sblock_mode) {
index d3384b6156e1b57b57200bd90ed83dbf0976b1d3..acce111070ad3626864fcbe90c2a787831d30cbd 100644 (file)
@@ -1,91 +1,91 @@
-/****************************************************************************\r
-** libmatroska : parse Matroska files, see http://www.matroska.org/\r
-**\r
-** <file/class description>\r
-**\r
-** Copyright (C) 2002-2010 Steve Lhomme.  All rights reserved.\r
-**\r
-** This file is part of libmatroska.\r
-**\r
-** This library is free software; you can redistribute it and/or\r
-** modify it under the terms of the GNU Lesser General Public\r
-** License as published by the Free Software Foundation; either\r
-** version 2.1 of the License, or (at your option) any later version.\r
-** \r
-** This library is distributed in the hope that it will be useful,\r
-** but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-** Lesser General Public License for more details.\r
-** \r
-** You should have received a copy of the GNU Lesser General Public\r
-** License along with this library; if not, write to the Free Software\r
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-**\r
-** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**\r
-** Contact license@matroska.org if any conditions of this licensing are\r
-** not clear to you.\r
-**\r
-**********************************************************************/\r
-\r
-/*!\r
-       \file\r
-       \version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $\r
-       \author Steve Lhomme     <robux4 @ users.sf.net>\r
-*/\r
-#ifndef LIBMATROSKA_CUES_H\r
-#define LIBMATROSKA_CUES_H\r
-\r
-#include <vector>\r
-\r
-#include "matroska/KaxTypes.h"\r
-#include "ebml/EbmlMaster.h"\r
-#include "matroska/KaxBlock.h"\r
-\r
-using namespace LIBEBML_NAMESPACE;\r
-\r
-START_LIBMATROSKA_NAMESPACE\r
-\r
-class KaxCuePoint;\r
-\r
-DECLARE_MKX_MASTER(KaxCues)\r
-       public:\r
-               ~KaxCues();\r
-\r
-               bool AddBlockGroup(const KaxBlockGroup & BlockReference);\r
-               bool AddBlockBlob(const KaxBlockBlob & BlockReference);\r
-\r
-               /*!\r
-                       \brief Indicate that the position for this Block is set\r
-               */\r
-               void PositionSet(const KaxBlockGroup & BlockReference);\r
-               void PositionSet(const KaxBlockBlob & BlockReference);\r
-\r
-               /*!\r
-                       \brief override to sort by timecode/track\r
-               */\r
-               filepos_t Render(IOCallback & output, bool bSaveDefault = false) {\r
-                       Sort();\r
-                       return EbmlMaster::Render(output, bSaveDefault);\r
-               }\r
-\r
-               uint64 GetTimecodePosition(uint64 aTimecode) const;\r
-               const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const;\r
-\r
-               void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {\r
-                       mGlobalTimecodeScale = aGlobalTimecodeScale;\r
-                       bGlobalTimecodeScaleIsSet = true;\r
-               }\r
-               uint64 GlobalTimecodeScale() const {\r
-                       assert(bGlobalTimecodeScaleIsSet); \r
-                       return mGlobalTimecodeScale;\r
-               }\r
-\r
-       protected:\r
-               std::vector<const KaxBlockBlob *> myTempReferences;\r
-               bool   bGlobalTimecodeScaleIsSet;\r
-               uint64 mGlobalTimecodeScale;\r
-};\r
-\r
-END_LIBMATROSKA_NAMESPACE\r
-\r
-#endif // LIBMATROSKA_CUES_H\r
+/****************************************************************************
+** libmatroska : parse Matroska files, see http://www.matroska.org/
+**
+** <file/class description>
+**
+** Copyright (C) 2002-2010 Steve Lhomme.  All rights reserved.
+**
+** This file is part of libmatroska.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+** 
+** This library is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+** Lesser General Public License for more details.
+** 
+** You should have received a copy of the GNU Lesser General Public
+** License along with this library; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**
+** Contact license@matroska.org if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*!
+       \file
+       \version \$Id: KaxCues.h,v 1.7 2004/04/14 23:26:17 robux4 Exp $
+       \author Steve Lhomme     <robux4 @ users.sf.net>
+*/
+#ifndef LIBMATROSKA_CUES_H
+#define LIBMATROSKA_CUES_H
+
+#include <vector>
+
+#include "matroska/KaxTypes.h"
+#include "ebml/EbmlMaster.h"
+#include "matroska/KaxBlock.h"
+
+using namespace LIBEBML_NAMESPACE;
+
+START_LIBMATROSKA_NAMESPACE
+
+class KaxCuePoint;
+
+DECLARE_MKX_MASTER(KaxCues)
+       public:
+               ~KaxCues();
+
+               //bool AddBlockGroup(const KaxBlockGroup & BlockReference); // deprecated
+               bool AddBlockBlob(const KaxBlockBlob & BlockReference);
+
+               /*!
+                       \brief Indicate that the position for this Block is set
+               */
+               void PositionSet(const KaxBlockGroup & BlockReference);
+               void PositionSet(const KaxBlockBlob & BlockReference);
+
+               /*!
+                       \brief override to sort by timecode/track
+               */
+               filepos_t Render(IOCallback & output, bool bSaveDefault = false) {
+                       Sort();
+                       return EbmlMaster::Render(output, bSaveDefault);
+               }
+
+               uint64 GetTimecodePosition(uint64 aTimecode) const;
+               const KaxCuePoint * GetTimecodePoint(uint64 aTimecode) const;
+
+               void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
+                       mGlobalTimecodeScale = aGlobalTimecodeScale;
+                       bGlobalTimecodeScaleIsSet = true;
+               }
+               uint64 GlobalTimecodeScale() const {
+                       assert(bGlobalTimecodeScaleIsSet); 
+                       return mGlobalTimecodeScale;
+               }
+
+       protected:
+               std::vector<const KaxBlockBlob *> myTempReferences;
+               bool   bGlobalTimecodeScaleIsSet;
+               uint64 mGlobalTimecodeScale;
+};
+
+END_LIBMATROSKA_NAMESPACE
+
+#endif // LIBMATROSKA_CUES_H
index 9fd123b2d72673cd6dbd52ac02330bb21a30d5d6..9c8e70794fde60e119f743d8fa66396c4ad3adfc 100644 (file)
@@ -51,22 +51,25 @@ KaxCues::~KaxCues()
 {
        assert(myTempReferences.size() == 0); // otherwise that means you have added references and forgot to set the position
 }
-
+/* deprecated and wrong
 bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef)
 {
        // Do not add the element if it's already present.
        std::vector<const KaxBlockBlob *>::iterator ListIdx;
-       KaxBlockBlob &BlockReference = *(new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE));
-       BlockReference.SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));
+       KaxBlockBlob *BlockReference = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+       BlockReference->SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));
 
        for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
-               if (*ListIdx == &BlockReference)
+               if (&(KaxBlockGroup&)*ListIdx == &BlockRef)
+        {
+            delete BlockReference;
                        return true;
+        }
 
-       myTempReferences.push_back(&BlockReference);
+       myTempReferences.push_back(BlockReference);
        return true;
 }
-
+*/
 bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference)
 {
        // Do not add the element if it's already present.
index 39477d3ed5a5578a226a2ffe8f31f9c07412e1a0..78ca97731fedf437149fa0692b33f155dbd5372d 100644 (file)
@@ -252,13 +252,17 @@ int main(int argc, char **argv)
                Clust1.AddFrame(MyTrack2, 23 * TIMECODE_SCALE, *data5, MyNewBlock); // to test with another track
 
                // add the "real" block to the cue entries
-               AllCues.AddBlockGroup(*MyLastBlockTrk1);
+        KaxBlockBlob *Blob1 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+        Blob1->SetBlockGroup(*MyLastBlockTrk1);
+               AllCues.AddBlockBlob(*Blob1);
 
                // frame for Track 2
                DataBuffer *data8 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
                Clust1.AddFrame(MyTrack2, 107 * TIMECODE_SCALE, *data8, MyNewBlock, *MyLastBlockTrk2);
 
-               AllCues.AddBlockGroup(*MyNewBlock);
+        KaxBlockBlob *Blob2 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+        Blob2->SetBlockGroup(*MyNewBlock);
+               AllCues.AddBlockBlob(*Blob2);
 
                // frame with a past reference
                DataBuffer *data4 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
@@ -275,7 +279,9 @@ int main(int argc, char **argv)
                        }
                }
 
-               AllCues.AddBlockGroup(*MyLastBlockTrk1);
+        KaxBlockBlob *Blob3 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+        Blob3->SetBlockGroup(*MyLastBlockTrk1);
+               AllCues.AddBlockBlob(*Blob3);
                //AllCues.UpdateSize();
 
                // simulate the writing of the stream :
@@ -295,7 +301,9 @@ int main(int argc, char **argv)
                DataBuffer *data2 = new DataBuffer((binary *)"tttyyy", countof("tttyyy"));
                Clust2.AddFrame(MyTrack1, 350 * TIMECODE_SCALE, *data2, MyNewBlock, *MyLastBlockTrk1);
                
-               AllCues.AddBlockGroup(*MyNewBlock);
+        KaxBlockBlob *Blob4 = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+        Blob4->SetBlockGroup(*MyNewBlock);
+               AllCues.AddBlockBlob(*Blob4);
 
                ClusterSize += Clust2.Render(out_file, AllCues, bWriteDefaultValues);
                Clust2.ReleaseFrames();
@@ -383,6 +391,11 @@ int main(int argc, char **argv)
                MuxedFile.Close(1000); // 1000 ms
 #endif // OLD
                out_file.close();
+
+        delete Blob1;
+        delete Blob2;
+        delete Blob3;
+        delete Blob4;
     }
     catch (exception & Ex)
     {