diff options
author | Frank Schmirler <vdr@schmirler.de> | 2012-03-11 09:41:33 +0100 |
---|---|---|
committer | Frank Schmirler <vdr@schmirler.de> | 2012-03-11 09:41:33 +0100 |
commit | a1797719de296b381a18ae889294b00dd5850667 (patch) | |
tree | 69d2882809e2378864fd90551dc8a1ed0800659a /server | |
parent | 5a3c5357781d8c8e04c28a1799d6f6a0e2065daf (diff) | |
download | vdr-plugin-streamdev-a1797719de296b381a18ae889294b00dd5850667.tar.gz vdr-plugin-streamdev-a1797719de296b381a18ae889294b00dd5850667.tar.bz2 |
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.
Diffstat (limited to 'server')
-rw-r--r-- | server/connection.c | 22 | ||||
-rw-r--r-- | server/connection.h | 9 |
2 files changed, 20 insertions, 11 deletions
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 */ |