[matroska] r1216 - in trunk/libmatroska: matroska matroska/c src

[email protected] Sun, 9 Oct 2005 18:19:15 +0400 (MSD)
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2005-10-09 18:18:56 +0400 (Sun, 09 Oct 2005)
New Revision: 1216

Modified:
   trunk/libmatroska/matroska/FileKax.h
   trunk/libmatroska/matroska/KaxAttached.h
   trunk/libmatroska/matroska/KaxAttachments.h
   trunk/libmatroska/matroska/KaxBlock.h
   trunk/libmatroska/matroska/KaxBlockData.h
   trunk/libmatroska/matroska/KaxChapters.h
   trunk/libmatroska/matroska/KaxCluster.h
   trunk/libmatroska/matroska/KaxClusterData.h
   trunk/libmatroska/matroska/KaxConfig.h
   trunk/libmatroska/matroska/KaxContentEncoding.h
   trunk/libmatroska/matroska/KaxContexts.h
   trunk/libmatroska/matroska/KaxCues.h
   trunk/libmatroska/matroska/KaxCuesData.h
   trunk/libmatroska/matroska/KaxInfo.h
   trunk/libmatroska/matroska/KaxInfoData.h
   trunk/libmatroska/matroska/KaxSeekHead.h
   trunk/libmatroska/matroska/KaxSegment.h
   trunk/libmatroska/matroska/KaxTagMulti.h
   trunk/libmatroska/matroska/KaxTags.h
   trunk/libmatroska/matroska/KaxTrackAudio.h
   trunk/libmatroska/matroska/KaxTrackEntryData.h
   trunk/libmatroska/matroska/KaxTrackVideo.h
   trunk/libmatroska/matroska/KaxTracks.h
   trunk/libmatroska/matroska/KaxTypes.h
   trunk/libmatroska/matroska/KaxVersion.h
   trunk/libmatroska/matroska/c/libmatroska.h
   trunk/libmatroska/matroska/c/libmatroska_t.h
   trunk/libmatroska/src/KaxBlock.cpp
   trunk/libmatroska/src/KaxCues.cpp
   trunk/libmatroska/src/KaxCuesData.cpp
Log:
libmatroska: introduce KaxBlockBlob to automatically select between BlockGroup and SimpleBlock
+ native eol-style


Property changes on: trunk/libmatroska/matroska/FileKax.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxAttached.h
===================================================================
--- trunk/libmatroska/matroska/KaxAttached.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxAttached.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -130,7 +130,7 @@
 		KaxFileUID(const KaxFileUID & ElementToClone) : EbmlUInteger(ElementToClone) {}
 		static EbmlElement & Create() {return *(new KaxFileUID);}
 		const EbmlCallbacks & Generic() const {return ClassInfos;}
-		static const EbmlCallbacks ClassInfos;
+		static const EbmlCallbacks ClassInfos;
 
 		operator const EbmlId &() const {return ClassInfos.GlobalId;}
 		bool IsYourId(const EbmlId & TestId) const;


Property changes on: trunk/libmatroska/matroska/KaxAttached.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxAttachments.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxBlock.h
===================================================================
--- trunk/libmatroska/matroska/KaxBlock.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxBlock.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -48,6 +48,7 @@
 
 class KaxCluster;
 class KaxReferenceBlock;
+class KaxInternalBlock;
 
 class MATROSKA_DLL_API DataBuffer {
 	protected:
@@ -146,9 +147,7 @@
 		*/
 		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
 
-		void SetParent(KaxCluster & aParentCluster) {
-			ParentCluster = &aParentCluster;
-		}
+		void SetParent(KaxCluster & aParentCluster);
 
 		void SetParentTrack(const KaxTrackEntry & aParentTrack) {
 			ParentTrack = &aParentTrack;
@@ -184,6 +183,8 @@
 		*/
 		void ReleaseFrames();
 
+		operator KaxInternalBlock &();
+
 	protected:
 		KaxCluster * ParentCluster;
 		const KaxTrackEntry * ParentTrack;
@@ -249,6 +250,8 @@
 		
 		bool IsInvisible() const { return mInvisible; }
 
+		uint64 ClusterPosition() const;
+
 	protected:
 		std::vector<DataBuffer *> myBuffers;
 		std::vector<int32>        SizeList;
@@ -290,9 +293,40 @@
 
 		void SetKeyframe(bool b_keyframe) { bIsKeyframe = b_keyframe; }
 		void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; }
+
+		operator KaxInternalBlock &() { return *static_cast<KaxInternalBlock*>(this); }
 };
 #endif // MATROSKA_VERSION
 
