diff options
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | server/connection.c | 22 | ||||
-rw-r--r-- | server/connection.h | 9 |
3 files changed, 21 insertions, 12 deletions
@@ -1,7 +1,7 @@ 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 option has been added. - Updated Finnish translation (thanks to Rolf Ahrenberg) diff --git a/server/connection.c b/server/connection.c index 0f1d3f3..ced28e1 100644 --- a/server/connection.c +++ b/server/connection.c @@ -44,12 +44,24 @@ void cSwitchLive::Switch(void) { mutex.Lock(); if (channel && device) { -#if APIVERSNUM >= 10722 - cDevice *d = device; - d->SetOccupied(10); +#if APIVERSNUM >= 10726 + cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel()); + 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 cDevice::SetAvoidDevice(device); -#endif if (!Channels.SwitchTo(cDevice::CurrentChannel())) { if (StreamdevServerSetup.SuspendMode == smAlways) { Channels.SwitchTo(channel->Number()); @@ -60,8 +72,6 @@ void cSwitchLive::Switch(void) device = NULL; } } -#if APIVERSNUM >= 10722 - d->SetOccupied(0); #endif // make sure we don't come in here next time channel = NULL; diff --git a/server/connection.h b/server/connection.h index 0d7a1a0..3c6d9a3 100644 --- a/server/connection.h +++ b/server/connection.h @@ -38,11 +38,6 @@ private: 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 or a FF card, displaying live TV from internal tuner */ static bool UsedByLiveTV(cDevice *device); @@ -106,6 +101,10 @@ public: /* Close the socket */ 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 already been attached from the device if necessary. Use the returned cDevice in a following call to StartTransfer */ |