summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-02-02 15:49:46 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2001-02-02 15:49:46 +0100
commitb79ccf22921a93ee79d844e9f777ce5d6bf5ee3c (patch)
tree2005e91d27ed5b087f57450b17cba77f14c88597
parent495f8b06697a8478a130edd4a7f65ea59bdc9388 (diff)
downloadvdr-b79ccf22921a93ee79d844e9f777ce5d6bf5ee3c.tar.gz
vdr-b79ccf22921a93ee79d844e9f777ce5d6bf5ee3c.tar.bz2
New command line option -D
-rw-r--r--HISTORY2
-rw-r--r--config.h4
-rw-r--r--dvbapi.c50
-rw-r--r--dvbapi.h7
-rw-r--r--vdr.c18
5 files changed, 55 insertions, 26 deletions
diff --git a/HISTORY b/HISTORY
index ed881e07..82327f43 100644
--- a/HISTORY
+++ b/HISTORY
@@ -362,3 +362,5 @@ Video Disk Recorder Revision History
- The new compile time option REMOTE=NONE can be used to compile VDR without
any remote control support (for applications where it shall be controlled
exclusively via SVDRP).
+- The new command line option -D can be used to define which DVB interfaces
+ a certain instance of VDR shall use.
diff --git a/config.h b/config.h
index 277e957e..d2b4940a 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.38 2001/01/14 15:29:27 kls Exp $
+ * $Id: config.h 1.39 2001/02/02 15:22:47 kls Exp $
*/
#ifndef __CONFIG_H
@@ -19,7 +19,7 @@
#include "eit.h"
#include "tools.h"
-#define VDRVERSION "0.70"
+#define VDRVERSION "0.71"
#define MaxBuffer 10000
diff --git a/dvbapi.c b/dvbapi.c
index ffb3091a..f0b909b1 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.c 1.54 2001/02/02 13:10:39 kls Exp $
+ * $Id: dvbapi.c 1.55 2001/02/02 15:35:44 kls Exp $
*/
#include "dvbapi.h"
@@ -1570,6 +1570,7 @@ bool cVideoCutter::Active(void)
// --- cDvbApi ---------------------------------------------------------------
int cDvbApi::NumDvbApis = 0;
+int cDvbApi::useDvbApi = 0;
cDvbApi *cDvbApi::dvbApi[MAXDVBAPI] = { NULL };
cDvbApi *cDvbApi::PrimaryDvbApi = NULL;
@@ -1639,6 +1640,12 @@ cDvbApi::~cDvbApi()
#endif
}
+void cDvbApi::SetUseDvbApi(int n)
+{
+ if (n < MAXDVBAPI)
+ useDvbApi |= (1 << n);
+}
+
bool cDvbApi::SetPrimaryDvbApi(int n)
{
n--;
@@ -1685,33 +1692,34 @@ bool cDvbApi::Init(void)
{
NumDvbApis = 0;
for (int i = 0; i < MAXDVBAPI; i++) {
- char fileName[strlen(VIDEODEVICE) + 10];
- sprintf(fileName, "%s%d", VIDEODEVICE, i);
- if (access(fileName, F_OK | R_OK | W_OK) == 0) {
- dsyslog(LOG_INFO, "probing %s", fileName);
- int f = open(fileName, O_RDWR);
- if (f >= 0) {
- struct video_capability cap;
- int r = ioctl(f, VIDIOCGCAP, &cap);
- close(f);
- if (r == 0 && (cap.type & VID_TYPE_DVB)) {
- char vbiFileName[strlen(VBIDEVICE) + 10];
- sprintf(vbiFileName, "%s%d", VBIDEVICE, i);
- dvbApi[i] = new cDvbApi(fileName, vbiFileName);
- NumDvbApis++;
+ if (useDvbApi == 0 || (useDvbApi & (1 << i)) != 0) {
+ char fileName[strlen(VIDEODEVICE) + 10];
+ sprintf(fileName, "%s%d", VIDEODEVICE, i);
+ if (access(fileName, F_OK | R_OK | W_OK) == 0) {
+ dsyslog(LOG_INFO, "probing %s", fileName);
+ int f = open(fileName, O_RDWR);
+ if (f >= 0) {
+ struct video_capability cap;
+ int r = ioctl(f, VIDIOCGCAP, &cap);
+ close(f);
+ if (r == 0 && (cap.type & VID_TYPE_DVB)) {
+ char vbiFileName[strlen(VBIDEVICE) + 10];
+ sprintf(vbiFileName, "%s%d", VBIDEVICE, i);
+ dvbApi[NumDvbApis++] = new cDvbApi(fileName, vbiFileName);
+ }
+ }
+ else {
+ if (errno != ENODEV)
+ LOG_ERROR_STR(fileName);
+ break;
}
}
else {
- if (errno != ENODEV)
+ if (errno != ENOENT)
LOG_ERROR_STR(fileName);
break;
}
}
- else {
- if (errno != ENOENT)
- LOG_ERROR_STR(fileName);
- break;
- }
}
PrimaryDvbApi = dvbApi[0];
if (NumDvbApis > 0) {
diff --git a/dvbapi.h b/dvbapi.h
index cf0584f8..ea92a040 100644
--- a/dvbapi.h
+++ b/dvbapi.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.h 1.30 2001/01/07 15:56:10 kls Exp $
+ * $Id: dvbapi.h 1.31 2001/02/02 15:21:30 kls Exp $
*/
#ifndef __DVBAPI_H
@@ -73,8 +73,13 @@ public:
static int NumDvbApis;
private:
static cDvbApi *dvbApi[MAXDVBAPI];
+ static int useDvbApi;
public:
static cDvbApi *PrimaryDvbApi;
+ static void SetUseDvbApi(int n);
+ // Sets the 'useDvbApi' flag of the given DVB device.
+ // If this function is not called before Init(), all DVB devices
+ // will be used.
static bool SetPrimaryDvbApi(int n);
// Sets the primary DVB device to 'n' (which must be in the range
// 1...NumDvbApis) and returns true if this was possible.
diff --git a/vdr.c b/vdr.c
index 698cc7a6..b0bb4973 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.49 2001/01/14 15:29:51 kls Exp $
+ * $Id: vdr.c 1.50 2001/02/02 15:48:11 kls Exp $
*/
#include <getopt.h>
@@ -66,6 +66,7 @@ int main(int argc, char *argv[])
static struct option long_options[] = {
{ "config", required_argument, NULL, 'c' },
{ "daemon", no_argument, NULL, 'd' },
+ { "device", required_argument, NULL, 'D' },
{ "help", no_argument, NULL, 'h' },
{ "log", required_argument, NULL, 'l' },
{ "port", required_argument, NULL, 'p' },
@@ -75,16 +76,29 @@ int main(int argc, char *argv[])
int c;
int option_index = 0;
- while ((c = getopt_long(argc, argv, "c:dhl:p:v:", long_options, &option_index)) != -1) {
+ while ((c = getopt_long(argc, argv, "c:dD:hl:p:v:", long_options, &option_index)) != -1) {
switch (c) {
case 'c': ConfigDirectory = optarg;
break;
case 'd': DaemonMode = true; break;
+ case 'D': if (isnumber(optarg)) {
+ int n = atoi(optarg);
+ if (0 <= n && n < MAXDVBAPI) {
+ cDvbApi::SetUseDvbApi(n);
+ break;
+ }
+ }
+ fprintf(stderr, "vdr: invalid DVB device number: %s\n", optarg);
+ abort();
+ break;
case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80|
" -c DIR, --config=DIR read config files from DIR (default is to read them\n"
" from the video directory)\n"
" -h, --help display this help and exit\n"
" -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"
" -l LEVEL, --log=LEVEL set log level (default: 3)\n"
" 0 = no logging, 1 = errors only,\n"
" 2 = errors and info, 3 = errors, info and debug\n"