[Matroska-devel] Hi, question about the MKV tags
moritz at bunkus.org
Wed Feb 16 13:36:25 CET 2011
On Wednesday 16 February 2011 13:25:34 Santiago Jimeno wrote:
> If Hastag (previous tag)
> If HasDelete
> Delete (2 locations)
> else if HasChanges
> if Size < = Old Size + padding
> Write + padding (2 locations)
> Write at end
> Else (No Tag)
> if HasChanges (New)
> Write at end
Sounds more or less reasonable. But:
> The code, if there is only Attachments, would be identical to the
> previous one. But now there are two separate blocks. You try to group
> them in combinations of two elements and to include them on outline
> above. The proportion grows in a geometric way.
Not really. A pragmatic approach would be:
1. Overwrite all existing elements you want to replace (tags &
attachments) with void elements
2. Overwrite all consecutive void elements with a single one occupying
the space the consecutive ones occupied before
3. For each element you want to write:
3.1. Look for a void element with enough space for the element. If found
replace void element with element to write & create new smaller void
3.2. If not found write new element at the end.
4. Update metaseek elements etc.
This may not result in 100% optimal files in any case, but like Steve
said that is not the goal. It will result in perfectly valid files
though. And it scales perfectly well with the number of elements you
need to write (e.g. if you decide to modify chapters as well for some
> I have not invented any problem. They were and are there.
From my point of view the problem you're having is that you insist on
creating optimal files. While being a noble goal it is not really
necessary at this stage.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: This is a digitally signed message part.
More information about the Matroska-devel