[haiku-development] Re: RFC: Media plug-ins hybrid support

  • From: Marcus Overhagen <marcus.overhagen@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 2 Apr 2014 11:14:31 +0200

On Tue, Apr 1, 2014 at 3:04 PM, PulkoMandy <pulkomandy@xxxxxxxxx> wrote:

> * The media_server monitors the plugins directories. When a file is
> added, it instanciates the plugin in order to identify wether it is a
> decoder, encoder, reader or writer. 4 lists for these 4 kind of
> plugins are managed by the media_server.
This ensures that when developing, you can remove and add plugins
without restarting media server or applications. One of the strong
featurs of Haiku.

> * When an application wants to decode or encode a file, it gives the
> media_server a format information, and the media_server identifies and
> returns the matching plug-in, in the form of an entry_ref.
The application should give the server a hint about what kind of
hybrid plugin it needs, and the server should adjust the entry_ref to
that.
The hybrid builds are a hack anyway.


> * The application loads the plugin, instanciates it, and uses it for
> decoding (this is wrapped in Media Kit classes, BMediaFile and
> BMediaTrack).
> This is where things break for hybrid apps: the plugin returned is
> always for the primary architecture, and doesn't work on the secondary
> one.
Thats because nobody bothered to adjust media server and media kit
to actually care about hybrid platforms. It's not a design flaw.

> There are several ways to change this, but I'm not sure which is best,
> so I'd like more opinions.
>
> 1) Move everything application side.
> Besides the monitoring and caching, media_server never uses the
> plug-ins. So this could be moved to the application side (in the Media
> Kit). Each app could do the caching of format>plugin, possibly with a
> lazy initialization as formats are requested.
When you have many plugins, caching in the server is a great way
to reduce application load times. The single ffmpeg plugin is a
special situation.

> There could be a problem with all apps monitoring the plugins
> directories, but I'm not sure that's needed. It was important in the
> media_server to allow adding new formats without restarting the
> server, but restarting an app to get a new format (something that
> doesn't happen very often) sounds reasonable. Alternatively, the
> add-ons on disk could be re-scanned each time a request to find a
> plugin is made.
I don't like the concept. Having multiples applications running and
rescanning doesn't sound like the correct solution.
Restarting a application, for example the one responsible for system
sounds, or the one running a radio station, was never the design
goal of Haiku or BeOS.
Even restarting media server shouldn't normally be needed in Haiku
when doing something with add-ons or plugins, contrary to BeOS.
Anything that introduces a requirement to restart all applications
when adding or removing an media kit component should be avoided.
You also do not want to restart all applications just to use another font.

> I'll add that the current media_server code re-scans the plugin
> directories each time a request is made, to make sure that plugins
> stored in user directories are tried first, and system ones second.
This certainly should be improved.
I think there are multiple places in the media server where a complete
rescan is done instead of acutally changing what needs to be changed.
That was because I needed to get it running instead of wasting time
with premature optimization.

> One way to achieve this would be to have an hybrid-compiled part of
> the server running just for this purpose (as a separate team). The
> server would delegate all requests comming from hybrid apps to that.
The server would just have to correct the path to the entry_ref and
return a different one. Assuming that plugins compiled with a
different compiler provide the same formats, this approach should
simply work.

> What would you suggest?
See above.

regards
Marcus

Other related posts: