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
---------------------------------------
- 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)

View File

@ -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;

View File

@ -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 */