From 6fd53f0b97b06f8bb718bef6da0d90df95f64e03 Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Mon, 15 Jan 2007 19:35:06 +0000 Subject: - moved ajax script to separate file - moved call of ajax object to page element - introduced page element for replaying recordings - introduced task for replaying recordings - added replay button to recordings page --- tasks.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'tasks.h') diff --git a/tasks.h b/tasks.h index 21a0ae4..3ae63da 100644 --- a/tasks.h +++ b/tasks.h @@ -1,6 +1,8 @@ #ifndef VDR_LIVE_TASKS_H #define VDR_LIVE_TASKS_H +#include +#include #include namespace vdrlive { @@ -11,18 +13,40 @@ class TaskManager: public cMutex public: bool SwitchChannel( int number ); + bool ReplayRecording( std::string const& fileName ); // may only be called from Plugin::MainThreadHook void DoScheduledWork(); private: + template< typename Type > + struct Task: std::pair< Type, bool > + { + Task( Type const& first, bool second ): std::pair< Type, bool >( first, second ) {} + }; + TaskManager(); TaskManager( TaskManager const& ); - int m_switchChannel; - bool m_switchResult; + Task< int > m_switchChannel; + Task< std::string > m_replayRecording; cCondVar m_scheduleWait; + + template< typename Type > + bool ScheduleCommand( Task< Type >& member, Type const& param ); + + void DoSwitchChannel(); + void DoReplayRecording(); }; + +template< typename Type > +inline bool TaskManager::ScheduleCommand( Task< Type >& member, Type const& param ) +{ + cMutexLock lock( this ); + member.first = param; + m_scheduleWait.Wait( *this ); + return member.second; +} TaskManager& LiveTaskManager(); -- cgit v1.2.3