mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00: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:
		
							
								
								
									
										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).
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								device.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								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,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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
									
								
								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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								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,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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user