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

If no device with an MPEG decoder can be found at startup, the first device is now used as primary device

This commit is contained in:
Klaus Schmidinger 2003-04-12 12:20:07 +02:00
parent f8a7e51d00
commit 00166dac5f
5 changed files with 35 additions and 26 deletions

View File

@ -2022,3 +2022,5 @@ Video Disk Recorder Revision History
the "Setup/Replay" menu (see MANUAL for details). the "Setup/Replay" menu (see MANUAL for details).
- Now using 'libdtv' version 0.0.5 (thanks to Rolf Hakenes for the new version - Now using 'libdtv' version 0.0.5 (thanks to Rolf Hakenes for the new version
and Stefan Huelswitt for adapting VDR to it). 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).

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.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" #include "device.h"
@ -106,7 +106,6 @@ bool cDevice::SetPrimaryDevice(int n)
{ {
n--; n--;
if (0 <= n && n < numDevices && device[n]) { if (0 <= n && n < numDevices && device[n]) {
if (device[n]->HasDecoder()) {
isyslog("setting primary device to %d", n + 1); isyslog("setting primary device to %d", n + 1);
if (primaryDevice) if (primaryDevice)
primaryDevice->MakePrimaryDevice(false); primaryDevice->MakePrimaryDevice(false);
@ -114,10 +113,6 @@ bool cDevice::SetPrimaryDevice(int n)
primaryDevice->MakePrimaryDevice(true); primaryDevice->MakePrimaryDevice(true);
return true; return true;
} }
else
esyslog("ERROR: device number %d has no MPEG decoder", n + 1);
}
else
esyslog("ERROR: invalid primary device number: %d", n + 1); esyslog("ERROR: invalid primary device number: %d", n + 1);
return false; return false;
} }

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: 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" #include "dvbdevice.h"
@ -397,6 +397,7 @@ bool cDvbDevice::Initialize(void)
void cDvbDevice::MakePrimaryDevice(bool On) void cDvbDevice::MakePrimaryDevice(bool On)
{ {
if (HasDecoder())
cDvbOsd::SetDvbDevice(On ? this : NULL); cDvbOsd::SetDvbDevice(On ? this : NULL);
} }

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: 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" #include "dvbosd.h"
@ -19,7 +19,7 @@ cDvbOsd::cDvbOsd(int x, int y)
:cOsdBase(x, y) :cOsdBase(x, y)
{ {
osdDev = dvbDevice ? dvbDevice->OsdDeviceHandle() : -1; osdDev = dvbDevice ? dvbDevice->OsdDeviceHandle() : -1;
if (osdDev < 0) if (dvbDevice && osdDev < 0)
esyslog("ERROR: illegal OSD device handle (%d)!", osdDev); esyslog("ERROR: illegal OSD device handle (%d)!", osdDev);
} }

17
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.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> #include <getopt.h>
@ -364,22 +364,33 @@ int main(int argc, char *argv[])
// Primary device: // Primary device:
cDevice::SetPrimaryDevice(Setup.PrimaryDVB); 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++) { for (int i = 0; i < cDevice::NumDevices(); i++) {
cDevice *d = cDevice::GetDevice(i); cDevice *d = cDevice::GetDevice(i);
if (d && d->HasDecoder()) { if (d && d->HasDecoder()) {
isyslog("trying device number %d instead", i + 1); isyslog("trying device number %d instead", i + 1);
if (cDevice::SetPrimaryDevice(i + 1)) if (cDevice::SetPrimaryDevice(i + 1)) {
Setup.PrimaryDVB = i + 1; Setup.PrimaryDVB = i + 1;
break;
} }
} }
} }
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()) { 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);
esyslog("ERROR: %s", msg); esyslog("ERROR: %s", msg);
return 2; return 2;
} }
}
}
// OSD: // OSD: