Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: OSD: is it allowed to have multiple instances



Jouni Karvo wrote:
> 
> Klaus Schmidinger writes:
>  > > you could make the cOsd class a singleton. you are aware of this design
>  > > pattern, arn't you?
>  > >
>  > > best regards ...
>  > > clemens
>  >
>  > I guess that's what I was aiming at by suggesting to make
>  > cDvbOsdProvider::CreateOsd() return NULL in case another cOsd is
>  > requested before the previous one has been destroyed.
>  >
>  > Or is there something special about this? At least the C++ book
>  > doesn't mention it.
> 
> When using a singleton, the method returns a pointer to the existing
> instance if there is, and creates a new one if there is not.
> 
> For a reference, see the GOF book:
> Gamma, Helm, Johnson, Vlissides: Design Patterns

This would apply if an existing cOsd could be used by several callers.
But it must be assured that only the caller of the single cOsd that may
exist actually accesses it - any other caller would probably have different
ideas about thelocation and/or color depth.

So the way it will be is that cDvbOsdProvider::CreateOsd() returns NULL in
case another cOsd is requested before the previous one has been destroyed.
And this will also apply to other OSD implementations.

Besides, a Plugin shall only create an OSD at very distinct points in time.
Currently the problem some plugins still have is apparently that they can't
open an OSD "out of the blue". This will be changed so that a plugin will
be asked regularly (and frequently) whether it has something to display,
and then will be given full control over the OSD.

Klaus




Home | Main Index | Thread Index