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:
parent
f8a7e51d00
commit
00166dac5f
2
HISTORY
2
HISTORY
@ -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).
|
||||
|
7
device.c
7
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.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,7 +106,6 @@ 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);
|
||||
@ -114,10 +113,6 @@ bool cDevice::SetPrimaryDevice(int n)
|
||||
primaryDevice->MakePrimaryDevice(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);
|
||||
return false;
|
||||
}
|
||||
|
@ -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,6 +397,7 @@ bool cDvbDevice::Initialize(void)
|
||||
|
||||
void cDvbDevice::MakePrimaryDevice(bool On)
|
||||
{
|
||||
if (HasDecoder())
|
||||
cDvbOsd::SetDvbDevice(On ? this : NULL);
|
||||
}
|
||||
|
||||
|
4
dvbosd.c
4
dvbosd.c
@ -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);
|
||||
}
|
||||
|
||||
|
17
vdr.c
17
vdr.c
@ -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,22 +364,33 @@ 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 - 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:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user