[matroska-general] Re: Message to the C porting team

Moritz Bunkus moritz at bunkus.org
Mon Feb 17 19:08:06 CET 2003


Hi.

> - what the best solution would be
>    * complete C port
>    * C wrapper
>    * basic C API

Complete C port, or at least all the stuff regarding READING a Matroska
file. As far as I can see I'd start with

 - a library that reads and decods EBML elements
 - then do the Matroska element decoding
 - code some EBML writing suppport
 - and at last the creation of Matroska elements

>From an API point of view I'm not quite certain how I'd design it.
Perhaps there could be a function 'find_next_ebml_element' which would
then return an ID (a simple uint32?) which denotes what kind of an
element that is? Then some functions 'element_to_uinteger',
'element_to_float', 'element_to_utf' and the likes.

One thing is really important: the library MUST NOT do its own file
handling! The current implementation does not do it either - well it
does somehow, but it uses an object derived from IOCallback so that the
user can implement his own file handling. Let the user hand over memory
to the library, and the library caches as much as it needs and returns
an error like ERROR_NEED_MORE_DATA_BEFORE_I_CAN_DECODE_THAT_ELEMENT (of
course you're free to chose something shorter ;)). I cannot stress this
enough. A _demultiplexer_ library is NOT supposed to do any I/O. That's
the stream layer's job. (Whether there is a complete stream layer or if
the application simply uses fread is not important.)

> and what parts of the current libmatroska you needed first to get a 
> mplayer plugin on the way ?

The first two parts: EBML reading/decoding, Matroska element
extraction.

> BTW, about a timeline for the porting : everything being within 8 weeks 
> from now would be fine for me ! Other opinions welcome ...

As I said, the creation part is NOT NEARLY as important. So don't waste
any time coding that, please, as I won't write a multiplexer for
mencoder (part of mplayer) in the near future. My own mktoolnix (tools
for creating Matroska files) are C++ themselves, so I don't the library
there either.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)
http://matroska.org




More information about the Matroska-general mailing list