diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-04-12 12:20:07 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-04-12 12:20:07 +0200 |
commit | 00166dac5fce46cb15ec558f176d45f734f815e9 (patch) | |
tree | 7b344099f2fab0dc81792e9ce62bc15c7d3e178a | |
parent | f8a7e51d00d66f2fd71c9f5966a893c59485584b (diff) | |
download | vdr-00166dac5fce46cb15ec558f176d45f734f815e9.tar.gz vdr-00166dac5fce46cb15ec558f176d45f734f815e9.tar.bz2 |
If no device with an MPEG decoder can be found at startup, the first device is now used as primary device
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | device.c | 21 | ||||
-rw-r--r-- | dvbdevice.c | 5 | ||||
-rw-r--r-- | dvbosd.c | 4 | ||||
-rw-r--r-- | vdr.c | 29 |
5 files changed, 35 insertions, 26 deletions
@@ -2022,3 +2022,5 @@ Video Disk Recorder Revision History the "Setup/Replay" menu (see MANUAL for details). - Now using 'libdtv' version 0.0.5 (thanks to Rolf Hakenes for the new version and Stefan Huelswitt for adapting VDR to it). +- If no device with an MPEG decoder can be found at startup, the first device + is now used as primary device (just to have some device). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.38 2003/03/30 12:39:29 kls Exp $ + * $Id: device.c 1.39 2003/04/12 11:51:04 kls Exp $ */ #include "device.h" @@ -106,19 +106,14 @@ bool cDevice::SetPrimaryDevice(int n) { n--; if (0 <= n && n < numDevices && device[n]) { - if (device[n]->HasDecoder()) { - isyslog("setting primary device to %d", n + 1); - if (primaryDevice) - primaryDevice->MakePrimaryDevice(false); - primaryDevice = device[n]; - primaryDevice->MakePrimaryDevice(true); - return true; - } - else - esyslog("ERROR: device number %d has no MPEG decoder", n + 1); + isyslog("setting primary device to %d", n + 1); + if (primaryDevice) + primaryDevice->MakePrimaryDevice(false); + primaryDevice = device[n]; + primaryDevice->MakePrimaryDevice(true); + return true; } - else - esyslog("ERROR: invalid primary device number: %d", n + 1); + esyslog("ERROR: invalid primary device number: %d", n + 1); return false; } diff --git a/dvbdevice.c b/dvbdevice.c index 58307f89..3e0a50bd 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.49 2003/03/30 12:40:47 kls Exp $ + * $Id: dvbdevice.c 1.50 2003/04/12 12:09:16 kls Exp $ */ #include "dvbdevice.h" @@ -397,7 +397,8 @@ bool cDvbDevice::Initialize(void) void cDvbDevice::MakePrimaryDevice(bool On) { - cDvbOsd::SetDvbDevice(On ? this : NULL); + if (HasDecoder()) + cDvbOsd::SetDvbDevice(On ? this : NULL); } bool cDvbDevice::HasDecoder(void) const @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.c 1.20 2003/03/09 09:59:13 kls Exp $ + * $Id: dvbosd.c 1.21 2003/04/12 12:10:12 kls Exp $ */ #include "dvbosd.h" @@ -19,7 +19,7 @@ cDvbOsd::cDvbOsd(int x, int y) :cOsdBase(x, y) { osdDev = dvbDevice ? dvbDevice->OsdDeviceHandle() : -1; - if (osdDev < 0) + if (dvbDevice && osdDev < 0) esyslog("ERROR: illegal OSD device handle (%d)!", osdDev); } @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.147 2003/03/30 10:43:58 kls Exp $ + * $Id: vdr.c 1.148 2003/04/12 12:17:32 kls Exp $ */ #include <getopt.h> @@ -364,21 +364,32 @@ int main(int argc, char *argv[]) // Primary device: cDevice::SetPrimaryDevice(Setup.PrimaryDVB); - if (!cDevice::PrimaryDevice()) { + if (!cDevice::PrimaryDevice() || !cDevice::PrimaryDevice()->HasDecoder()) { + if (cDevice::PrimaryDevice() && !cDevice::PrimaryDevice()->HasDecoder()) + isyslog("device %d has no MPEG decoder", cDevice::PrimaryDevice()->DeviceNumber() + 1); 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)) + if (cDevice::SetPrimaryDevice(i + 1)) { Setup.PrimaryDVB = i + 1; + break; + } } } - } - if (!cDevice::PrimaryDevice()) { - const char *msg = "no primary device found - giving up!"; - fprintf(stderr, "vdr: %s\n", msg); - esyslog("ERROR: %s", msg); - return 2; + if (!cDevice::PrimaryDevice()) { + const char *msg = "no primary device found - using first device!"; + fprintf(stderr, "vdr: %s\n", msg); + esyslog("ERROR: %s", msg); + if (!cDevice::SetPrimaryDevice(0)) + return 2; + if (!cDevice::PrimaryDevice()) { + const char *msg = "no primary device found - giving up!"; + fprintf(stderr, "vdr: %s\n", msg); + esyslog("ERROR: %s", msg); + return 2; + } + } } // OSD: |