+class MATROSKA_DLL_API KaxBlockBlob {
+public:
+	KaxBlockBlob(bool use_sblock) :bUseSimpleBlock(use_sblock), ParentCluster(NULL) {
+		Block.group = NULL;
+	}
+
+	operator KaxBlockGroup &();
+	operator KaxSimpleBlock &();
+	operator KaxInternalBlock &();
+
+	void SetBlockGroup( KaxBlockGroup &BlockRef );
+
+	void SetBlockDuration(uint64 TimeLength);
+
+	void SetParent(KaxCluster & aParentCluster);
+	bool AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, const KaxBlockBlob * PastBlock = NULL, const KaxBlockBlob * ForwBlock = NULL);
+
+	void ReplaceSimpleByGroup();
+protected:
+	KaxCluster * ParentCluster;
+	union {
+		KaxBlockGroup *group;
+#if MATROSKA_VERSION >= 2
+		KaxSimpleBlock *simpleblock;
+#endif // MATROSKA_VERSION
+	} Block;
+	bool bUseSimpleBlock;
+};
+
 class MATROSKA_DLL_API KaxBlockDuration : public EbmlUInteger {
 	public:
 		KaxBlockDuration() {}


Property changes on: trunk/libmatroska/matroska/KaxBlock.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxBlockData.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxChapters.h
===================================================================
--- trunk/libmatroska/matroska/KaxChapters.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxChapters.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -39,7 +39,7 @@
 #include "ebml/EbmlMaster.h"
 #include "ebml/EbmlUInteger.h"
 #include "ebml/EbmlUnicodeString.h"
-#include "ebml/EbmlString.h"
+#include "ebml/EbmlString.h"
 #include "ebml/EbmlBinary.h"
 
 using namespace LIBEBML_NAMESPACE;
@@ -309,7 +309,7 @@
     const EbmlCallbacks & Generic() const {return ClassInfos;}
     static const EbmlCallbacks ClassInfos;
     operator const EbmlId &() const {return ClassInfos.GlobalId;}
-	EbmlElement * Clone() const {return new KaxChapterProcessPrivate(*this);}
+	EbmlElement * Clone() const {return new KaxChapterProcessPrivate(*this);}
 	bool ValidateSize() const {return true;}
 };
 
@@ -343,7 +343,7 @@
     const EbmlCallbacks & Generic() const {return ClassInfos;}
     static const EbmlCallbacks ClassInfos;
     operator const EbmlId &() const {return ClassInfos.GlobalId;}
-	EbmlElement * Clone() const {return new KaxChapterProcessData(*this);}
+	EbmlElement * Clone() const {return new KaxChapterProcessData(*this);}
 	bool ValidateSize() const {return true;}
 };
 


