mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
New command line option -D
This commit is contained in:
parent
495f8b0669
commit
b79ccf2292
2
HISTORY
2
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.
|
||||
|
4
config.h
4
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
|
||||
|
||||
|
14
dvbapi.c
14
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,6 +1692,7 @@ bool cDvbApi::Init(void)
|
||||
{
|
||||
NumDvbApis = 0;
|
||||
for (int i = 0; i < MAXDVBAPI; i++) {
|
||||
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) {
|
||||
@ -1697,8 +1705,7 @@ bool cDvbApi::Init(void)
|
||||
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++;
|
||||
dvbApi[NumDvbApis++] = new cDvbApi(fileName, vbiFileName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1713,6 +1720,7 @@ bool cDvbApi::Init(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
PrimaryDvbApi = dvbApi[0];
|
||||
if (NumDvbApis > 0) {
|
||||
isyslog(LOG_INFO, "found %d video device%s", NumDvbApis, NumDvbApis > 1 ? "s" : "");
|
||||
|
7
dvbapi.h
7
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.
|
||||
|
18
vdr.c
18
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"
|
||||
|
Loading…
Reference in New Issue
Block a user