stubs and adjustments to get it through the compiler
This commit is contained in:
parent
786ecbe829
commit
ae36b2d941
22 changed files with 474 additions and 510 deletions
|
|
@ -82,45 +82,43 @@
|
|||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
||||
/** error-ID for accessing a (currently) closed facade */
|
||||
LUMIERA_ERROR_DECLARE(FACADE_LIFECYCLE);
|
||||
namespace facade {
|
||||
|
||||
/** error-ID for accessing a (currently) closed facade */
|
||||
LUMIERA_ERROR_DECLARE(FACADE_LIFECYCLE);
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
*/
|
||||
template<class FA>
|
||||
class Accessor
|
||||
{
|
||||
protected:
|
||||
static FA* implProxy_;
|
||||
|
||||
|
||||
public:
|
||||
FA&
|
||||
operator() ()
|
||||
{
|
||||
if (implProxy_)
|
||||
return *implProxy_;
|
||||
else
|
||||
throw error::State("Facade interface currently closed.");
|
||||
}
|
||||
};
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
*/
|
||||
template<class FA>
|
||||
class Accessor
|
||||
{
|
||||
protected:
|
||||
static FA* implProxy_;
|
||||
|
||||
|
||||
public:
|
||||
FA&
|
||||
operator() ()
|
||||
{
|
||||
if (implProxy_)
|
||||
return *implProxy_;
|
||||
else
|
||||
throw error::State("Facade interface currently closed.");
|
||||
}
|
||||
};
|
||||
|
||||
template<class IHA>
|
||||
void openProxy (IHA const&);
|
||||
|
||||
template<class IHA>
|
||||
void closeProxy ();
|
||||
|
||||
template<class IHA>
|
||||
class Proxy;
|
||||
|
||||
|
||||
} // namespace facade
|
||||
template<class IHA>
|
||||
void openProxy (IHA const&);
|
||||
|
||||
} // namespace lumiera
|
||||
template<class IHA>
|
||||
void closeProxy ();
|
||||
|
||||
template<class IHA>
|
||||
class Proxy;
|
||||
|
||||
|
||||
}} // namespace lumiera::facade
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,14 +32,16 @@
|
|||
//#include "include/interfaceproxy.hpp"
|
||||
#include "lib/handle.hpp"
|
||||
#include "lib/iter-source.hpp"
|
||||
#include "lib/time/control.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
#include "include/interfaceproxy.hpp"
|
||||
#include "proc/mobject/model-port.hpp"
|
||||
#include "proc/mobject/output-designation.hpp"
|
||||
#include "proc/mobject/session/clip.hpp"
|
||||
#include "proc/mobject/session/track.hpp"
|
||||
#include "proc/play/output-manager.hpp"
|
||||
#include "asset/timeline.hpp"
|
||||
#include "asset/viewer.hpp"
|
||||
#include "proc/asset/timeline.hpp"
|
||||
#include "proc/asset/viewer.hpp"
|
||||
|
||||
|
||||
|
||||
|
|
@ -51,6 +53,8 @@ namespace proc {
|
|||
|
||||
|
||||
namespace lumiera {
|
||||
|
||||
namespace time = lib::time;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
|
|
@ -71,7 +75,7 @@ namespace lumiera {
|
|||
public:
|
||||
|
||||
/** get an implementation instance of this service */
|
||||
static lumiera::facade::Accessor<DummyPlayer> facade;
|
||||
static lumiera::facade::Accessor<Play> facade;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -96,9 +100,9 @@ namespace lumiera {
|
|||
void adjustSpeed(double); ///< playback speed control
|
||||
void go(lib::time::Time); ///< skip to the given point in time
|
||||
|
||||
void controlPlayhead (lib::time::TimeControl & ctrl);
|
||||
void controlDuration (lib::time::TimeControl & ctrl);
|
||||
void controlLooping (lib::time::TimeControl & ctrl);
|
||||
void controlPlayhead (time::Control<time::Time> & ctrl);
|
||||
void controlDuration (time::Control<time::Duration> & ctrl);
|
||||
void controlLooping (time::Control<time::TimeSpan> & ctrl);
|
||||
|
||||
void useProxyMedia (bool);
|
||||
void setQuality (uint);
|
||||
|
|
@ -131,7 +135,7 @@ namespace lumiera {
|
|||
Controller perform(Clip);
|
||||
|
||||
protected:
|
||||
virtual ~Player();
|
||||
virtual ~Play();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace typelist{
|
|||
|
||||
|
||||
template<class TYPES_1, class TYPES_2>
|
||||
class CartesianProduct
|
||||
struct CartesianProduct
|
||||
: Distribute< typename TYPES_1::List
|
||||
, typename TYPES_2::List
|
||||
>
|
||||
|
|
@ -60,8 +60,8 @@ namespace typelist{
|
|||
{
|
||||
template<class SUBLIST, class BASE>
|
||||
struct SingleCaseInstantiation
|
||||
: _X_< Pick<SUBLIST,0>::Type
|
||||
, Pick<SUBLIST,1>::Type
|
||||
: _X_< typename Pick<SUBLIST,0>::Type
|
||||
, typename Pick<SUBLIST,1>::Type
|
||||
, BASE
|
||||
>
|
||||
{ };
|
||||
|
|
@ -88,8 +88,8 @@ namespace typelist{
|
|||
, template<class,class,class> class _X_ ///< template with two arg types and a base type
|
||||
, class BASE = NullType
|
||||
>
|
||||
class InstantiateChainedCombinations
|
||||
: InstantiateChained< CartesianProduct<TYPES_1,TYPES_2>::List
|
||||
struct InstantiateChainedCombinations
|
||||
: InstantiateChained< typename CartesianProduct<TYPES_1,TYPES_2>::List
|
||||
, PickParametersFromSublist<_X_>::template SingleCaseInstantiation
|
||||
, BASE
|
||||
>
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ namespace lumiera {
|
|||
* @warning identical, not sub-type!
|
||||
*/
|
||||
template<typename T1, typename T2>
|
||||
class is_sameType
|
||||
struct is_sameType
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class is_sameType<T,T>
|
||||
struct is_sameType<T,T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ namespace time {
|
|||
|
||||
//LUMIERA_ERROR_DECLARE (INVALID_MUTATION); ///< Changing a time value in this way was not designated
|
||||
|
||||
typedef function<void(TI)> timeSignal;
|
||||
|
||||
/**
|
||||
* Interface: controller-element for retrieving and
|
||||
|
|
@ -91,10 +90,12 @@ namespace time {
|
|||
*/
|
||||
template<class TI>
|
||||
class Control
|
||||
: Mutation
|
||||
, timeSignal
|
||||
: public Mutation
|
||||
, public function<void(TI)>
|
||||
{
|
||||
public:
|
||||
typedef function<void(TI)> timeSignal;
|
||||
|
||||
/** install a callback functor to be invoked
|
||||
* to notify for any changes to the observed
|
||||
* time entity */
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@
|
|||
|
||||
namespace engine {
|
||||
|
||||
// using lib::time::TimeSpan;
|
||||
// using lib::time::FSecs;
|
||||
// using lib::time::Time;
|
||||
using lib::time::TimeSpan;
|
||||
using lib::time::FSecs;
|
||||
using lib::time::Time;
|
||||
//
|
||||
// class ExitNode;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
//#include "common/instancehandle.hpp"
|
||||
//#include "lib/singleton-ref.hpp"
|
||||
//
|
||||
//#include <boost/noncopyable.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#include <string>
|
||||
|
||||
|
|
@ -66,31 +66,23 @@ namespace play {
|
|||
: boost::noncopyable
|
||||
{
|
||||
|
||||
string error_;
|
||||
Subsys::SigTerm notifyTermination_;
|
||||
// string error_;
|
||||
// Subsys::SigTerm notifyTermination_;
|
||||
|
||||
|
||||
/* === Interface Lifecycle === */
|
||||
|
||||
typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0)
|
||||
, DummyPlayer
|
||||
> ServiceInstanceHandle;
|
||||
// typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0)
|
||||
// , DummyPlayer
|
||||
// > ServiceInstanceHandle;
|
||||
|
||||
lib::SingletonRef<DummyPlayerService> implInstance_;
|
||||
ServiceInstanceHandle serviceInstance_;
|
||||
// lib::SingletonRef<DummyPlayerService> implInstance_;
|
||||
// ServiceInstanceHandle serviceInstance_;
|
||||
|
||||
public:
|
||||
DummyPlayerService(Subsys::SigTerm terminationHandle);
|
||||
EngineService(); /////TODO (Subsys::SigTerm terminationHandle);
|
||||
|
||||
~DummyPlayerService() { notifyTermination_(&error_); }
|
||||
|
||||
|
||||
|
||||
/** conceptually, this serves as implementation
|
||||
* of the DummyPlayer#start() function. But because
|
||||
* this function sits \em behind the interface, it
|
||||
* just returns an impl pointer. */
|
||||
ProcessImpl* start (LumieraDisplaySlot viewerHandle);
|
||||
~EngineService() { } /////TODO notifyTermination_(&error_); }
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,149 +22,147 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
#include "proc/play/dummy-image-generator.hpp"
|
||||
#include "proc/engine/worker/dummy-image-generator.hpp"
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
|
||||
|
||||
namespace { // implementation details
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
inline int
|
||||
clamp (const int &val, const int &maxval, const int &minval)
|
||||
{
|
||||
if(val > maxval) return maxval;
|
||||
if(val < minval) return minval;
|
||||
return val;
|
||||
}
|
||||
|
||||
inline void
|
||||
rgb_to_yuv (int r, int g, int b, byte &y, byte &u, byte &v)
|
||||
{
|
||||
// This code isn't great, but it does the job
|
||||
y = (byte)clamp((299 * r + 587 * g + 114 * b) / 1000, 235, 16);
|
||||
v = (byte)clamp((500 * r - 419 * g - 81 * b) / 1000 + 127, 255, 0);
|
||||
u = (byte)clamp((-169 * r - 331 * g + 500 * b) / 1000 + 127, 255, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rgb_buffer_to_yuy2 (unsigned char *in, unsigned char *out)
|
||||
{
|
||||
for (uint i = 0; i < 320*240*2; i+=4)
|
||||
{
|
||||
byte y0, u0, v0;
|
||||
const byte r0 = *(in++);
|
||||
const byte g0 = *(in++);
|
||||
const byte b0 = *(in++);
|
||||
rgb_to_yuv(r0, g0, b0, y0, u0, v0);
|
||||
|
||||
byte y1, u1, v1;
|
||||
const byte r1 = *(in++);
|
||||
const byte g1 = *(in++);
|
||||
const byte b1 = *(in++);
|
||||
rgb_to_yuv(r1, g1, b1, y1, u1, v1);
|
||||
|
||||
out[i] = y0;
|
||||
out[i + 1] = u0;
|
||||
out[i + 2] = y1;
|
||||
out[i + 3] = v0;
|
||||
} }
|
||||
|
||||
|
||||
} // (End) implementation details
|
||||
|
||||
|
||||
|
||||
|
||||
DummyImageGenerator::DummyImageGenerator(uint fps)
|
||||
: current_(0)
|
||||
, frame_(0)
|
||||
, fps_(fps)
|
||||
{ }
|
||||
|
||||
|
||||
LumieraDisplayFrame
|
||||
DummyImageGenerator::next()
|
||||
{
|
||||
|
||||
++frame_;
|
||||
if(frame_ > 2 * fps_)
|
||||
frame_ = 0;
|
||||
|
||||
if(frame_ < 1 * fps_)
|
||||
{
|
||||
// create random snow...
|
||||
for(int i = 0; i < 320*240*3; i+=3)
|
||||
{
|
||||
byte value ( rand() );
|
||||
buf_[i] = value;
|
||||
buf_[i+1] = value;
|
||||
buf_[i+2] = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // create a colour strip pattern
|
||||
typedef unsigned char Row[320 * 3];
|
||||
|
||||
unsigned char * row = buf_;
|
||||
|
||||
// create a colour strip pattern in the first row...
|
||||
for(int x = 0; x < 320; ++x)
|
||||
{
|
||||
byte &r = row[x*3];
|
||||
byte &g = row[x*3+1];
|
||||
byte &b = row[x*3+2];
|
||||
|
||||
if (x < 1*320/7) r = 0xC0, g = 0xC0, b = 0xC0;
|
||||
else if(x < 2*320/7) r = 0xC0, g = 0xC0, b = 0x00;
|
||||
else if(x < 3*320/7) r = 0x00, g = 0xC0, b = 0xC0;
|
||||
else if(x < 4*320/7) r = 0x00, g = 0xC0, b = 0x00;
|
||||
else if(x < 5*320/7) r = 0xC0, g = 0x00, b = 0xC0;
|
||||
else if(x < 6*320/7) r = 0xC0, g = 0x00, b = 0x00;
|
||||
else r = 0x00, g = 0x00, b = 0xC0;
|
||||
}
|
||||
|
||||
// fill remaining rows of the frame with the same pattern
|
||||
for(int y = 1; y < 240; ++y)
|
||||
memcpy(buf_ + y*sizeof(Row), row, sizeof(Row));
|
||||
|
||||
}
|
||||
|
||||
// select output buffer to return
|
||||
LumieraDisplayFrame outBuff;
|
||||
|
||||
if (!current_)
|
||||
{
|
||||
outBuff = outFrame_A_;
|
||||
current_= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
outBuff = outFrame_B_;
|
||||
current_= 0;
|
||||
}
|
||||
|
||||
rgb_buffer_to_yuy2(buf_, outBuff);
|
||||
return outBuff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
LumieraDisplayFrame
|
||||
DummyImageGenerator::current()
|
||||
{
|
||||
if (!current_) return outFrame_A_;
|
||||
else return outFrame_B_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace play
|
||||
namespace node {
|
||||
|
||||
} // namespace proc
|
||||
|
||||
|
||||
namespace { // implementation details
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
inline int
|
||||
clamp (const int &val, const int &maxval, const int &minval)
|
||||
{
|
||||
if(val > maxval) return maxval;
|
||||
if(val < minval) return minval;
|
||||
return val;
|
||||
}
|
||||
|
||||
inline void
|
||||
rgb_to_yuv (int r, int g, int b, byte &y, byte &u, byte &v)
|
||||
{
|
||||
// This code isn't great, but it does the job
|
||||
y = (byte)clamp((299 * r + 587 * g + 114 * b) / 1000, 235, 16);
|
||||
v = (byte)clamp((500 * r - 419 * g - 81 * b) / 1000 + 127, 255, 0);
|
||||
u = (byte)clamp((-169 * r - 331 * g + 500 * b) / 1000 + 127, 255, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rgb_buffer_to_yuy2 (unsigned char *in, unsigned char *out)
|
||||
{
|
||||
for (uint i = 0; i < 320*240*2; i+=4)
|
||||
{
|
||||
byte y0, u0, v0;
|
||||
const byte r0 = *(in++);
|
||||
const byte g0 = *(in++);
|
||||
const byte b0 = *(in++);
|
||||
rgb_to_yuv(r0, g0, b0, y0, u0, v0);
|
||||
|
||||
byte y1, u1, v1;
|
||||
const byte r1 = *(in++);
|
||||
const byte g1 = *(in++);
|
||||
const byte b1 = *(in++);
|
||||
rgb_to_yuv(r1, g1, b1, y1, u1, v1);
|
||||
|
||||
out[i] = y0;
|
||||
out[i + 1] = u0;
|
||||
out[i + 2] = y1;
|
||||
out[i + 3] = v0;
|
||||
} }
|
||||
|
||||
|
||||
} // (End) implementation details
|
||||
|
||||
|
||||
|
||||
|
||||
DummyImageGenerator::DummyImageGenerator(uint fps)
|
||||
: current_(0)
|
||||
, frame_(0)
|
||||
, fps_(fps)
|
||||
{ }
|
||||
|
||||
|
||||
LumieraDisplayFrame
|
||||
DummyImageGenerator::next()
|
||||
{
|
||||
|
||||
++frame_;
|
||||
if(frame_ > 2 * fps_)
|
||||
frame_ = 0;
|
||||
|
||||
if(frame_ < 1 * fps_)
|
||||
{
|
||||
// create random snow...
|
||||
for(int i = 0; i < 320*240*3; i+=3)
|
||||
{
|
||||
byte value ( rand() );
|
||||
buf_[i] = value;
|
||||
buf_[i+1] = value;
|
||||
buf_[i+2] = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // create a colour strip pattern
|
||||
typedef unsigned char Row[320 * 3];
|
||||
|
||||
unsigned char * row = buf_;
|
||||
|
||||
// create a colour strip pattern in the first row...
|
||||
for(int x = 0; x < 320; ++x)
|
||||
{
|
||||
byte &r = row[x*3];
|
||||
byte &g = row[x*3+1];
|
||||
byte &b = row[x*3+2];
|
||||
|
||||
if (x < 1*320/7) r = 0xC0, g = 0xC0, b = 0xC0;
|
||||
else if(x < 2*320/7) r = 0xC0, g = 0xC0, b = 0x00;
|
||||
else if(x < 3*320/7) r = 0x00, g = 0xC0, b = 0xC0;
|
||||
else if(x < 4*320/7) r = 0x00, g = 0xC0, b = 0x00;
|
||||
else if(x < 5*320/7) r = 0xC0, g = 0x00, b = 0xC0;
|
||||
else if(x < 6*320/7) r = 0xC0, g = 0x00, b = 0x00;
|
||||
else r = 0x00, g = 0x00, b = 0xC0;
|
||||
}
|
||||
|
||||
// fill remaining rows of the frame with the same pattern
|
||||
for(int y = 1; y < 240; ++y)
|
||||
memcpy(buf_ + y*sizeof(Row), row, sizeof(Row));
|
||||
|
||||
}
|
||||
|
||||
// select output buffer to return
|
||||
LumieraDisplayFrame outBuff;
|
||||
|
||||
if (!current_)
|
||||
{
|
||||
outBuff = outFrame_A_;
|
||||
current_= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
outBuff = outFrame_B_;
|
||||
current_= 0;
|
||||
}
|
||||
|
||||
rgb_buffer_to_yuy2(buf_, outBuff);
|
||||
return outBuff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
LumieraDisplayFrame
|
||||
DummyImageGenerator::current()
|
||||
{
|
||||
if (!current_) return outFrame_A_;
|
||||
else return outFrame_B_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::node
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef PROC_PLAY_DUMMY_IMAGE_GENERATOR_H
|
||||
#define PROC_PLAY_DUMMY_IMAGE_GENERATOR_H
|
||||
#ifndef PROC_NODE_DUMMY_IMAGE_GENERATOR_H
|
||||
#define PROC_NODE_DUMMY_IMAGE_GENERATOR_H
|
||||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
|
|
@ -44,47 +44,45 @@
|
|||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
namespace node {
|
||||
|
||||
|
||||
class DummyImageGenerator
|
||||
{
|
||||
|
||||
unsigned char buf_[320 * 240 * 3]; ///< working buffer for next frame
|
||||
|
||||
unsigned char outFrame_A_[320 * 240 * 4]; ///< output frame 1
|
||||
unsigned char outFrame_B_[320 * 240 * 4]; ///< output frame 2
|
||||
|
||||
uint current_;
|
||||
uint frame_;
|
||||
uint fps_;
|
||||
|
||||
|
||||
public:
|
||||
DummyImageGenerator(uint fps);
|
||||
|
||||
~DummyImageGenerator() { }
|
||||
|
||||
/** generate the next frame and
|
||||
* occupy the alternate buffer.
|
||||
* @return the buffer containing the new frame
|
||||
*/
|
||||
LumieraDisplayFrame next();
|
||||
|
||||
/** just re-return a pointer to the current frame
|
||||
* without generating any new image data */
|
||||
LumieraDisplayFrame current();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class DummyImageGenerator
|
||||
{
|
||||
|
||||
unsigned char buf_[320 * 240 * 3]; ///< working buffer for next frame
|
||||
|
||||
unsigned char outFrame_A_[320 * 240 * 4]; ///< output frame 1
|
||||
unsigned char outFrame_B_[320 * 240 * 4]; ///< output frame 2
|
||||
|
||||
uint current_;
|
||||
uint frame_;
|
||||
uint fps_;
|
||||
|
||||
|
||||
public:
|
||||
DummyImageGenerator(uint fps);
|
||||
|
||||
~DummyImageGenerator() { }
|
||||
|
||||
/** generate the next frame and
|
||||
* occupy the alternate buffer.
|
||||
* @return the buffer containing the new frame
|
||||
*/
|
||||
LumieraDisplayFrame next();
|
||||
|
||||
/** just re-return a pointer to the current frame
|
||||
* without generating any new image data */
|
||||
LumieraDisplayFrame current();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace play
|
||||
|
||||
} // namespace proc
|
||||
#endif // PROC_PLAY_DUMMY_IMAGE_GENERATOR_H
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::node
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -46,82 +46,80 @@
|
|||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
namespace node {
|
||||
|
||||
using std::tr1::function;
|
||||
|
||||
|
||||
|
||||
/************************************************************
|
||||
* Tick generating service for a periodic callback,
|
||||
* with adjustable frequency. Quick'n dirty implementation!
|
||||
*/
|
||||
class TickService
|
||||
: backend::ThreadJoinable
|
||||
{
|
||||
typedef function<void(void)> Tick;
|
||||
volatile uint timespan_;
|
||||
|
||||
/** poll interval for new settings in wait state */
|
||||
static const uint POLL_TIMEOUT = 1000;
|
||||
|
||||
public:
|
||||
TickService (Tick callback)
|
||||
: ThreadJoinable("Tick generator (dummy)"
|
||||
, bind (&TickService::timerLoop, this, callback)
|
||||
)
|
||||
{
|
||||
INFO (proc, "TickService started.");
|
||||
}
|
||||
|
||||
~TickService ()
|
||||
{
|
||||
timespan_ = 0;
|
||||
this->join();
|
||||
usleep (200000); // additional delay allowing GTK to dispatch the last output
|
||||
|
||||
INFO (proc, "TickService shutdown.");
|
||||
}
|
||||
|
||||
|
||||
/** set the periodic timer to run with a given frequency,
|
||||
* starting \em now. Well, not actually now, but at the next
|
||||
* opportunity. It should be \em now, but this implementation
|
||||
* is sloppy! setting fps==0 halts (pauses) the timer.
|
||||
*/
|
||||
void activate (uint fps)
|
||||
{
|
||||
REQUIRE ( 0==fps
|
||||
||( 1000000/fps < std::numeric_limits<uint>::max()
|
||||
&& 1000000/fps > POLL_TIMEOUT));
|
||||
if (fps)
|
||||
timespan_ = 1000000/fps; // microseconds per tick
|
||||
else
|
||||
timespan_ = POLL_TIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void timerLoop(Tick periodicFun)
|
||||
{
|
||||
timespan_ = POLL_TIMEOUT;
|
||||
while (0 < timespan_)
|
||||
{
|
||||
if (timespan_ > POLL_TIMEOUT)
|
||||
periodicFun();
|
||||
|
||||
usleep (timespan_);
|
||||
}
|
||||
TRACE (proc_dbg, "Tick Thread timer loop exiting...");
|
||||
}
|
||||
using std::tr1::function;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace play
|
||||
|
||||
|
||||
/************************************************************
|
||||
* Tick generating service for a periodic callback,
|
||||
* with adjustable frequency. Quick'n dirty implementation!
|
||||
*/
|
||||
class TickService
|
||||
: backend::ThreadJoinable
|
||||
{
|
||||
typedef function<void(void)> Tick;
|
||||
volatile uint timespan_;
|
||||
|
||||
/** poll interval for new settings in wait state */
|
||||
static const uint POLL_TIMEOUT = 1000;
|
||||
|
||||
public:
|
||||
TickService (Tick callback)
|
||||
: ThreadJoinable("Tick generator (dummy)"
|
||||
, bind (&TickService::timerLoop, this, callback)
|
||||
)
|
||||
{
|
||||
INFO (proc, "TickService started.");
|
||||
}
|
||||
|
||||
~TickService ()
|
||||
{
|
||||
timespan_ = 0;
|
||||
this->join();
|
||||
usleep (200000); // additional delay allowing GTK to dispatch the last output
|
||||
|
||||
INFO (proc, "TickService shutdown.");
|
||||
}
|
||||
|
||||
|
||||
/** set the periodic timer to run with a given frequency,
|
||||
* starting \em now. Well, not actually now, but at the next
|
||||
* opportunity. It should be \em now, but this implementation
|
||||
* is sloppy! setting fps==0 halts (pauses) the timer.
|
||||
*/
|
||||
void activate (uint fps)
|
||||
{
|
||||
REQUIRE ( 0==fps
|
||||
||( 1000000/fps < std::numeric_limits<uint>::max()
|
||||
&& 1000000/fps > POLL_TIMEOUT));
|
||||
if (fps)
|
||||
timespan_ = 1000000/fps; // microseconds per tick
|
||||
else
|
||||
timespan_ = POLL_TIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void timerLoop(Tick periodicFun)
|
||||
{
|
||||
timespan_ = POLL_TIMEOUT;
|
||||
while (0 < timespan_)
|
||||
{
|
||||
if (timespan_ > POLL_TIMEOUT)
|
||||
periodicFun();
|
||||
|
||||
usleep (timespan_);
|
||||
}
|
||||
TRACE (proc_dbg, "Tick Thread timer loop exiting...");
|
||||
}
|
||||
|
||||
} // namespace proc
|
||||
#endif // PROC_PLAY_TICKSERVICE_H
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::node
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -37,33 +37,31 @@
|
|||
//#include "common/instancehandle.hpp"
|
||||
//#include "lib/singleton-ref.hpp"
|
||||
//
|
||||
//#include <boost/noncopyable.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#include <string>
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
namespace play {
|
||||
|
||||
// using std::string;
|
||||
// using lumiera::Subsys;
|
||||
// using lumiera::Display;
|
||||
// using lumiera::DummyPlayer;
|
||||
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*/
|
||||
class DummyPlayConnection
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace play
|
||||
|
||||
} // namespace proc
|
||||
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*/
|
||||
class DummyPlayConnection
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::play
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
|
||||
#include "proc/play/dummy-player-service.hpp"
|
||||
#include "proc/play/dummy-image-generator.hpp"
|
||||
#include "proc/play/tick-service.hpp"
|
||||
#include "proc/engine/worker/dummy-image-generator.hpp"
|
||||
#include "proc/engine/worker/tick-service.hpp"
|
||||
#include "lib/singleton.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -47,6 +47,7 @@ namespace proc {
|
|||
using std::tr1::bind;
|
||||
|
||||
|
||||
|
||||
namespace { // hidden local details of the service implementation....
|
||||
|
||||
/** details of how the DummyPlayer service can be started
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@
|
|||
|
||||
|
||||
namespace proc {
|
||||
namespace node {
|
||||
class DummyImageGenerator;
|
||||
class TickService;
|
||||
}
|
||||
|
||||
namespace play {
|
||||
|
||||
using std::string;
|
||||
|
|
@ -59,9 +64,9 @@ namespace proc {
|
|||
using lumiera::Display;
|
||||
using lumiera::DummyPlayer;
|
||||
|
||||
using proc::node::DummyImageGenerator;
|
||||
using proc::node::TickService;
|
||||
|
||||
class DummyImageGenerator;
|
||||
class TickService;
|
||||
|
||||
|
||||
/********************************************************************
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
#include "play/output-manager.hpp"
|
||||
#include "proc/play/output-manager.hpp"
|
||||
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
|
||||
|
|
@ -40,4 +41,4 @@ namespace play {
|
|||
|
||||
|
||||
|
||||
} // namespace play
|
||||
}} // namespace proc::play
|
||||
|
|
|
|||
|
|
@ -36,41 +36,39 @@
|
|||
//#include "common/instancehandle.hpp"
|
||||
//#include "lib/singleton-ref.hpp"
|
||||
//
|
||||
//#include <boost/noncopyable.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#include <string>
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
namespace play {
|
||||
|
||||
// using std::string;
|
||||
// using lumiera::Subsys;
|
||||
// using lumiera::Display;
|
||||
// using lumiera::DummyPlayer;
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Actual implementation of the DummyPlayer service.
|
||||
* Creating an instance of this class automatically
|
||||
* registers the interface lumieraorg_DummyPlayer with
|
||||
* the Lumiera Interface/Plugin system and creates
|
||||
* a forwarding proxy within the application core to
|
||||
* route calls through this interface.
|
||||
*/
|
||||
class PlayerProcess
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace play
|
||||
|
||||
} // namespace proc
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Actual implementation of the DummyPlayer service.
|
||||
* Creating an instance of this class automatically
|
||||
* registers the interface lumieraorg_DummyPlayer with
|
||||
* the Lumiera Interface/Plugin system and creates
|
||||
* a forwarding proxy within the application core to
|
||||
* route calls through this interface.
|
||||
*/
|
||||
class PlayerProcess
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::play
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,75 +32,32 @@
|
|||
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace play{
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
using std::auto_ptr;
|
||||
using boost::scoped_ptr;
|
||||
using std::tr1::bind;
|
||||
|
||||
|
||||
namespace { // hidden local details of the service implementation....
|
||||
|
||||
/** details of how the DummyPlayer service can be started
|
||||
* and used as independent "subsystem" within main() */
|
||||
class DummyPlayerSubsysDescriptor
|
||||
: public Subsys
|
||||
{
|
||||
operator string () const { return "Dummy-Player"; }
|
||||
|
||||
|
||||
bool
|
||||
shouldStart (lumiera::Option&)
|
||||
{
|
||||
return false; // for now the DummyPlayerService only comes "up" as dependency,
|
||||
} // but doesn't start as a subsystem on it's own.
|
||||
|
||||
bool
|
||||
start (lumiera::Option&, Subsys::SigTerm terminationHandle)
|
||||
{
|
||||
ASSERT (!thePlayer_);
|
||||
|
||||
thePlayer_.reset (new DummyPlayerService (terminationHandle));
|
||||
return true;
|
||||
}
|
||||
|
||||
/** manages the actual (single) instance of the player service impl */
|
||||
scoped_ptr<DummyPlayerService> thePlayer_;
|
||||
|
||||
|
||||
void
|
||||
triggerShutdown () throw()
|
||||
{
|
||||
thePlayer_.reset(0);
|
||||
// note: shutdown of the DummyPlayerService instance may block
|
||||
// for a short period, until termination of all tick services
|
||||
}
|
||||
|
||||
bool
|
||||
checkRunningState () throw()
|
||||
{
|
||||
return (thePlayer_);
|
||||
}
|
||||
};
|
||||
|
||||
lib::Singleton<DummyPlayerSubsysDescriptor> theDummyPlayerDescriptor;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ================== define an lumieraorg_DummyPlayer instance ======================= */
|
||||
|
||||
|
||||
} // (End) hidden service impl details
|
||||
|
||||
|
||||
|
||||
|
||||
/** */
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
//using std::string;
|
||||
//using lumiera::Subsys;
|
||||
//using std::auto_ptr;
|
||||
//using boost::scoped_ptr;
|
||||
//using std::tr1::bind;
|
||||
|
||||
|
||||
namespace { // hidden local details of the service implementation....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ================== define an lumieraorg_DummyPlayer instance ======================= */
|
||||
|
||||
|
||||
} // (End) hidden service impl details
|
||||
|
||||
|
||||
|
||||
|
||||
/** */
|
||||
|
||||
|
||||
}} // namespace proc::play
|
||||
|
|
|
|||
|
|
@ -41,37 +41,35 @@
|
|||
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
namespace play {
|
||||
|
||||
using std::string;
|
||||
//using lumiera::Subsys;
|
||||
//using lumiera::Display;
|
||||
//using lumiera::DummyPlayer;
|
||||
|
||||
|
||||
using std::string;
|
||||
using lumiera::Subsys;
|
||||
using lumiera::Display;
|
||||
using lumiera::DummyPlayer;
|
||||
|
||||
|
||||
// class DummyImageGenerator;
|
||||
// class TickService;
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Interface: Player subsystem.
|
||||
*/
|
||||
class PlayService
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
public:
|
||||
PlayService(Subsys::SigTerm terminationHandle);
|
||||
|
||||
~PlayService() { notifyTermination_(&error_); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace play
|
||||
|
||||
} // namespace proc
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Interface: Player subsystem.
|
||||
*/
|
||||
class PlayService
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
public:
|
||||
PlayService(); /////TODO Subsys::SigTerm terminationHandle);
|
||||
|
||||
~PlayService() { }/////TODO notifyTermination_(&error_); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespace proc::play
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
using ::test::Test;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace test {
|
|||
|
||||
using boost::str;
|
||||
using boost::format;
|
||||
format fmt ("-<%u%u>%s");
|
||||
format formatted ("-<%u%u>%s");
|
||||
|
||||
/**
|
||||
* A Test-Template to be instantiated
|
||||
|
|
@ -63,17 +63,19 @@ namespace test {
|
|||
*/
|
||||
template<class T1, class T2, class BASE>
|
||||
struct TestCase
|
||||
: BASE
|
||||
{
|
||||
static string
|
||||
visitAll()
|
||||
{
|
||||
T1 param1;
|
||||
T2 param2;
|
||||
return str(fmt % param1 % param2
|
||||
% BASE::visitAll());
|
||||
return str(formatted % param1 % param2
|
||||
% BASE::visitAll());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct TestCase<void,void,NullType>
|
||||
{
|
||||
static string
|
||||
|
|
|
|||
|
|
@ -131,17 +131,17 @@ namespace test {
|
|||
Pick<List2,1>::Type e1;
|
||||
Pick<List2,2>::Type e2;
|
||||
|
||||
Pick<List2,3>::Type E3;
|
||||
Pick<NullType,23>::Type Nil;
|
||||
Pick<void*,456>::Type Irrelevant;
|
||||
typedef Pick<List2,3>::Type E3;
|
||||
typedef Pick<NullType,23>::Type Nil;
|
||||
typedef Pick<void*,456>::Type Irrelevant;
|
||||
|
||||
CHECK (5 == e0);
|
||||
CHECK (6 == e1);
|
||||
CHECK (7 == e2);
|
||||
|
||||
CHECK (is_sameType<NullType, E3>::value);
|
||||
CHECK (is_sameType<NullType, Nil>::value);
|
||||
CHECK (is_sameType<NullType, Irrelevant>::value);
|
||||
CHECK ((is_sameType<NullType, E3>::value));
|
||||
CHECK ((is_sameType<NullType, Nil>::value));
|
||||
CHECK ((is_sameType<NullType, Irrelevant>::value));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
using ::test::Test;
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "lib/time/timequant.hpp"
|
||||
#include "lib/time/mutation.hpp"
|
||||
#include "proc/asset/meta/time-grid.hpp"
|
||||
#include "lib/meta/typelist.hpp"
|
||||
#include "lib/meta/generator-combinations.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
|
@ -47,7 +47,7 @@ namespace test{
|
|||
|
||||
using asset::meta::TimeGrid;
|
||||
using lumiera::typelist::Types;
|
||||
using lumiera::typelist::InstantiateForEach;
|
||||
using lumiera::typelist::InstantiateChainedCombinations;
|
||||
|
||||
namespace {
|
||||
inline string
|
||||
|
|
@ -58,6 +58,24 @@ namespace test{
|
|||
arg.erase (arg.begin());
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
template<class TAR, class SRC, class BASE>
|
||||
struct TestCase
|
||||
: BASE
|
||||
{
|
||||
void
|
||||
performTestCases()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
struct IterationEnd
|
||||
{
|
||||
void performTestCases() { }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -124,22 +142,17 @@ namespace test{
|
|||
{
|
||||
}
|
||||
|
||||
template<class TAR>
|
||||
struct TestCase4Target
|
||||
{
|
||||
void
|
||||
performTestCases()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
verifyMatrix_of_MutationCases ()
|
||||
{
|
||||
typedef Types<Duration,TimeSpan,QuTime> KindsOfTarget;
|
||||
typedef InstantiateForEach<KindsOfTarget::List, TestCase4Target> TestMatrix;
|
||||
typedef Types<Time,Duration,TimeSpan,QuTime> KindsOfSource;
|
||||
typedef InstantiateChainedCombinations< KindsOfTarget
|
||||
, KindsOfSource
|
||||
, TestCase
|
||||
, IterationEnd > TestMatrix;
|
||||
|
||||
TestMatrix().performTestCases();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue