[Matroska-devel] copying/cloning/moving ebml elements
moritz at bunkus.org
Sat Jul 19 10:56:14 CEST 2003
for proper tag support I need some infrastructure regarding the Ebml*
thingies. Let's take the simple example that I read two Matroska files
and that both contain tags. Now I want to write the merged tags to the
new file, but I don't want two KaxTags but two KaxTag under a single
So what I need is:
1. I find the KaxTags in both files and Read() them. Now I have the tags
in memory in two variables, e.g. tags1 and tags2.
2. I create a destination KaxTags object, d_tags.
3. I copy all KaxTag children from tags1 into d_tags. Same for tags2.
4. I Render() d_tags into the output file.
This is the case of copying subtrees around. I also need to be able to
move a subtree from one EbmlMaster to another, e.g. move a KaxTag child
from tags1 to d_tags. The second case is different in that when I delete
tags1 and d_tags the subtree should of course only be deleted when I
delete the d_tags.
The 'moving' case seems to to be possible already if I understand
EbmlMaster.h correctly: The Remove() function can remove the KaxTag
child from the tags1 parent, and I can use PushElement to add the KaxTag
child to its new parent, d_tags. Is that correct?
But for copying we need proper copy ctors. I can easily write them for
EbmlString, EbmlUnicodeString, EbmlBinary, but not for EbmlMaster (at
least not easily). That's where I ask for your help ;)
==> Ciao, Mosu (Moritz Bunkus)
More information about the Matroska-devel