Property changes on: trunk/libmatroska/matroska/KaxChapters.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxCluster.h
===================================================================
--- trunk/libmatroska/matroska/KaxCluster.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxCluster.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -1,162 +1,162 @@
-/****************************************************************************
-** libmatroska : parse Matroska files, see http://www.matroska.org/
-**
-** <file/class description>
-**
-** Copyright (C) 2002-2004 Steve Lhomme.  All rights reserved.
-**
-** 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 [email protected] if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-/*!
-	\file
-	\version \$Id: KaxCluster.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
-	\author Steve Lhomme     <robux4 @ users.sf.net>
-	\author Julien Coloos    <suiryc @ users.sf.net>
-
-*/
-#ifndef LIBMATROSKA_CLUSTER_H
-#define LIBMATROSKA_CLUSTER_H
-
-#include "matroska/KaxTypes.h"
-#include "ebml/EbmlMaster.h"
-#include "matroska/KaxTracks.h"
-#include "matroska/KaxBlock.h"
-#include "matroska/KaxCues.h"
-#include "matroska/KaxClusterData.h"
-
-using namespace LIBEBML_NAMESPACE;
-
-START_LIBMATROSKA_NAMESPACE
-
-class KaxSegment;
-
-class MATROSKA_DLL_API KaxCluster : public EbmlMaster {
-	public:
-		KaxCluster();
-		KaxCluster(const KaxCluster & ElementToClone);
-		static EbmlElement & Create() {return *(new KaxCluster);}
-		const EbmlCallbacks & Generic() const {return ClassInfos;}
-		static const EbmlCallbacks ClassInfos;
-		operator const EbmlId &() const {return ClassInfos.GlobalId;}
-		EbmlElement * Clone() const {return new KaxCluster(*this);}
-
-		/*!
-			\brief Addition of a frame without references
-
-			\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
-		*/
-		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing = LACING_AUTO);
-		/*!
-			\brief Addition of a frame with a backward reference (P frame)
-			\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
-
-		*/
-		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO);
-
-		/*!
-			\brief Addition of a frame with a backward+forward reference (B frame)
-			\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
-
-		*/
-		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
-
-		/*!
-			\brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries
-		*/
-		uint32 Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault = false);
-
-		/*!
-			\return the global timecode of this Cluster
-		*/
-		uint64 GlobalTimecode() const;
-
-		KaxBlockGroup & GetNewBlock();
-		
-		/*!
-			\brief release all the frames of all Blocks
-			\note this is a convenience to be able to keep Clusters+Blocks in memory (for future reference) withouht being a memory hog
-		*/
-		void ReleaseFrames();
-
-		/*!
-			\brief return the position offset compared to the beggining of the Segment
-		*/
-		uint64 GetPosition() const;
-
-		void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;}
-
-		void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) {
-			bPreviousTimecodeIsSet = true; 
-			PreviousTimecode = aPreviousTimecode;
-			SetGlobalTimecodeScale(aTimecodeScale);
-		}
-
-		/*!
-			\note dirty hack to get the mandatory data back after reading
-			\todo there should be a better way to get mandatory data
-		*/
-		void InitTimecode(uint64 aTimecode, int64 aTimecodeScale) {
-			SetGlobalTimecodeScale(aTimecodeScale);
-			MinTimecode = MaxTimecode = PreviousTimecode = aTimecode * TimecodeScale;
-			bFirstFrameInside = bPreviousTimecodeIsSet = true;
-		}
-
-		int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const;
-
-		uint64 GetBlockGlobalTimecode(int16 LocalTimecode);
-
-		void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
-			TimecodeScale = aGlobalTimecodeScale;
-			bTimecodeScaleIsSet = true;
-		}
-		uint64 GlobalTimecodeScale() const {
-			assert(bTimecodeScaleIsSet); 
-			return TimecodeScale;
-		}
-
-		bool SetSilentTrackUsed()
-		{
-			bSilentTracksUsed = true;
-			return FindFirstElt(KaxClusterSilentTracks::ClassInfos, true) != NULL;
-		}
-
-	protected:
-		KaxBlockGroup    * currentNewBlock;
-		const KaxSegment * ParentSegment;
-
-		uint64 MinTimecode, MaxTimecode, PreviousTimecode;
-		int64  TimecodeScale;
-
-		bool bFirstFrameInside; // used to speed research
-		bool bPreviousTimecodeIsSet;
-		bool bTimecodeScaleIsSet;
-		bool bSilentTracksUsed;
-
-		/*!
-			\note method used internally
-		*/
-		bool AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing);
-
-};
-
-END_LIBMATROSKA_NAMESPACE
-
-#endif // LIBMATROSKA_CLUSTER_H
+/****************************************************************************
+** libmatroska : parse Matroska files, see http://www.matroska.org/
+**
+** <file/class description>
+**
+** Copyright (C) 2002-2004 Steve Lhomme.  All rights reserved.
+**
+** 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 [email protected] if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*!
+	\file
+	\version \$Id: KaxCluster.h,v 1.10 2004/04/14 23:26:17 robux4 Exp $
+	\author Steve Lhomme     <robux4 @ users.sf.net>
+	\author Julien Coloos    <suiryc @ users.sf.net>
+
+*/
+#ifndef LIBMATROSKA_CLUSTER_H
+#define LIBMATROSKA_CLUSTER_H
+
+#include "matroska/KaxTypes.h"
+#include "ebml/EbmlMaster.h"
+#include "matroska/KaxTracks.h"
+#include "matroska/KaxBlock.h"
+#include "matroska/KaxCues.h"
+#include "matroska/KaxClusterData.h"
+
+using namespace LIBEBML_NAMESPACE;
+
+START_LIBMATROSKA_NAMESPACE
+
+class KaxSegment;
+
+class MATROSKA_DLL_API KaxCluster : public EbmlMaster {
+	public:
+		KaxCluster();
+		KaxCluster(const KaxCluster & ElementToClone);
+		static EbmlElement & Create() {return *(new KaxCluster);}
+		const EbmlCallbacks & Generic() const {return ClassInfos;}
+		static const EbmlCallbacks ClassInfos;
+		operator const EbmlId &() const {return ClassInfos.GlobalId;}
+		EbmlElement * Clone() const {return new KaxCluster(*this);}
+
+		/*!
+			\brief Addition of a frame without references
+
+			\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
+		*/
+		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing = LACING_AUTO);
+		/*!
+			\brief Addition of a frame with a backward reference (P frame)
+			\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
+
+		*/
+		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, LacingType lacing = LACING_AUTO);
+
+		/*!
+			\brief Addition of a frame with a backward+forward reference (B frame)
+			\param the timecode is expressed in nanoseconds, relative to the beggining of the Segment
+
+		*/
+		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup & PastBlock, const KaxBlockGroup & ForwBlock, LacingType lacing = LACING_AUTO);
+
+		/*!
+			\brief Render the data to the stream and retrieve the position of BlockGroups for later cue entries
+		*/
+		uint32 Render(IOCallback & output, KaxCues & CueToUpdate, bool bSaveDefault = false);
+
+		/*!
+			\return the global timecode of this Cluster
+		*/
+		uint64 GlobalTimecode() const;
+
+		KaxBlockGroup & GetNewBlock();
+		
+		/*!
+			\brief release all the frames of all Blocks
+			\note this is a convenience to be able to keep Clusters+Blocks in memory (for future reference) withouht being a memory hog
+		*/
+		void ReleaseFrames();
+
+		/*!
+			\brief return the position offset compared to the beggining of the Segment
+		*/
+		uint64 GetPosition() const;
+
+		void SetParent(const KaxSegment & aParentSegment) {ParentSegment = &aParentSegment;}
+
+		void SetPreviousTimecode(uint64 aPreviousTimecode, int64 aTimecodeScale) {
+			bPreviousTimecodeIsSet = true; 
+			PreviousTimecode = aPreviousTimecode;
+			SetGlobalTimecodeScale(aTimecodeScale);
+		}
+
+		/*!
+			\note dirty hack to get the mandatory data back after reading
+			\todo there should be a better way to get mandatory data
+		*/
+		void InitTimecode(uint64 aTimecode, int64 aTimecodeScale) {
+			SetGlobalTimecodeScale(aTimecodeScale);
+			MinTimecode = MaxTimecode = PreviousTimecode = aTimecode * TimecodeScale;
+			bFirstFrameInside = bPreviousTimecodeIsSet = true;
+		}
+
+		int16 GetBlockLocalTimecode(uint64 GlobalTimecode) const;
+
+		uint64 GetBlockGlobalTimecode(int16 LocalTimecode);
+
+		void SetGlobalTimecodeScale(uint64 aGlobalTimecodeScale) {
+			TimecodeScale = aGlobalTimecodeScale;
+			bTimecodeScaleIsSet = true;
+		}
+		uint64 GlobalTimecodeScale() const {
+			assert(bTimecodeScaleIsSet); 
+			return TimecodeScale;
+		}
+
+		bool SetSilentTrackUsed()
+		{
+			bSilentTracksUsed = true;
+			return FindFirstElt(KaxClusterSilentTracks::ClassInfos, true) != NULL;
+		}
+
+	protected:
+		KaxBlockGroup    * currentNewBlock;
+		const KaxSegment * ParentSegment;
+
+		uint64 MinTimecode, MaxTimecode, PreviousTimecode;
+		int64  TimecodeScale;
+
+		bool bFirstFrameInside; // used to speed research
+		bool bPreviousTimecodeIsSet;
+		bool bTimecodeScaleIsSet;
+		bool bSilentTracksUsed;
+
+		/*!
+			\note method used internally
+		*/
+		bool AddFrameInternal(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, const KaxBlockGroup * PastBlock, const KaxBlockGroup * ForwBlock, LacingType lacing);
+
+};
+
+END_LIBMATROSKA_NAMESPACE
+
+#endif // LIBMATROSKA_CLUSTER_H


