Commit f5607b71 authored by Steve Lhomme's avatar Steve Lhomme

mkclean: fix a bug in the segment size when a placeholder was added for later tag reference

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@443 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent 8473ff35
......@@ -836,6 +836,9 @@ err_t MATROSKA_MetaSeekUpdate(matroska_seekpoint *MetaSeek)
err_t Err;
uint8_t IdBuffer[4];
if (Node_IsPartOf(MetaSeek,EBML_VOID_CLASS))
return ERR_NONE;
assert(MetaSeek->Base.Context->Id == MATROSKA_ContextSeek.Id);
RSegment = EBML_ElementParent(MetaSeek);
while (RSegment && RSegment->Context->Id != MATROSKA_ContextSegment.Id)
......
2010-07-xx
2010-07-19
version 0.4.3:
- fix a bug in the segment size when a placeholder was added for later tag reference
- reject files that don't have an EBML header
- add --help and --version CLI options
......
......@@ -2101,7 +2101,24 @@ int main(int argc, const char *argv[])
Stream_Seek(Output,WMetaSeek->ElementPosition,SEEK_SET);
MetaSeekUpdate(WMetaSeek);
if (WSeekPointTags)
NodeTree_SetParent(WSeekPointTags,NULL,NULL); // remove the fake tags pointer
{
filepos_t SeekPointSize;
ebml_element *Void;
// remove the fake tags pointer and replace by a void of the same size
NodeTree_SetParent(WSeekPointTags,NULL,NULL);
// write a Void element the size of WSeekPointTags
SeekPointSize = EBML_ElementFullSize((ebml_element*)WSeekPointTags, 0);
Void = EBML_ElementCreate(WSeekPointTags,&EBML_ContextEbmlVoid,1,NULL);
EBML_VoidSetSize(Void, SeekPointSize - 1 - EBML_CodedSizeLength(SeekPointSize,0,1));
EBML_MasterAppend(WMetaSeek,Void);
NodeDelete((node*)WSeekPointTags);
WSeekPointTags = NULL;
NodeDelete((node*)RTags);
RTags = NULL;
}
EBML_ElementFullSize(WMetaSeek,0);
if (EBML_ElementRender(WMetaSeek,Output,0,0,1,&MetaSeekBefore,0)!=ERR_NONE)
......@@ -2111,25 +2128,6 @@ int main(int argc, const char *argv[])
goto exit;
}
SegmentSize += EBML_ElementFullSize(WMetaSeek,0);
if (WSeekPointTags)
{
// write a Void element the size of WSeekPointTags
filepos_t SeekPointSize = EBML_ElementFullSize((ebml_element*)WSeekPointTags, 0);
ebml_element * Void = EBML_ElementCreate(WSeekPointTags,&EBML_ContextEbmlVoid,1,NULL);
EBML_VoidSetSize(Void, SeekPointSize - 1 - EBML_CodedSizeLength(SeekPointSize,0,1));
if (EBML_ElementRender(Void,Output,0,0,1,NULL,0)!=ERR_NONE)
{
TextWrite(StdErr,T("Failed to write the tag placeholder in Seek Head\r\n"));
Result = -24;
goto exit;
}
SegmentSize += EBML_ElementFullSize(Void,0);
NodeDelete((node*)WSeekPointTags);
WSeekPointTags = NULL;
NodeDelete((node*)RTags);
RTags = NULL;
NodeDelete((node*)Void);
}
}
else if (!Unsafe)
SetClusterPrevSize(Clusters);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment