Using SetOccupied() won't work as it isn't considered in GetDevice(). Trying

to compensate the loss of SetAvoidDevice() with streamdevs CheckConnection(),
ignoring the current live TV device. If a new device is returned it is just
switched to the new channel. Hopefully the main loop will pick it up later,
after streamdev switched aways live TV.
This commit is contained in:
Frank Schmirler 2012-03-11 09:41:33 +01:00
parent 5a3c535778
commit a1797719de
3 changed files with 21 additions and 12 deletions

View File

@ -1,7 +1,7 @@
VDR Plugin 'streamdev' Revision History VDR Plugin 'streamdev' Revision History
--------------------------------------- ---------------------------------------
- API change of VDR 1.7.26: Use "occupied" instead of "avoid device". - API change of VDR 1.7.26: "avoid device" is no longer available
- Fixed ProvidesChannel() on client always returning true since the new timeout - Fixed ProvidesChannel() on client always returning true since the new timeout
option has been added. option has been added.
- Updated Finnish translation (thanks to Rolf Ahrenberg) - Updated Finnish translation (thanks to Rolf Ahrenberg)

View File

@ -44,12 +44,24 @@ void cSwitchLive::Switch(void)
{ {
mutex.Lock(); mutex.Lock();
if (channel && device) { if (channel && device) {
#if APIVERSNUM >= 10722 #if APIVERSNUM >= 10726
cDevice *d = device; cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel());
d->SetOccupied(10); cDevice *newdev = cServerConnection::CheckDevice(current, 0, true, device);
if (!newdev) {
if (StreamdevServerSetup.SuspendMode == smAlways) {
Channels.SwitchTo(channel->Number());
Skins.Message(mtInfo, tr("Streaming active"));
}
else {
esyslog("streamdev: Can't receive channel %d (%s) from device %d. Moving live TV to other device failed (PrimaryDevice=%d, ActualDevice=%d)", channel->Number(), channel->Name(), device->CardIndex(), cDevice::PrimaryDevice()->CardIndex(), cDevice::ActualDevice()->CardIndex());
device = NULL;
}
}
else {
newdev->SwitchChannel(current, true);
}
#else #else
cDevice::SetAvoidDevice(device); cDevice::SetAvoidDevice(device);
#endif
if (!Channels.SwitchTo(cDevice::CurrentChannel())) { if (!Channels.SwitchTo(cDevice::CurrentChannel())) {
if (StreamdevServerSetup.SuspendMode == smAlways) { if (StreamdevServerSetup.SuspendMode == smAlways) {
Channels.SwitchTo(channel->Number()); Channels.SwitchTo(channel->Number());
@ -60,8 +72,6 @@ void cSwitchLive::Switch(void)
device = NULL; device = NULL;
} }
} }
#if APIVERSNUM >= 10722
d->SetOccupied(0);
#endif #endif
// make sure we don't come in here next time // make sure we don't come in here next time
channel = NULL; channel = NULL;

View File

@ -38,11 +38,6 @@ private:
tStrStrMap m_Headers; tStrStrMap m_Headers;
/* Check if a device would be available for transfering the given
channel. This call has no side effects except for temporarily
detaching this connection's receivers. */
cDevice *CheckDevice(const cChannel *Channel, int Priority, bool LiveView, const cDevice *AvoidDevice = NULL);
/* Test if device is in use as the transfer mode receiver device /* Test if device is in use as the transfer mode receiver device
or a FF card, displaying live TV from internal tuner */ or a FF card, displaying live TV from internal tuner */
static bool UsedByLiveTV(cDevice *device); static bool UsedByLiveTV(cDevice *device);
@ -106,6 +101,10 @@ public:
/* Close the socket */ /* Close the socket */
virtual bool Close(void); virtual bool Close(void);
/* Check if a device would be available for transfering the given
channel. This call has no side effects. */
static cDevice *CheckDevice(const cChannel *Channel, int Priority, bool LiveView, const cDevice *AvoidDevice = NULL);
/* Will retrieve an unused device for transmitting data. Receivers have /* Will retrieve an unused device for transmitting data. Receivers have
already been attached from the device if necessary. Use the returned already been attached from the device if necessary. Use the returned
cDevice in a following call to StartTransfer */ cDevice in a following call to StartTransfer */