[haiku-development] Re: MediaPlayer and the Media Kit

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 29 Nov 2012 12:29:01 +0100

Hi Julian,

On 28.11.2012 23:07, Julian Harnath wrote:
* The hierarchy of PlaybackManager->NodeManager->Controller is a bit
unclear to me. While it's obvious, that NodeManager is there to control
the MediaKit graph, where is the distinction between what goes into
PlaybackManager and what goes into Controller? I suppose
PlaybackManager comes from eXposer, seeing all its special
functionality for frame-timing and similar things, which are never
actually used by MediaPlayer. The naming of methods between
PlaybackManager and Controller makes it a little confusing, e.g. there's
Controller::Play() and PlaybackManager::StartPlaying(), or Controller::
SetFramePosition() and PlaybackManager::SetCurrentFrame() etc... Can
someone (Stephan would be the person to ask I suppose) enlighten me on
the Controller/PlaybackManager distinction? Was PlaybackManager just
introduced to simplify using the other project's code or is there a
good reason to have it in MediaPlayer?

MediaPlayer does support single-stepping frames. But you are right, there is a lot of duplicated functionality, with non-consistent naming, in PlaybackManager and Controller. The reason is as you say. Controller was there first, then I've injected the framework from eXposer/Clockwerk. I've fixed some of the misleading naming, but not all. If you see a good way of cleaning this up and are motivated, please go ahead, don't regard the fact that some of this could be back-ported into eXposer/Clockwerk.

The main purpose of PlaybackManager is to synchronize Audio and Video. The technical challenge is the asynchronous nature in which seeking takes effect. That is why it maintains a queue of playback states that become active in the future.

The main purpose of NodeManager is to deal with actual media node setup and provide the timing information that PlaybackManager needs.

The main purpose of Controller is to provide an interface to the rest of MediaPlayer. Mostly to the window, but some other parts like the play list may use it. It also deals with the actual media source, i.e. the BMediaFile from the play list item and handles the setup of PlaybackManager. As such, you could view the overlap between PlaybackManager and Controller as Controller forwarding the (internal) PlaybackManager functionality to the outside. However, any misleading and inconsistent naming should be fixed.

* Is it ok to refactor/remove parts of MediaPlayer which duplicate
functionality that is already present in the Media Kit (as long as it
doesn't degrade performance)? Or is it better to keep it around to make
it possible to sync back the code to Clockwerk or other projects?

It could be better to ask here feature by feature. The performance impact could be an important factor in the decision case by case.

Best regards,
-Stephan


Other related posts: