summaryrefslogtreecommitdiff
path: root/tasks.cpp
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.cpp
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.cpp')
-rw-r--r--tasks.cpp57
1 files changed, 46 insertions, 11 deletions
diff --git a/tasks.cpp b/tasks.cpp
index 63a3358..07275e5 100644
--- a/tasks.cpp
+++ b/tasks.cpp
@@ -1,33 +1,68 @@
#include <vdr/channels.h>
+#include <vdr/menu.h>
+#include <vdr/recording.h>
#include "tasks.h"
namespace vdrlive {
TaskManager::TaskManager():
- m_switchChannel( 0 ),
- m_switchResult( false )
+ m_switchChannel( 0, false ),
+ m_replayRecording( "", false )
{
}
bool TaskManager::SwitchChannel( int number )
{
- cMutexLock lock( this );
- m_switchChannel = number;
- m_scheduleWait.Wait( *this );
- return m_switchResult;
+ return ScheduleCommand( m_switchChannel, number );
+ //cMutexLock lock( this );
+ //m_switchChannel.first = number;
+ //m_scheduleWait.Wait( *this );
+ //return m_switchChannel.second;
+}
+
+bool TaskManager::ReplayRecording( std::string const& fileName )
+{
+ return ScheduleCommand( m_replayRecording, fileName );
+ //cMutexLock lock( this );
+ //m_replayFileName = fileName;
+ //m_scheduleWait.Wait( *this );
+ //return m_replayResult;
}
void TaskManager::DoScheduledWork()
{
- if ( m_switchChannel == 0 )
+ if ( m_switchChannel.first == 0 && m_replayRecording.first.empty() )
return;
cMutexLock lock( this );
- if ( m_switchChannel != 0 ) {
- m_switchResult = Channels.SwitchTo( m_switchChannel );
- m_switchChannel = 0;
- m_scheduleWait.Broadcast();
+ if ( m_switchChannel.first != 0 )
+ DoSwitchChannel();
+ if ( !m_replayRecording.first.empty() )
+ DoReplayRecording();
+ m_scheduleWait.Broadcast();
+}
+
+void TaskManager::DoSwitchChannel()
+{
+ m_switchChannel.second = Channels.SwitchTo( m_switchChannel.first );
+ m_switchChannel.first = 0;
+}
+
+void TaskManager::DoReplayRecording()
+{
+ bool result = false;
+ cThreadLock lock( &Recordings );
+
+ cRecording* recording = Recordings.GetByName( m_replayRecording.first.c_str() );
+ if ( recording ) {
+ cReplayControl::SetRecording( 0, 0 );
+ cControl::Shutdown();
+ cReplayControl::SetRecording( recording->FileName(), recording->Title() );
+ cControl::Launch( new cReplayControl );
+ cControl::Attach();
+ result = true;
}
+ m_replayRecording.first.clear();
}
TaskManager& LiveTaskManager()