Property changes on: trunk/libmatroska/matroska/KaxCluster.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxClusterData.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxConfig.h
===================================================================
--- trunk/libmatroska/matroska/KaxConfig.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxConfig.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -3,7 +3,7 @@
 **
 ** <file/class description>
 **
-** Copyright (C) 2002-2004 Steve Lhomme.  All rights reserved.
+** Copyright (C) 2002-2005 Steve Lhomme.  All rights reserved.
 **
 ** This library is free software; you can redistribute it and/or
 ** modify it under the terms of the GNU Lesser General Public


Property changes on: trunk/libmatroska/matroska/KaxConfig.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxContentEncoding.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxContexts.h
===================================================================
--- trunk/libmatroska/matroska/KaxContexts.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxContexts.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -1,87 +1,87 @@
-/****************************************************************************
-** libmatroska : parse Matroska files, see http://www.matroska.org/
-**
-** <file/class description>
-**
-** Copyright (C) 2002-2004 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 [email protected] if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-
-/*!
-	\file
-	\version \$Id: KaxContexts.h,v 1.6 2004/04/14 23:26:17 robux4 Exp $
-	\author Steve Lhomme     <robux4 @ users.sf.net>
-*/
-#ifndef LIBMATROSKA_CONTEXTS_H
-#define LIBMATROSKA_CONTEXTS_H
-
-#include "matroska/KaxTypes.h"
-#include "ebml/EbmlElement.h"
-
-using namespace LIBEBML_NAMESPACE;
-
-START_LIBMATROSKA_NAMESPACE
-
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxMatroska_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxSegment_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxAttachments_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxAttached_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileDescription_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileName_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxMimeType_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileData_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxChapters_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCluster_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTags_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTag_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxBlockGroup_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferencePriority_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferenceBlock_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferenceVirtual_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCues_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxInfo_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxSeekHead_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTracks_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackEntry_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackNumber_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackType_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagEnabled_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagDefault_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagLacing_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackName_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackLanguage_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecID_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecPrivate_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecName_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecSettings_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecInfoURL_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecDownloadURL_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecDecodeAll_Context;
-extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackOverlay_Context;
-
-extern const EbmlSemanticContext & MATROSKA_DLL_API GetKaxGlobal_Context();
-extern const EbmlSemanticContext & MATROSKA_DLL_API GetKaxTagsGlobal_Context();
-
-END_LIBMATROSKA_NAMESPACE
-
-#endif // LIBMATROSKA_CONTEXTS_H
+/****************************************************************************
+** libmatroska : parse Matroska files, see http://www.matroska.org/
+**
+** <file/class description>
+**
+** Copyright (C) 2002-2004 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 [email protected] if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+/*!
+	\file
+	\version \$Id: KaxContexts.h,v 1.6 2004/04/14 23:26:17 robux4 Exp $
+	\author Steve Lhomme     <robux4 @ users.sf.net>
+*/
+#ifndef LIBMATROSKA_CONTEXTS_H
+#define LIBMATROSKA_CONTEXTS_H
+
+#include "matroska/KaxTypes.h"
+#include "ebml/EbmlElement.h"
+
+using namespace LIBEBML_NAMESPACE;
+
+START_LIBMATROSKA_NAMESPACE
+
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxMatroska_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxSegment_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxAttachments_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxAttached_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileDescription_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileName_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxMimeType_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxFileData_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxChapters_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCluster_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTags_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTag_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxBlockGroup_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferencePriority_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferenceBlock_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxReferenceVirtual_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCues_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxInfo_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxSeekHead_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTracks_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackEntry_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackNumber_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackType_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagEnabled_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagDefault_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackFlagLacing_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackName_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackLanguage_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecID_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecPrivate_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecName_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecSettings_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecInfoURL_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecDownloadURL_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxCodecDecodeAll_Context;
+extern const EbmlSemanticContext MATROSKA_DLL_API KaxTrackOverlay_Context;
+
+extern const EbmlSemanticContext & MATROSKA_DLL_API GetKaxGlobal_Context();
+extern const EbmlSemanticContext & MATROSKA_DLL_API GetKaxTagsGlobal_Context();
+
+END_LIBMATROSKA_NAMESPACE
+
+#endif // LIBMATROSKA_CONTEXTS_H


