[matroska] r1212 - in trunk/libmatroska: matroska src

[email protected] Sat, 8 Oct 2005 18:40:02 +0400 (MSD)
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2005-10-08 18:39:59 +0400 (Sat, 08 Oct 2005)
New Revision: 1212

Modified:
   trunk/libmatroska/matroska/KaxBlock.h
   trunk/libmatroska/src/KaxBlock.cpp
Log:
libmatroska: first attempt to write the new SimpleBlock bits correctly

Modified: trunk/libmatroska/matroska/KaxBlock.h
===================================================================
--- trunk/libmatroska/matroska/KaxBlock.h	2005-10-08 12:06:12 UTC (rev 1211)
+++ trunk/libmatroska/matroska/KaxBlock.h	2005-10-08 14:39:59 UTC (rev 1212)
@@ -192,7 +192,7 @@
 class KaxInternalBlock : public EbmlBinary {
 	public:
 		KaxInternalBlock( bool bSimple ) :bLocalTimecodeUsed(false), mLacing(LACING_AUTO), mInvisible(false)
-			,ParentCluster(NULL), bIsSimple(bSimple)
+			,ParentCluster(NULL), bIsSimple(bSimple), bIsKeyframe(true), bIsDiscardable(false)
 		{}
 		KaxInternalBlock(const KaxInternalBlock & ElementToClone);
 		~KaxInternalBlock();
@@ -264,6 +264,8 @@
 
 		KaxCluster * ParentCluster;
 		bool       bIsSimple;
+		bool       bIsKeyframe;
+		bool       bIsDiscardable;
 };
 
 class MATROSKA_DLL_API KaxBlock : public KaxInternalBlock {
@@ -284,6 +286,9 @@
 		operator const EbmlId &() const {return ClassInfos.GlobalId;}
 		const EbmlCallbacks & Generic() const {return ClassInfos;}
 		EbmlElement * Clone() const {return new KaxSimpleBlock(*this);}
+
+		void SetKeyframe(bool b_keyframe) { bIsKeyframe = b_keyframe; }
+		void SetDiscardable(bool b_discard) { bIsDiscardable = b_discard; }
 };
 
 class MATROSKA_DLL_API KaxBlockDuration : public EbmlUInteger {

Modified: trunk/libmatroska/src/KaxBlock.cpp
===================================================================
--- trunk/libmatroska/src/KaxBlock.cpp	2005-10-08 12:06:12 UTC (rev 1211)
+++ trunk/libmatroska/src/KaxBlock.cpp	2005-10-08 14:39:59 UTC (rev 1212)
@@ -367,6 +367,13 @@
 		// invisible flag
 		if (mInvisible)
 			*cursor = 0x08;
+
+		if (bIsSimple) {
+			if (bIsKeyframe)
+				*cursor |= 0x80;
+			if (bIsDiscardable)
+				*cursor |= 0x01;
+		}
 		
 		// lacing flag
 		switch (mLacing)