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

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2005-04-05 16:02:58 +0400 (Tue, 05 Apr 2005)
New Revision: 1115

Modified:
   trunk/libmatroska/matroska/KaxBlock.h
   trunk/libmatroska/src/KaxBlock.cpp
Log:
libmatroska: add support for the invisible flag

Modified: trunk/libmatroska/matroska/KaxBlock.h
===================================================================
--- trunk/libmatroska/matroska/KaxBlock.h	2005-04-03 07:03:55 UTC (rev 1114)
+++ trunk/libmatroska/matroska/KaxBlock.h	2005-04-05 12:02:58 UTC (rev 1115)
@@ -189,7 +189,7 @@
 
 class MATROSKA_DLL_API KaxBlock : public EbmlBinary {
 	public:
-		KaxBlock() :bLocalTimecodeUsed(false), mLacing(LACING_AUTO), ParentCluster(NULL) {}
+		KaxBlock() :bLocalTimecodeUsed(false), mLacing(LACING_AUTO), mInvisible(false), ParentCluster(NULL) {}
 		KaxBlock(const KaxBlock & ElementToClone);
 		~KaxBlock();
 		static EbmlElement & Create() {return *(new KaxBlock);}
@@ -219,7 +219,7 @@
 		unsigned int NumberFrames() const { return SizeList.size();}
 		DataBuffer & GetBuffer(unsigned int iIndex) {return *myBuffers[iIndex];}
 
-		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO);
+		bool AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing = LACING_AUTO, bool invisible = false);
 
 		/*!
 			\brief release all the frames of all Blocks
@@ -248,6 +248,8 @@
 			\note return -1 if the position doesn't exist
 		*/
 		int64 GetFrameSize(size_t FrameNumber = 0);
+		
+		bool IsInvisible() const { return mInvisible; }
 
 	protected:
 		std::vector<DataBuffer *> myBuffers;
@@ -257,6 +259,7 @@
 		bool       bLocalTimecodeUsed;
 		uint16     TrackNumber;
 		LacingType mLacing;
+		bool       mInvisible;
 		uint64     FirstFrameLocation;
 
 		uint32 RenderData(IOCallback & output, bool bForceRender, bool bSaveDefault = false);

Modified: trunk/libmatroska/src/KaxBlock.cpp
===================================================================
--- trunk/libmatroska/src/KaxBlock.cpp	2005-04-03 07:03:55 UTC (rev 1114)
+++ trunk/libmatroska/src/KaxBlock.cpp	2005-04-05 12:02:58 UTC (rev 1115)
@@ -179,13 +179,14 @@
 	\todo hardcoded limit of the number of frames in a lace should be a parameter
 	\return true if more frames can be added to this Block
 */
-bool KaxBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing)
+bool KaxBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing, bool invisible)
 {
 	bValueIsSet = true;
 	if (myBuffers.size() == 0) {
 		// first frame
 		Timecode = timecode;
 		TrackNumber = track.TrackNumber();
+		mInvisible = invisible;
 		mLacing = lacing;
 	}
 	myBuffers.push_back(&buffer);
@@ -360,16 +361,21 @@
 			mLacing = GetBestLacingType();
 		}
 
+		// invisible flag
+		if (mInvisible)
+			*cursor = 0x08;
+		
+		// lacing flag
 		switch (mLacing)
 		{
 		case LACING_XIPH:
-			*cursor++ |= 0x2;
+			*cursor++ |= 0x02;
 			break;
 		case LACING_EBML:
-			*cursor++ |= 0x6;
+			*cursor++ |= 0x06;
 			break;
 		case LACING_FIXED:
-			*cursor++ |= 0x4;
+			*cursor++ |= 0x04;
 			break;
 		case LACING_NONE:
 			break;
@@ -520,6 +526,7 @@
 		bLocalTimecodeUsed = true;
 		cursor += 2;
 
+		mInvisible = (*cursor & 0x08) >> 3;
 		mLacing = LacingType((*cursor++ & 0x06) >> 1);
 
 		// put all Frames in the list
@@ -622,6 +629,7 @@
 		bLocalTimecodeUsed = true;
 		cursor += 2;
 
+		mInvisible = (*cursor & 0x08) >> 3;
 		mLacing = LacingType((*cursor++ & 0x06) >> 1);
 		if (cursor == &_TempHead[4])
 		{
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.