summaryrefslogtreecommitdiff
path: root/tasks.h
diff options
context:
space:
mode:
authorSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-01-15 19:35:06 +0000
committerSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-01-15 19:35:06 +0000
commit6fd53f0b97b06f8bb718bef6da0d90df95f64e03 (patch)
tree5a5aa5d9a1b46741b8f2237cfaff8977aaa49ed6 /tasks.h
parente6818d2fe11ac37dde92cb53cfb6c9f9ef283dab (diff)
downloadvdr-plugin-live-6fd53f0b97b06f8bb718bef6da0d90df95f64e03.tar.gz
vdr-plugin-live-6fd53f0b97b06f8bb718bef6da0d90df95f64e03.tar.bz2
- 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
Diffstat (limited to 'tasks.h')
-rw-r--r--tasks.h28
1 files changed, 26 insertions, 2 deletions
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 <string>
+#include <utility>
#include <vdr/thread.h>
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();