Property changes on: trunk/libmatroska/matroska/KaxContexts.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxCues.h
===================================================================
--- trunk/libmatroska/matroska/KaxCues.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxCues.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -59,11 +59,13 @@
 		EbmlElement * Clone() const {return new KaxCues(*this);}
 
 		bool AddBlockGroup(const KaxBlockGroup & BlockReference);
+		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
@@ -86,7 +88,7 @@
 		}
 
 	protected:
-		std::vector<const KaxBlockGroup *> myTempReferences;
+		std::vector<const KaxBlockBlob *> myTempReferences;
 		bool   bGlobalTimecodeScaleIsSet;
 		uint64 mGlobalTimecodeScale;
 };


Property changes on: trunk/libmatroska/matroska/KaxCues.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxCuesData.h
===================================================================
--- trunk/libmatroska/matroska/KaxCuesData.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxCuesData.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -43,6 +43,7 @@
 
 class KaxBlockGroup;
 class KaxCueTrackPositions;
+class KaxInternalBlock;
 
 class MATROSKA_DLL_API KaxCuePoint : public EbmlMaster {
 	public:
@@ -54,6 +55,7 @@
 		operator const EbmlId &() const {return ClassInfos.GlobalId;}
 		EbmlElement * Clone() const {return new KaxCuePoint(*this);}
 		void PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale);
