summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-03-09 14:10:12 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2003-03-09 14:10:12 +0100
commit8d4d7f2b626226a543e09651772d43e7313ebbf5 (patch)
tree0c9025e440752e3053aed99dda8c20d3d5c7df75
parentdfc60da1d5fb03c6007e66df16f5979080171a4b (diff)
downloadvdr-8d4d7f2b626226a543e09651772d43e7313ebbf5.tar.gz
vdr-8d4d7f2b626226a543e09651772d43e7313ebbf5.tar.bz2
Trying harder to find a primary device
-rw-r--r--HISTORY5
-rw-r--r--device.c21
-rw-r--r--vdr.c12
3 files changed, 29 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index f5d7d095..f345f65f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1975,3 +1975,8 @@ Video Disk Recorder Revision History
- Removed signal handling and usleep(5000) from cDvbOsd::Cmd() (apparently this
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.
diff --git a/device.c b/device.c
index 15628cd3..0f99e13b 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -106,14 +106,19 @@ bool cDevice::SetPrimaryDevice(int n)
{
n--;
if (0 <= n && n < numDevices && device[n]) {
- isyslog("setting primary device to %d", n + 1);
- if (primaryDevice)
- primaryDevice->MakePrimaryDevice(false);
- primaryDevice = device[n];
- primaryDevice->MakePrimaryDevice(true);
- return true;
+ 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);
}
- esyslog("invalid primary device number: %d", n + 1);
+ else
+ esyslog("ERROR: invalid primary device number: %d", n + 1);
return false;
}
diff --git a/vdr.c b/vdr.c
index 3e6a9ed3..50b1a290 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* 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>
@@ -365,6 +365,16 @@ int main(int argc, char *argv[])
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()) {
const char *msg = "no primary device found - giving up!";
fprintf(stderr, "vdr: %s\n", msg);
esyslog("ERROR: %s", msg);