diff options
author | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-01-13 18:37:21 +0000 |
---|---|---|
committer | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-01-13 18:37:21 +0000 |
commit | 2072c668df9ad48586fd2750713da0be742dda6d (patch) | |
tree | b6a8af74320fe0b4af845fdc7ec0fca40d88f02d /tasks.cpp | |
parent | 872af377d5d207b0292c4deb3ebdff09c116ea3d (diff) | |
download | vdr-plugin-live-2072c668df9ad48586fd2750713da0be742dda6d.tar.gz vdr-plugin-live-2072c668df9ad48586fd2750713da0be742dda6d.tar.bz2 |
- added service to switch channels by channel-id
Diffstat (limited to 'tasks.cpp')
-rw-r--r-- | tasks.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tasks.cpp b/tasks.cpp new file mode 100644 index 0000000..63a3358 --- /dev/null +++ b/tasks.cpp @@ -0,0 +1,39 @@ +#include <vdr/channels.h> +#include "tasks.h" + +namespace vdrlive { + +TaskManager::TaskManager(): + m_switchChannel( 0 ), + m_switchResult( false ) +{ +} + +bool TaskManager::SwitchChannel( int number ) +{ + cMutexLock lock( this ); + m_switchChannel = number; + m_scheduleWait.Wait( *this ); + return m_switchResult; +} + +void TaskManager::DoScheduledWork() +{ + if ( m_switchChannel == 0 ) + return; + + cMutexLock lock( this ); + if ( m_switchChannel != 0 ) { + m_switchResult = Channels.SwitchTo( m_switchChannel ); + m_switchChannel = 0; + m_scheduleWait.Broadcast(); + } +} + +TaskManager& LiveTaskManager() +{ + static TaskManager instance; + return instance; +} + +} // namespace vdrlive |