+		void PositionSet(const KaxInternalBlock & BlockReference, uint64 GlobalTimecodeScale);
 
 		bool operator<(const EbmlElement & EltB) const;
 


Property changes on: trunk/libmatroska/matroska/KaxCuesData.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxInfo.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxInfoData.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxSeekHead.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxSegment.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTagMulti.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTags.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTrackAudio.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTrackEntryData.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTrackVideo.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTracks.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/KaxTypes.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/matroska/KaxVersion.h
===================================================================
--- trunk/libmatroska/matroska/KaxVersion.h	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/matroska/KaxVersion.h	2005-10-09 14:18:56 UTC (rev 1216)
@@ -40,9 +40,9 @@
 
 START_LIBMATROSKA_NAMESPACE
 
-#define LIBMATROSKA_VERSION 0x000708
+#define LIBMATROSKA_VERSION 0x000800
 
-static const std::string KaxCodeVersion = "0.7.8";
+static const std::string KaxCodeVersion = "0.8.0";
 static const std::string KaxCodeDate    = __TIMESTAMP__;
 
 /*!


Property changes on: trunk/libmatroska/matroska/KaxVersion.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/c/libmatroska.h
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: trunk/libmatroska/matroska/c/libmatroska_t.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/libmatroska/src/KaxBlock.cpp
===================================================================
--- trunk/libmatroska/src/KaxBlock.cpp	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/src/KaxBlock.cpp	2005-10-09 14:18:56 UTC (rev 1216)
@@ -801,6 +801,12 @@
 	return ParentCluster->GetPosition();
 }
 
+uint64 KaxInternalBlock::ClusterPosition() const
+{
+	assert(ParentCluster != NULL); // impossible otherwise
+	return ParentCluster->GetPosition();
+}
+
 unsigned int KaxBlockGroup::ReferenceCount() const
 {
 	unsigned int Result = 0;
@@ -867,6 +873,17 @@
 	return true;
 }
 
+KaxBlockGroup::operator KaxInternalBlock &() {
+	KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+	return theBlock;
+}
+
+void KaxBlockGroup::SetParent(KaxCluster & aParentCluster) {
+	ParentCluster = &aParentCluster;
+	KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+	theBlock.SetParent( aParentCluster );
+}
+
 void KaxInternalBlock::SetParent(KaxCluster & aParentCluster)
 {
 	ParentCluster = &aParentCluster;
@@ -906,4 +923,70 @@
 	return _Result;
 }
 
+KaxBlockBlob::operator KaxBlockGroup &()
+{
+	assert(!bUseSimpleBlock);
+	assert(Block.group);
+	return *Block.group;
+}
+
+KaxBlockBlob::operator KaxInternalBlock &()
+{
+	assert(Block.group);
+	if (bUseSimpleBlock)
+		return *Block.simpleblock;
+	else
+		return *Block.group;
+}
+
+#if defined(MATROSKA_VERSION) && (MATROSKA_VERSION == 2)
+KaxBlockBlob::operator KaxSimpleBlock &()
+{
+	assert(bUseSimpleBlock);
+	assert(Block.simpleblock);
+	return *Block.simpleblock;
+}
+#endif
+
+bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock)
+{
+#if 0
+	if (bUseSimpleBlock)
+		if (Block.simpleblock->AddFrame(track, timecode, buffer, lacing)) {
+			Block.simpleblock->SetKeyframe(false);
+			Block.simpleblock->SetDiscardable(true);
+			return true;
+		} else
+			return false;
+	else
+		return Block.group->AddFrame(track, timecode, buffer, (KaxBlockGroup)*PastBlock, (KaxBlockGroup)*ForwBlock, lacing);
+#else
+	return false;
+#endif
+}
+
+void KaxBlockBlob::SetParent(KaxCluster & parent_clust)
+{
+	ParentCluster = &parent_clust;
+	// TODO: set the parent of the right type before using it 
+}
+
+void KaxBlockBlob::SetBlockDuration(uint64 TimeLength)
+{
+	ReplaceSimpleByGroup();
+	Block.group->SetBlockDuration(TimeLength);
+}
+
+void KaxBlockBlob::ReplaceSimpleByGroup()
+{
+	if (!bUseSimpleBlock)
+		return;
+}
+
+void KaxBlockBlob::SetBlockGroup( KaxBlockGroup &BlockRef )
+{
+	assert(!bUseSimpleBlock);
+	Block.group = &BlockRef;
+}
+
 END_LIBMATROSKA_NAMESPACE

Modified: trunk/libmatroska/src/KaxCues.cpp
===================================================================
--- trunk/libmatroska/src/KaxCues.cpp	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/src/KaxCues.cpp	2005-10-09 14:18:56 UTC (rev 1216)
@@ -59,10 +59,12 @@
 	assert(myTempReferences.size() == 0); // otherwise that means you have added references and forgot to set the position
 }
 
-bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockReference)
+bool KaxCues::AddBlockGroup(const KaxBlockGroup & BlockRef)
 {
 	// Do not add the element if it's already present.
-	std::vector<const KaxBlockGroup *>::iterator ListIdx;
+	std::vector<const KaxBlockBlob *>::iterator ListIdx;
+	KaxBlockBlob &BlockReference = *(new KaxBlockBlob(false));
+	BlockReference.SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));
 
 	for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
 		if (*ListIdx == &BlockReference)
@@ -72,22 +74,53 @@
 	return true;
 }
 
-void KaxCues::PositionSet(const KaxBlockGroup & BlockReference)
+bool KaxCues::AddBlockBlob(const KaxBlockBlob & BlockReference)
 {
+	// Do not add the element if it's already present.
+	std::vector<const KaxBlockBlob *>::iterator ListIdx;
+
+	for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++)
+		if (*ListIdx == &BlockReference)
+			return true;
+
+	myTempReferences.push_back(&BlockReference);
+	return true;
+}
+
+void KaxCues::PositionSet(const KaxBlockBlob & BlockReference)
+{
 	// look for the element in the temporary references
-	std::vector<const KaxBlockGroup *>::iterator ListIdx;
+	std::vector<const KaxBlockBlob *>::iterator ListIdx;
 
 	for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {
 		if (*ListIdx == &BlockReference) {
 			// found, now add the element to the entry list
 			KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
-			NewPoint.PositionSet(BlockReference, GlobalTimecodeScale());
+			NewPoint.PositionSet((KaxInternalBlock&)BlockReference, GlobalTimecodeScale());
 			myTempReferences.erase(ListIdx);
 			break;
 		}
 	}
 }
 
+void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)
+{
+	// look for the element in the temporary references
+	std::vector<const KaxBlockBlob *>::iterator ListIdx;
+	KaxBlockBlob &BlockReference = *(new KaxBlockBlob(false));
+	BlockReference.SetBlockGroup(*const_cast<KaxBlockGroup*>(&BlockRef));
+
+	for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ListIdx++) {
+		if (*ListIdx == &BlockReference) {
+			// found, now add the element to the entry list
+			KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
+			NewPoint.PositionSet((KaxInternalBlock&)BlockReference, GlobalTimecodeScale());
+			myTempReferences.erase(ListIdx);
+			break;
+		}
+	}
+}
+
 /*!
 	\warning Assume that the list has been sorted (Sort())
 */

