blob: b540f7499849328676783f82a4ed99a97619ab31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
* status.cpp: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#include "status.h"
cStatusInfosatepg::cStatusInfosatepg(cGlobalInfosatepg *Global)
{
global = Global;
myFilter=new cFilterInfosatepg(global);
myFilterDevice=NULL;
}
cStatusInfosatepg::~cStatusInfosatepg(void)
{
if (myFilterDevice) myFilterDevice->Detach(myFilter);
if (myFilter) delete myFilter;
}
void cStatusInfosatepg::ChannelSwitch(const cDevice *Device, int ChannelNumber)
{
bool bAddFilter=false;
// just add filter if we aren't locked
if ((ChannelNumber==global->Channel) && (!global->isLocked())) bAddFilter=true;
if (bAddFilter)
{
if ((myFilterDevice) && (myFilter))
{
if (myFilterDevice==Device) return; // already attached -> bail out
dsyslog("infosatepg: detach previously attached filter");
myFilterDevice->Detach(myFilter);
}
myFilterDevice = Device->GetDevice(Device->DeviceNumber());
if (!myFilterDevice) return;
dsyslog("switching device %i to channel %i (infosatepg)",
Device->DeviceNumber()+1,ChannelNumber);
myFilterDevice->AttachFilter(myFilter);
global->SetSwitched(true);
}
else
{
if (myFilterDevice)
{
if (Device==myFilterDevice)
{
dsyslog("infosatepg: detach filter");
myFilterDevice->Detach(myFilter);
myFilterDevice=NULL;
global->SetTimer();
global->SetSwitched(false);
}
}
}
}
|