[openbeosmediakit] New BMediaFormats and friends

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: "OpenBeOS Media Kit" <openbeosmediakit@xxxxxxxxxxxxx>
  • Date: Fri, 23 Jan 2004 08:39:12 +0100 CET

Hi there,

I brought the BMediaFormats class into a usable state and reworked the 
decoder seek process.
Here is what I did:
- BMediaFormats is now completely implemented
- Reader::GetStreamInfo() must now call one of the BMediaFormats::Get*
FormatFor() calls to create the empty outFormat and do his changes 
based upon that - the outFormat will automatically have a valid 
encoding because of that.
- I moved MediaPlugin::RegisterPlugin() to 
DecoderPlugin::RegisterDecoder() (since only this class used it)
- The myDecoder::RegisterDecoder() implementation must call 
BMediaFormats::MakeFormatFor() to register the media_format_description 
for the decoder.
- There is quite some magic involved with MakeFormatFor() and I am not 
sure if we should keep it this way or not; basically, the AddOnManager 
who is responsible for calling Decoder::RegisterDecoder() installs a 
hook in the server local BMediaFormats class that will call it when 
MakeFormatFor() is called - the AddOnManager is locked during that 
time, so that there is no way to call the wrong hook (it's the same 
method Marcus used before for the DecoderPlugin)
- that hook not only calls FormatManager::RegisterDe/Encoder() to get a 
valid outFormat, it also stores the new format in the decoder_info
- these formats are used to implement GET_DECODER_FOR_FORMAT - and 
that's why the reader has to pass a registered format to this call
- the FormatManager manages the audio_encoding/video_encoding fields - 
when a codec calls MakeFormatFor(), it will assign a new ID to it
- I also fixed the == and < operators for media_format_description 
(didn't touch the B_OGG_FILE_FORMAT, though)
- BMediaFormats is now using one static list with all formats (for all 
existing BMediaFormats objects) - it is aware that the registered 
formats can change at any point, and it will try to update them before 
every call (they will only be updated if there were any changes, 
though)
- I added a BMessage based QueryServer() which the BMediaFormats class 
uses to update its local list copy
- the AddOnManager now scans B_USER_ADDONS_DIRECTORY, B_COMMON_*, and 
B_BEOS_*. Temporarily the OpenBeOS distro directory is also scanned (if 
it is under /boot/home/develop/openbeos/)
- I introduced a new Decoder::GetCodecInfo() that fills a 
media_codec_info structure
- I updated all existing decoder add-ons to the new API

What's left to do?
- I haven't yet checked if raw decoders work
- the ogg/vorbis/speex stuff doesn't work anymore - I hope that Andrew 
won't be too mad at me, but his current decoder detection mechanism was 
just broken; I've added "ToDo" items to the problematic lines; you just 
have to switch to a media_format_description based recognition
- there is no special Ogg-type reader support yet (I planned to let the 
codec decide if it can sniff or not)
- there is no loading/saving of settings (the FormatManager should use 
a user editable settings file)
- the FormatManager sends his replys in the server thread, and it 
shouldn't do this with a timeout > 0 (currently 5 secs) - the timeout 
should either be set to 0, or the task off-loaded to another thread

That might be all, but I probably forgot half of it :)
If you encounter any problems, please shout - the new version is now in 
CVS.

Bye,
   Axel.


Other related posts: