[matroska] r1224 - trunk/libmatroska/src
[email protected] Thu, 13 Oct 2005 23:33:25 +0400 (MSD)
| Newsgroups | gmane.comp.multimedia.matroska.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: robux4
Date: 2005-10-13 23:33:23 +0400 (Thu, 13 Oct 2005)
New Revision: 1224
Modified:
trunk/libmatroska/src/KaxBlock.cpp
trunk/libmatroska/src/KaxBlockData.cpp
Log:
libmatroska: fix writing in auto SimpleBlock mode
Modified: trunk/libmatroska/src/KaxBlock.cpp
===================================================================
--- trunk/libmatroska/src/KaxBlock.cpp 2005-10-12 22:18:07 UTC (rev 1223)
+++ trunk/libmatroska/src/KaxBlock.cpp 2005-10-13 19:33:23 UTC (rev 1224)
@@ -786,13 +786,19 @@
ParentTrack = &track;
bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
- KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
- thePastRef.SetReferencedBlock(PastBlock);
- thePastRef.SetParentBlock(*this);
+ if (PastBlock != NULL)
+ {
+ KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+ thePastRef.SetReferencedBlock(PastBlock);
+ thePastRef.SetParentBlock(*this);
+ }
- KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
- theFutureRef.SetReferencedBlock(ForwBlock);
- theFutureRef.SetParentBlock(*this);
+ if (ForwBlock != NULL)
+ {
+ KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
+ theFutureRef.SetReferencedBlock(ForwBlock);
+ theFutureRef.SetParentBlock(*this);
+ }
return bRes;
}
@@ -991,7 +997,6 @@
Block.simpleblock->SetDiscardable(ForwBlock != NULL);
} else {
if (ReplaceSimpleByGroup()) {
- Block.group->SetParent(*ParentCluster);
bResult = Block.group->AddFrame(track, timecode, buffer, PastBlock, ForwBlock, lacing);
}
}
@@ -1024,14 +1029,14 @@
if (Block.simpleblock != NULL) {
KaxSimpleBlock *old_simpleblock = Block.simpleblock;
Block.group = new KaxBlockGroup();
- Block.group->SetParent(*ParentCluster);
// _TODO_ : move all the data to the blockgroup
+ assert(false);
// -> while(frame) AddFrame(myBuffer)
delete old_simpleblock;
} else {
Block.group = new KaxBlockGroup();
- Block.group->SetParent(*ParentCluster);
}
+ Block.group->SetParent(*ParentCluster);
}
bUseSimpleBlock = false;
Modified: trunk/libmatroska/src/KaxBlockData.cpp
===================================================================
--- trunk/libmatroska/src/KaxBlockData.cpp 2005-10-12 22:18:07 UTC (rev 1223)
+++ trunk/libmatroska/src/KaxBlockData.cpp 2005-10-13 19:33:23 UTC (rev 1224)
@@ -120,7 +120,8 @@
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock)
{
- assert(aRefdBlock == NULL);
+ assert(RefdBlock == NULL);
+ assert(aRefdBlock != NULL);
RefdBlock = aRefdBlock;
bValueIsSet = true;
}