Modified: trunk/libmatroska/src/KaxCuesData.cpp
===================================================================
--- trunk/libmatroska/src/KaxCuesData.cpp	2005-10-08 15:32:30 UTC (rev 1215)
+++ trunk/libmatroska/src/KaxCuesData.cpp	2005-10-09 14:18:56 UTC (rev 1216)
@@ -161,7 +161,34 @@
 	bValueIsSet = true;
 }
 
-#if MATROSKA_VERSION >= 2
+void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, uint64 GlobalTimecodeScale)
+{
+	// fill me
+	KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);
+	*static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
+
+	KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
+	KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
+	*static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNum();
+	
+	KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
+	*static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
+
+#if 0 // MATROSKA_VERSION >= 2
+	// handle reference use
+	if (BlockReference.ReferenceCount() != 0)
+	{
+		unsigned int i;
+		for (i=0; i<BlockReference.ReferenceCount(); i++) {
+			KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);
+			NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);
+		}
+	}
+#endif // MATROSKA_VERSION
+
+	bValueIsSet = true;
+}
+
 /*!
 	\todo handle codec state checking
 */
@@ -184,7 +211,6 @@
 	}
 #endif /* OLD */
 }
-#endif // MATROSKA_VERSION
 
 bool KaxCuePoint::operator<(const EbmlElement & EltB) const
 {