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 /vdr.c | |
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
Diffstat (limited to 'vdr.c')
-rw-r--r-- | vdr.c | 29 |
1 files changed, 20 insertions, 9 deletions
@@ -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: |