From fa701228d76e329161f84057c7bb5693026c3fa3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 18 Apr 2015 14:30:47 +0200 Subject: [PATCH] The command line option -D now accepts the value '-' (as in -D-), which prevents VDR from using any DVB devices --- CONTRIBUTORS | 1 + HISTORY | 2 ++ dvbdevice.c | 5 +++-- dvbdevice.h | 3 ++- vdr.1 | 4 +++- vdr.c | 12 +++++++++--- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b293b066..fc916edc 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3351,6 +3351,7 @@ Dietmar Spingler for reporting a problem that led to a fix with EMM pids not being properly reset for CAMs that need to receive the TS for suggesting to add the channel name to log messages that reference a channel + for suggesting to provide a way of using no DVB devices at all Stefan Schallenberg for adding the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement() diff --git a/HISTORY b/HISTORY index b1683a1e..6f725f6a 100644 --- a/HISTORY +++ b/HISTORY @@ -8631,3 +8631,5 @@ Video Disk Recorder Revision History pressing '0', the default no longer applies to that folder. Repeating timers no longer write a ".sort" file into a recordings folder to have the recordings sorted by time. +- The command line option -D now accepts the value '-' (as in -D-), which prevents + VDR from using any DVB devices (suggested by Dietmar Spingler). diff --git a/dvbdevice.c b/dvbdevice.c index 9321f16d..0a57c67c 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 3.14 2015/01/14 12:09:19 kls Exp $ + * $Id: dvbdevice.c 4.1 2015/04/18 14:21:58 kls Exp $ */ #include "dvbdevice.h" @@ -1064,6 +1064,7 @@ cOsdItem *cDvbSourceParam::GetOsdItem(void) // --- cDvbDevice ------------------------------------------------------------ +bool cDvbDevice::useDvbDevices = true; int cDvbDevice::setTransferModeForDolbyDigital = 1; cMutex cDvbDevice::bondMutex; @@ -1234,7 +1235,7 @@ bool cDvbDevice::Initialize(void) if (Exists(Adapter, Frontend)) { if (Found < MAXDEVICES) { Found++; - if (UseDevice(NextCardIndex())) { + if (useDvbDevices && UseDevice(NextCardIndex())) { if (Probe(Adapter, Frontend)) Used++; } diff --git a/dvbdevice.h b/dvbdevice.h index 0a148ce3..5ae4952f 100644 --- a/dvbdevice.h +++ b/dvbdevice.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.h 3.5 2014/03/16 10:38:31 kls Exp $ + * $Id: dvbdevice.h 4.1 2015/04/18 13:57:27 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -174,6 +174,7 @@ private: static bool Probe(int Adapter, int Frontend); ///< Probes for existing DVB devices. public: + static bool useDvbDevices; static bool Initialize(void); ///< Initializes the DVB devices. ///< Must be called before accessing any DVB functions. diff --git a/vdr.1 b/vdr.1 index 845cfa33..3d908201 100644 --- a/vdr.1 +++ b/vdr.1 @@ -8,7 +8,7 @@ .\" License as specified in the file COPYING that comes with the .\" vdr distribution. .\" -.\" $Id: vdr.1 3.6 2015/02/17 13:43:24 kls Exp $ +.\" $Id: vdr.1 4.1 2015/04/18 14:25:07 kls Exp $ .\" .TH vdr 1 "19 Feb 2015" "2.2" "Video Disk Recorder" .SH NAME @@ -64,6 +64,8 @@ Run in daemon mode (implies \-\-no\-kbd). .BI \-D\ num ,\ \-\-device= num Use only the given DVB device (\fInum\fR = 0, 1, 2...). There may be several \fB\-D\fR options (by default all DVB devices will be used). +If \fB\-D\-\fR is given, no DVB devices will be used at all, independent of any +other \-D options. .TP .BI \-\-dirnames= path [, name [, enc ]] Set the maximum directory path length to \fIpath\fR (default is the maximum value diff --git a/vdr.c b/vdr.c index 71a72f2e..0243a297 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.tvdr.de * - * $Id: vdr.c 3.16 2015/02/10 14:13:12 kls Exp $ + * $Id: vdr.c 4.1 2015/04/18 14:22:47 kls Exp $ */ #include @@ -301,7 +301,11 @@ int main(int argc, char *argv[]) break; case 'd': DaemonMode = true; break; - case 'D': if (isnumber(optarg)) { + case 'D': if (*optarg == '-') { + cDvbDevice::useDvbDevices = false; + break; + } + if (isnumber(optarg)) { int n = atoi(optarg); if (0 <= n && n < MAXDEVICES) { cDevice::SetUseDevice(n); @@ -536,7 +540,9 @@ int main(int argc, char *argv[]) " -d, --daemon run in daemon mode\n" " -D NUM, --device=NUM use only the given DVB device (NUM = 0, 1, 2...)\n" " there may be several -D options (default: all DVB\n" - " devices will be used)\n" + " devices will be used); if -D- is given, no DVB\n" + " devices will be used at all, independent of any\n" + " other -D options\n" " --dirnames=PATH[,NAME[,ENC]]\n" " set the maximum directory path length to PATH\n" " (default: %d); if NAME is also given, it defines\n"