From 29b9887faa9a8bc4ccdf5c4dfdb4d70d742f68ca Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 19 Jan 2009 11:38:20 +0100 Subject: [PATCH] first draft of a Dummy-Player service --- SConstruct | 2 +- doc/devel/draw/PlayerArch-1.svg | 276 ++++++++++++++++++------------ src/include/dummy-player-facade.h | 119 +++++++++++++ src/proc/dummy-player-service.cpp | 85 +++++++++ src/proc/dummy-player-service.hpp | 92 ++++++++++ 5 files changed, 463 insertions(+), 111 deletions(-) create mode 100644 src/include/dummy-player-facade.h create mode 100644 src/proc/dummy-player-service.cpp create mode 100644 src/proc/dummy-player-service.hpp diff --git a/SConstruct b/SConstruct index dc0f76864..7a1aa2592 100644 --- a/SConstruct +++ b/SConstruct @@ -257,7 +257,7 @@ def configurePlatform(env): if not conf.CheckPkgConfig('glibmm-2.4', '2.16'): problems.append('Unable to configure Lib glib--, exiting.') - if not conf.CheckPkgConfig('gthread-2.0', '2.12'): + if not conf.CheckPkgConfig('gthread-2.0', '2.12.4'): problems.append('Need gthread support lib for glib-- based thread handling.') if not conf.CheckPkgConfig('cairomm-1.0', 0.6): diff --git a/doc/devel/draw/PlayerArch-1.svg b/doc/devel/draw/PlayerArch-1.svg index 8e7b3f9b8..519d5317d 100644 --- a/doc/devel/draw/PlayerArch-1.svg +++ b/doc/devel/draw/PlayerArch-1.svg @@ -25,8 +25,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2" - inkscape:cx="466.20838" - inkscape:cy="425.69964" + inkscape:cx="346.20838" + inkscape:cy="304.01881" inkscape:document-units="px" inkscape:current-layer="svg2" inkscape:window-width="1668" @@ -145,18 +145,18 @@ id="rect4200" width="130.423" height="70.324265" - x="439.99997" - y="229.87326" /> + x="340" + y="260" /> + width="110.59406" + height="30.243902" + x="249.40594" + y="169.7561" /> Displayer - OutSink + x="260" + y="180" + style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">play thread put(Frame&) Display(facade) + y="143.5">PlaybackController - createProcess(...) + style="font-size:8px;font-style:oblique;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">start(...) OutputProcess + x="240" + y="410" + style="font-size:8px;font-style:oblique;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" + id="tspan2218">PlayProcess Player(facade) + y="263.5">Player (interface) openDisplayer(...) + sodipodi:role="line">start_playback_thread() uses + x="220" + y="290" + style="font-size:7px;font-style:oblique;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-opacity:1;font-family:Bitstream Vera Sans">yields Backend (or Proc?) + y="370">Proc (or Backend?) Displayer (Proxy) DisplayFacade (Proxy) - - C Language Interface of the GUI-Plugin + x="345.00003" + y="273.12677" + style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">PlayerFacade (Proxy) + d="M 110,290 L 210,290 L 270,390" + id="path3481" + sodipodi:nodetypes="ccc" /> actuallytalks to... - libCommon + x="480.00003" + y="280.12677">libCommon + + + PlayContext + PlayerService + + + + PlayContext + PlayContext + PlayContext + diff --git a/src/include/dummy-player-facade.h b/src/include/dummy-player-facade.h new file mode 100644 index 000000000..807f48393 --- /dev/null +++ b/src/include/dummy-player-facade.h @@ -0,0 +1,119 @@ +/* + DUMMY-PLAYER-FACADE.hpp - access point to a dummy test player + + Copyright (C) Lumiera.org + 2009, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + + +#ifndef PROC_INTERFACE_DUMMYPLAYER_H +#define PROC_INTERFACE_DUMMYPLAYER_H + + + +struct lumiera_playprocess_struct { }; +typedef struct lumiera_playprocess_struct lumiera_playprocess; +typedef lumiera_playprocess* LumieraPlayProcess; + + + + +#ifdef __cplusplus /* ============== C++ Interface ================= */ + +#include "common/subsys.hpp" +#include "include/interfaceproxy.hpp" + + + + +namespace proc { + + class PlayProcess; + + + /****************************************************************** + * Interface Proc-Layer (or maybe the backend?): + * Global access point for starting a dummy playback, generating + * some test image data for the GUI to display in a viewer window. + * + * This is a mockup service we created 1/2009 to collect some + * experiences regarding integration of the application layers. + * Lumiera is not yet able actually to deliver rendered video data. + * + */ + class DummyPlayer + { + public: + /** provide a descriptor for lumiera::AppState, + * wired accordingly to allow main to deal with + * the dummy player as independent subsystem. */ + static lumiera::Subsys& getDescriptor(); + + /** get an implementation instance of this service */ + static lumiera::facade::Accessor facade; + + + //////////////////TODO: define some dummy negotiation about size and framerate.... + + virtual PlayProcess& start() =0; + + virtual ~DummyPlayer(); + }; + + + /** + * Continuous playback process, which has been started with a specific + * output size, format and framerate. It is a handle to a calculation process, + * which is about to produce a stream of frames to be retrieved by calling + * the #getFrame function on this handle. + * + * @todo solve the lifecycle and ownership! + */ + class PlayProcess + : public LumieraPlayProcess + { + public: + virtual void pause(bool) =0; + virtual void* const getFrame() =0; + + virtual ~PlayProcess(); + }; + + +} // namespace proc + + + +extern "C" { +#endif /* =========================== CL Interface ===================== */ + + +#include "common/interface.h" + +LUMIERA_INTERFACE_DECLARE (lumieraorg_DummyPlayer, 0 + , LUMIERA_INTERFACE_SLOT (LumieraPlayProcess, startPlay,(void) ) + , LUMIERA_INTERFACE_SLOT (void, pausePlay,(LumieraPlayProcess, bool)) + , LUMIERA_INTERFACE_SLOT (void, terminate,(LumieraPlayProcess) ) + , LUMIERA_INTERFACE_SLOT (void *, getFrame, (LumieraPlayProcess) ) +); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/proc/dummy-player-service.cpp b/src/proc/dummy-player-service.cpp new file mode 100644 index 000000000..a728613af --- /dev/null +++ b/src/proc/dummy-player-service.cpp @@ -0,0 +1,85 @@ +/* + DummyPlayerService - access point and service implementing a dummy test player + + Copyright (C) Lumiera.org + 2009, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "proc/dummy-player-service.hpp" +#include "lib/singleton.hpp" + +#include + + +namespace proc { + + using std::string; + using lumiera::Subsys; + + class DummyPlayerSubsysDescriptor + : public Subsys + { + operator string () const { return "Engine"; } + + bool + shouldStart (lumiera::Option&) + { + TODO ("determine, if renderengine should be started"); + return false; + } + + bool + start (lumiera::Option&, Subsys::SigTerm termination) + { + UNIMPLEMENTED ("pull up renderengine and register shutdown hook"); + return false; + } + + void + triggerShutdown () throw() + { + UNIMPLEMENTED ("initiate halting the engine"); + } + + bool + checkRunningState () throw() + { + //Lock guard (*this); + TODO ("implement detecting running state"); + return false; + } + }; + + namespace { + lumiera::Singleton theDescriptor; + } + + + + + /** @internal intended for use by main(). */ + Subsys& + DummyPlayer::getDescriptor() + { + return theDescriptor(); + } + + + +} // namespace proc diff --git a/src/proc/dummy-player-service.hpp b/src/proc/dummy-player-service.hpp new file mode 100644 index 000000000..76d06881a --- /dev/null +++ b/src/proc/dummy-player-service.hpp @@ -0,0 +1,92 @@ +/* + DUMMY-PLAYER-SERVICE.hpp - service implementing a dummy test player + + + Copyright (C) Lumiera.org + 2009, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file notification-service.hpp + ** A public service provided by the GUI, implementing the gui::GuiNotification facade interface. + ** The purpose of this service is to push state update and notification of events from the lower + ** layers into the Lumiera GUI. Typically, this happens asynchronously and triggered by events + ** within the lower layers. + ** + ** This service is the implementation of a layer separation facade interface. Clients should use + ** gui::GuiNotification#facade to access this service. This header defines the interface used + ** to \em provide this service, not to access it. + ** + ** @see gui::GuiFacade + ** @see guifacade.cpp starting this service + */ + + +#ifndef PROC_DUMMYPLAYER_SERVICE_H +#define PROC_DUMMYPLAYER_SERVICE_H + + +#include "include/dummy-player-facade.h" +#include "common/instancehandle.hpp" +#include "lib/singleton-ref.hpp" + + + +namespace proc { + + + + /****************************************************** + * Actual implementation of the GuiNotification service + * within the Lumiera GTK GUI. Creating an instance of + * this class automatically registers the interface + * with the Lumiera Interface/Plugin system and creates + * a forwarding proxy within the application core to + * route calls through this interface. + * + * @todo the ctor of this class should take references + * to any internal service providers within the + * GUI which are needed to implement the service. + */ + class DummyPlayerService + : public DummyPlayer + { + + /* === Implementation of the Facade Interface === */ + + void displayInfo (string const& text); + void triggerGuiShutdown (string const& cause); + + + /* === Interface Lifecycle === */ + + typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0) + , DummyPlayer + > ServiceInstanceHandle; + + lib::SingletonRef implInstance_; + ServiceInstanceHandle serviceInstance_; + + public: + DummyPlayerService(); + + }; + + + +} // namespace proc +#endif