2011-06-18 03:34:27 +02:00
|
|
|
/*
|
|
|
|
|
OUTPUT-SLOT.hpp - capability to transfer data to a physical output
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2011, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
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 output-slot.hpp
|
|
|
|
|
** An (abstract) capability to send media data to an external output.
|
|
|
|
|
** OutputSlot is the central metaphor for the organisation of actual (system level) outputs;
|
|
|
|
|
** using this concept allows to separate and abstract the data calculation and the organisation
|
|
|
|
|
** of playback and rendering from the specifics of the actual output sink. Actual output
|
|
|
|
|
** possibilities can be added and removed dynamically from various components (backend, GUI),
|
|
|
|
|
** all using the same resolution and mapping mechanisms
|
|
|
|
|
**
|
2011-07-09 02:44:24 +02:00
|
|
|
** @see diagnostic-output-slot.hpp ////TODO
|
2011-06-18 03:34:27 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PROC_PLAY_OUTPUT_SLOT_H
|
|
|
|
|
#define PROC_PLAY_OUTPUT_SLOT_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "lib/error.hpp"
|
|
|
|
|
#include "lib/handle.hpp"
|
2011-11-08 02:59:56 +01:00
|
|
|
#include "lib/time/timevalue.hpp"
|
2011-07-09 02:17:37 +02:00
|
|
|
#include "proc/engine/buffer-provider.hpp"
|
2011-08-15 00:52:56 +02:00
|
|
|
#include "proc/play/timings.hpp"
|
2011-06-22 02:42:50 +02:00
|
|
|
#include "lib/iter-source.hpp"
|
2011-06-18 03:34:27 +02:00
|
|
|
//#include "lib/sync.hpp"
|
|
|
|
|
|
|
|
|
|
#include <boost/noncopyable.hpp>
|
2011-11-05 16:51:24 +01:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2011-06-18 03:34:27 +02:00
|
|
|
//#include <string>
|
|
|
|
|
//#include <vector>
|
|
|
|
|
//#include <tr1/memory>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace proc {
|
|
|
|
|
namespace play {
|
2011-06-21 04:24:01 +02:00
|
|
|
|
2011-12-02 16:10:03 +01:00
|
|
|
using proc::engine::BuffHandle;
|
|
|
|
|
using proc::engine::BufferProvider;
|
2011-11-08 02:59:56 +01:00
|
|
|
using lib::time::TimeValue;
|
2011-06-18 03:34:27 +02:00
|
|
|
//using std::string;
|
2011-06-21 04:24:01 +02:00
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
//using std::vector;
|
|
|
|
|
//using std::tr1::shared_ptr;
|
2011-11-05 16:51:24 +01:00
|
|
|
using boost::scoped_ptr;
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
class DataSink;
|
2011-06-18 03:34:27 +02:00
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
typedef int64_t FrameID;
|
2011-06-18 03:34:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
|
* Interface: Generic output sink.
|
|
|
|
|
*
|
|
|
|
|
* @todo write type comment
|
|
|
|
|
*/
|
|
|
|
|
class OutputSlot
|
|
|
|
|
: boost::noncopyable
|
|
|
|
|
{
|
2011-11-06 02:37:22 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2011-12-08 23:02:19 +01:00
|
|
|
/** active connections through this OutputSlot */
|
2011-11-06 02:37:22 +01:00
|
|
|
class ConnectionState;
|
|
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
scoped_ptr<ConnectionState> state_;
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
virtual ConnectionState* buildState() =0;
|
|
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
public:
|
|
|
|
|
virtual ~OutputSlot();
|
|
|
|
|
|
2011-07-05 00:56:57 +02:00
|
|
|
typedef lib::IterSource<DataSink>::iterator OpenedSinks;
|
2011-06-22 02:42:50 +02:00
|
|
|
|
2011-11-05 16:51:24 +01:00
|
|
|
class Allocation
|
2011-06-22 02:42:50 +02:00
|
|
|
{
|
2011-11-05 16:51:24 +01:00
|
|
|
public:
|
|
|
|
|
virtual OpenedSinks getOpenedSinks() =0;
|
|
|
|
|
virtual bool isActive() =0;
|
2011-06-22 02:42:50 +02:00
|
|
|
|
|
|
|
|
/////TODO add here the getters for timing constraints
|
2011-11-05 16:51:24 +01:00
|
|
|
protected:
|
|
|
|
|
~Allocation();
|
2011-06-22 02:42:50 +02:00
|
|
|
};
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
/** established output channel */
|
|
|
|
|
class Connection;
|
2011-06-22 02:42:50 +02:00
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
|
|
|
|
|
/** can this OutputSlot be allocated? */
|
2011-06-22 02:42:50 +02:00
|
|
|
bool isFree() const;
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
/** claim this slot for exclusive use */
|
2011-11-05 16:51:24 +01:00
|
|
|
Allocation& allocate();
|
2011-06-22 02:42:50 +02:00
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
/** disconnect from this OutputSlot
|
|
|
|
|
* @warning may block until DataSinks are gone */
|
|
|
|
|
void disconnect();
|
2011-07-11 02:57:16 +02:00
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-06 02:37:22 +01:00
|
|
|
class DataSink
|
|
|
|
|
: public lib::Handle<OutputSlot::Connection>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
BuffHandle lockBufferFor(FrameID);
|
2011-11-08 02:59:56 +01:00
|
|
|
void emit(FrameID, BuffHandle const&, TimeValue currentTime = Time::MAX); ///////////////TICKET #855
|
2011-11-06 02:37:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-18 03:34:27 +02:00
|
|
|
}} // namespace proc::play
|
|
|
|
|
#endif
|