[Matroska-devel] libmatroska's copy c'tors

Steve Lhomme steve.lhomme at free.fr
Wed Jan 14 22:29:06 CET 2004


Moritz Bunkus wrote:

> What I'm doing then is something like
>   KaxContentEncodings *copy = new KaxContentEncodings(*old_encodings);
>   copy->Render(*out);
> 
> And sure as hell I get an assertion about the mandatory elements
> missing. So could you please think about a way to avoid this? I think
> that you could modify the copy c'tor so that after the copy it'll
> iterate over all the children and create the mandatory elements if
> they're missing. This has to be done recursively for EbmlMaster
> children, of course.

An additional parameter for the copy constructor ?

At least there is the method ProcessMandatory() that will do what you 
want. Or almost because it doesn't check wether the element is already 
in the list or not. But that could be an added parameter.

Now about the copy constructor, it's best to keep it like that as it's a 
more consistant way of doing things in C++. Otherwise it wouldn't be a 
copy constructor.

So my suggestion would be to add a parameter to Render to be able to 
avoid checking for mandatory elements. That would also allow creating 
invalid files... So I think it's the way to go and I'm going to work on 
this.




More information about the Matroska-devel mailing list