[haiku-development] Re: GSoC for MediaKit

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 20 Mar 2009 11:29:27 +0100

Hi Chico,

>    I am a student from Graduate University of Chinese Academy of Sciences.
> My major is basic software. I love to know the detail of how the os and
> other software works. I have got an IBM certificate of linux in 2008. And
> I
> have developing experience on windows platform. I like to use c and java,
> especially c++ to programming. During 2007-2008, I was an intern of
> SDET(Software Develop Engineer in Test) in Microsoft ATC, and I also got
> choice to be a SDET FTE. I had developed Mini DBMS using c++ during my
> university life, and my job was designing and coding DBMS kernal and basic
> structures. I perfer to do some work in MediaKit, although I didn't have
> much experience in media programming and haiku os. It's a chanllege for
> me,
> and I love to know more.
>    Do you have any suggestions? Let me know. Thanks.

First of all, thank you for your interest in Haiku! Do you have Haiku already 
running in some form? Real hardware, some virtual machine?

To give you an overview: The MediaKit is composed of a client API (defined by 
BeOS) and the backend, which partly happens in the communication between 
several applications (client application communicates to media_server and 
media_addon_server). The main entry points for encoding media is through the 
BMediaFile and BMediaTrack API classes. These roughly correspond to managing 
container formats (AVI, MKV, MOV, ...) and codecs for media streams (RAW, XVID, 
MJPEG, ...). To get a good overview of the MediaKit C++ class framework, I 
suggest consuming the relevant parts of the BeBook developer documentation:

<http://www.haiku-os.org/legacy-docs/bebook/TheMediaKit_Overview.html>

and

<http://www.haiku-os.org/legacy-docs/bebook/TheMediaKit.html>

Of the class documentation, see especially

<http://www.haiku-os.org/legacy-docs/bebook/TheMediaKit_Functions.html>
<http://www.haiku-os.org/legacy-docs/bebook/BMediaFile.html>
<http://www.haiku-os.org/legacy-docs/bebook/BMediaTrack.html>

This is the API for which the backend needs to be implemented. Now, the 
important part to understand is that *decoding* media already has the 
implementation in the backend. The API to implementing media codecs on BeOS has 
always been private and only selected developers have received the 
documentation for implementing new plugins. The Haiku implementation defines an 
API for writing Reader and Decoder plugins:

<http://dev.haiku-os.org/browser/haiku/trunk/headers/private/media/MediaPlugin.h>
<http://dev.haiku-os.org/browser/haiku/trunk/headers/private/media/ReaderPlugin.h>
<http://dev.haiku-os.org/browser/haiku/trunk/headers/private/media/DecoderPlugin.h>

First of all, 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. What happens when a 
client application instantiates a BMediaFile, iterates over it's tracks to 
instantiate BMediaTrack objects and finally uses those to decode media buffers? 
A similar thing needs to happen for encoding, so first you need to be familiar 
to how things are done in decoding. An important thing to understand here is 
that the media_addon_server maintains a mapping of all known "media_format" 
definitions to plugins which implement decoding the respective format. It will 
try to keep the mapping up to date, ie when the user drops a new plugin in the 
right folder, the list of known formats and the mapping is updated (lazily). 
When a client application then requests decoding a certain format, t
 he media_addon_server will scan through it's list of known formats and find a 
respective plugin. The entry_ref for this plugin is passed back to the client 
application and is then used to open the plugin and instantiate the respective 
C++ objects in the backend.


In parallel to this, you should try to become familiar with our coding guide 
lines (which you will need to follow strictly), and you should try to get 
everything ready in terms of development environment, becoming familiar with 
our source tree structure... and such stuff. :-) For this we have various 
"getting started" type of documentation on our website.

Should have any questions, please don't hesitate to ask! :-) Also, please keep 
in mind that you may very well present better ideas for implementing the 
MediaKit backend. Specifically, I would personally welcome ideas that make it 
easier for Haiku to stay up-to-date with other open source media projects, if 
that is somehow possible. Regard the code you need to write for this project as 
a kind of "putting things together" type of work. Existing things -- on one 
hand the existing Be Media Kit API and on the other hand existing codec 
implementations, like those in the ffmpeg project -- need to be put together in 
an elegant and extensible way.

Best regards,
-Stephan




Other related posts: