[matroska] r1236 - trunk/libmatroska/src

[email protected] Sun, 16 Oct 2005 17:06:09 +0400 (MSD)
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2005-10-16 17:06:07 +0400 (Sun, 16 Oct 2005)
New Revision: 1236

Modified:
   trunk/libmatroska/src/KaxBlock.cpp
Log:
libmatroska: set the discardable bit of SimpleBlock correctly

Modified: trunk/libmatroska/src/KaxBlock.cpp
===================================================================
--- trunk/libmatroska/src/KaxBlock.cpp	2005-10-16 10:28:52 UTC (rev 1235)
+++ trunk/libmatroska/src/KaxBlock.cpp	2005-10-16 13:06:07 UTC (rev 1236)
@@ -1009,8 +1009,17 @@
 		}
 
 		bResult = Block.simpleblock->AddFrame(track, timecode, buffer, lacing);
-		Block.simpleblock->SetKeyframe(PastBlock == NULL);
-		Block.simpleblock->SetDiscardable(ForwBlock != NULL);
+		if (PastBlock == NULL && ForwBlock == NULL) {
+			Block.simpleblock->SetKeyframe(true);
+			Block.simpleblock->SetDiscardable(false);
+		} else {
+			Block.simpleblock->SetKeyframe(false);
+			if ((ForwBlock == NULL || ((const KaxInternalBlock &)*ForwBlock).GlobalTimecode() <= timecode) &&
+				(PastBlock == NULL || ((const KaxInternalBlock &)*PastBlock).GlobalTimecode() <= timecode))
+				Block.simpleblock->SetDiscardable(false);
+			else
+				Block.simpleblock->SetDiscardable(true);
+		}
 	}
 	else
 #endif