1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Trying harder to find a primary device

This commit is contained in:
Klaus Schmidinger 2003-03-09 14:10:12 +01:00
parent dfc60da1d5
commit 8d4d7f2b62
3 changed files with 29 additions and 9 deletions

View File

@ -1975,3 +1975,8 @@ Video Disk Recorder Revision History
- Removed signal handling and usleep(5000) from cDvbOsd::Cmd() (apparently this - Removed signal handling and usleep(5000) from cDvbOsd::Cmd() (apparently this
is no longer necessary with DVB driver 1.0.0pre2 or later). is no longer necessary with DVB driver 1.0.0pre2 or later).
- If the primary device (as defined in setup.conf) doesn't have an MPEG decoder
(and thus can't be used as a primary device) VDR now scans all devices at
startup and uses the first one (if any) that actually has an MPEG decoder.
That way this will also work automatically if the primary device is implemented
by a plugin.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.c 1.36 2003/01/03 15:41:14 kls Exp $ * $Id: device.c 1.37 2003/03/09 14:05:23 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -106,14 +106,19 @@ bool cDevice::SetPrimaryDevice(int n)
{ {
n--; n--;
if (0 <= n && n < numDevices && device[n]) { if (0 <= n && n < numDevices && device[n]) {
isyslog("setting primary device to %d", n + 1); if (device[n]->HasDecoder()) {
if (primaryDevice) isyslog("setting primary device to %d", n + 1);
primaryDevice->MakePrimaryDevice(false); if (primaryDevice)
primaryDevice = device[n]; primaryDevice->MakePrimaryDevice(false);
primaryDevice->MakePrimaryDevice(true); primaryDevice = device[n];
return true; primaryDevice->MakePrimaryDevice(true);
return true;
}
else
esyslog("ERROR: device number %d has no MPEG decoder", n + 1);
} }
esyslog("invalid primary device number: %d", n + 1); else
esyslog("ERROR: invalid primary device number: %d", n + 1);
return false; return false;
} }

12
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * The project's page is at http://www.cadsoft.de/people/kls/vdr
* *
* $Id: vdr.c 1.145 2003/02/16 10:34:24 kls Exp $ * $Id: vdr.c 1.146 2003/03/09 14:07:46 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -364,6 +364,16 @@ int main(int argc, char *argv[])
// Primary device: // Primary device:
cDevice::SetPrimaryDevice(Setup.PrimaryDVB); cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
if (!cDevice::PrimaryDevice()) {
for (int i = 0; i < cDevice::NumDevices(); i++) {
cDevice *d = cDevice::GetDevice(i);
if (d && d->HasDecoder()) {
isyslog("trying device number %d instead", i + 1);
if (cDevice::SetPrimaryDevice(i + 1))
Setup.PrimaryDVB = i + 1;
}
}
}
if (!cDevice::PrimaryDevice()) { if (!cDevice::PrimaryDevice()) {
const char *msg = "no primary device found - giving up!"; const char *msg = "no primary device found - giving up!";
fprintf(stderr, "vdr: %s\n", msg); fprintf(stderr, "vdr: %s\n", msg);