Revision df7510d...

Go back to digest for 1st September 2013

Other in Multimedia

Harald Sitter committed changes in [phonon/five] /:

RIP silly interface macros

Upon week-long pondering I came to realize that in order to replace
the existing interface casting mess we do not need anything fancy
or anything generic. Why, you ask? Because we have well defined
interfaces to use...

Let's first look at why we need multi-cast targets anyway. Interfaces
use virtual functions -> backends implement interfaces -> backends
implement virtuals -> adding stuff to the interface breaks binary
compatibility with the backends. In short: without using new interface
classes deriving the old interface class we'd only be able to support
backends that were compiled against the latest version of libphonon.
Since we do not want that we dervice new interfaces and then cast to one
or the other.

So what's new?
A backing object (i.e. the backend implementation of the interface) can
either be casted to an interface version or not. This attribute does
not change over time, so repeated casting attempts will not yield
different results. Consequently we can simply store a casted version
as member somewhere (FooInterface *interface;). This renders the macros
useless as they basically just contained multi-casting.

That doesn't handle different versions yet. So the revolutionary solution
here is to simply have different members per version :O.
> FooInterface *interface; // Base interface of 5.0
> FooInterface51 *interface51; // Interface additions from 5.1
This relies on one very basic assumption: new functions are added to
the interfaces because we use them and therefor know where and when to
use them. If void bar() is introduced as new function in 5.1 then the
frontend (libphonon) function that needs it will have to use interface51
This finally renders the Iface template class useless as it's only purpose
was to contain on the fly multi-target casting in order to find an
interface version that is actually supported by the backend object.
It was pointless effort considering the basic assumption from
above anyway.

Note: changing behavior is not supported, as such a change would be rubbish
anyway. For example void foo() in 5.0 painted a lion but in 5.1 it is
supposed to paint a cat. Technically that can be represented through
q_interfaces() but we really don't care for that.

File Changes

Modified 2 files
  •   phonon/mediaobject.cpp
  •   phonon/mediaobject_p.h
2 files changed in total