LUMIERA.clone/src/steam/facade.cpp

159 lines
4.5 KiB
C++
Raw Normal View History

/*
Facade - access point for communicating with the Steam-Interface
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
Copyright (C)
2008, Hermann Vosseler <Ichthyostega@web.de>
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
  **Lumiera** 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. See the file COPYING for further details.
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
* *****************************************************************/
/** @file facade.cpp
** Implementation of subsystem lifecycle behaviour for the core parts of Steam-Layer.
** - The »session subsystem« is responsible for accepting operations to work on the
** session datastructure, and it will trigger the Builder to reflect those changes
** into a suitable render nodes network
** - The »play out subsystem« is able to _perform_ such a render nodes network
** for video playback and rendering.
**
** lumiera::Subsys and lumiera::SubsystemRunner together define a protocol for some
** large scale building blocks of the whole application to be started and terminated.
** Typically this entails to create a dedicated thread to manage the top level concerns
** for the given subsystem, and to create registration and services for public access:
** - to operate on the session, use the steam::control::SessionCommand facade
** - playback and render operations can be operated by the lumiera::Play facade
**
** @see SteamDispatcher
** @see OutputDirector
** @see subsys.hpp
** @see main.cpp
**
*/
#include "steam/facade.hpp"
#include "lib/depend.hpp"
#include "steam/control/steam-dispatcher.hpp"
#include "steam/play/output-director.hpp"
#include <string>
namespace steam {
using std::string;
using std::unique_ptr;
using lumiera::Subsys;
using lumiera::Option;
using steam::control::SteamDispatcher;
class SessionSubsystem
: public Subsys
{
operator string() const { return "Session"; }
/** @remarks there is no need explicitly to start the session,
* since it is passive, waiting for invocations and will be
* pulled up as prerequisite of other subsystems. */
bool
shouldStart (Option&) override
{
return false;
}
bool
start (Option&, Subsys::SigTerm termNotification) override
{
return SteamDispatcher::instance().start (termNotification);
}
void
triggerShutdown() noexcept override
{
SteamDispatcher::instance().requestStop();
}
bool
checkRunningState() noexcept override
{
return SteamDispatcher::instance().isRunning();
}
};
2011-05-24 03:48:49 +02:00
class PlayOutSubsysDescriptor
: public Subsys
{
operator string() const { return "PlayOut"; }
2011-05-24 03:48:49 +02:00
/** determine, if any output system is required to start up explicitly.
* Moreover, extract configuration variations for specific kinds of output
* @return true if any output system is required to start stand-alone.
* otherwise, the player and a default configured output connection
* is pulled up only when required by another subsystem (e.g. GUI)
* @todo actually define cmdline options and parse/decide here!
*/
bool
shouldStart (Option&) override
2011-05-24 03:48:49 +02:00
{
TODO ("extract options about specific output systems to be brought up");
return false;
}
bool
start (Option&, Subsys::SigTerm termination) override
2011-05-24 03:48:49 +02:00
{
this->completedSignal_ = termination;
return play::OutputDirector::instance().connectUp();
2011-05-24 03:48:49 +02:00
}
SigTerm completedSignal_;
2011-05-24 03:48:49 +02:00
void
triggerShutdown() noexcept override
2011-05-24 03:48:49 +02:00
{
play::OutputDirector::instance().triggerDisconnect (completedSignal_);
2011-05-24 03:48:49 +02:00
}
2011-05-24 03:48:49 +02:00
bool
checkRunningState() noexcept override
2011-05-24 03:48:49 +02:00
{
return play::OutputDirector::instance().isOperational();
2011-05-24 03:48:49 +02:00
}
};
namespace {
lib::Depend<SessionSubsystem> theSessionSubsystemLifecycle;
lib::Depend<PlayOutSubsysDescriptor> thePlayOutDescriptor;
}
/** @internal intended for use by main(). */
Subsys&
Facade::getSessionDescriptor()
{
return theSessionSubsystemLifecycle();
}
2011-05-24 03:48:49 +02:00
/** @internal intended for use by main(). */
Subsys&
Facade::getPlayOutDescriptor()
{
return thePlayOutDescriptor();
}
} // namespace steam