[haiku-development] Re: GSoC for MediaKit

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 20 Mar 2009 17:33:38 +0100

chao chen schrieb:
Hi,
You said that," The Haiku implementation defines an API for writing Reader and Decoder plugins:". Can you show me some subclasses?

They are all in src/add-ons/media/plugins/ For example:

<http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/media/plugins/avcodec>

And you said "you should read enough in the BeBook documentation to get an overview of the client API that is related to decoding and encoding media files. Next, you should try to become familiar with the flow of the code between libmedia.so, media_server and media_addon_server." You mean that there are client-server structure.

In some respects, in some not. For Media Nodes, it is more like a client/server structure, where the media_server mainly manages cross-application communication, shared memory, notifications, and stuff like that. For encoding/decoding, the server only keeps track of what plugins there are and which formats they decode/encode. What I mean by "client application" is just "an application which uses the Media Kit API", ie libmedia.so and it's C++ classes. So for decoding, the C++ code in libmedia.so does communicate with the media_server and media_addon_server, but only to get an entry_ref (something like a file handle information) to the right plugin. Then the actual plug-in loading and object instantiation happens fully inside the client application and the server has nothing to do with it anymore.


And is there uml diagram to show the relationship among classes?

Unfortunately no, I don't believe so.

The client has encoder and decoder. I want to know where the ReaderPlugin.h DecodePlugin.h EncoderPlugin.h should be used?

See above, it's used only in those plugins, and some libmedia.so classes that directly deal with those plugins. I don't know off-hand which ones. But it should be easy to grep the code to get a first overview.

  Is the work stream like:
media_addon_server is like a backend service and montor the folder. If someone puts a new plugin in the folder, the media_addon_server will update its formats. Then client application starts, requests the information from media_server, and media_server gets the format from the media_addon_server, then media_server encode or decode the media and send the information to client?

For the most part, this is correct. The format for the current file is somehow constructed, I have forgotten how that is done. I don't remember if each decoder plugin is given a chance to identify the file, or if the format is constructed another way. I believe it's done another way and only those plugins get to look a the file which are potential candidates. (David/Marcus please correct me, if I am wrong.)

Anyways, the decoding the happens fully in the application, the servers are not involved in that anymore.


I didn't think clearly about this yellow part. Because the client has its encoder and decoder, the media_server only send the format to the client?

The client sends the format, the server tells it what plugin to use. You definitely need to look at the src/kits/media code to get the full picture and the most precise information.

Best regards,
-Stephan

Other related posts: