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
|
- 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
|
any remote control support (for applications where it shall be controlled
|
||||||
exclusively via SVDRP).
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __CONFIG_H
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#define VDRVERSION "0.70"
|
#define VDRVERSION "0.71"
|
||||||
|
|
||||||
#define MaxBuffer 10000
|
#define MaxBuffer 10000
|
||||||
|
|
||||||
|
14
dvbapi.c
14
dvbapi.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "dvbapi.h"
|
||||||
@ -1570,6 +1570,7 @@ bool cVideoCutter::Active(void)
|
|||||||
// --- cDvbApi ---------------------------------------------------------------
|
// --- cDvbApi ---------------------------------------------------------------
|
||||||
|
|
||||||
int cDvbApi::NumDvbApis = 0;
|
int cDvbApi::NumDvbApis = 0;
|
||||||
|
int cDvbApi::useDvbApi = 0;
|
||||||
cDvbApi *cDvbApi::dvbApi[MAXDVBAPI] = { NULL };
|
cDvbApi *cDvbApi::dvbApi[MAXDVBAPI] = { NULL };
|
||||||
cDvbApi *cDvbApi::PrimaryDvbApi = NULL;
|
cDvbApi *cDvbApi::PrimaryDvbApi = NULL;
|
||||||
|
|
||||||
@ -1639,6 +1640,12 @@ cDvbApi::~cDvbApi()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cDvbApi::SetUseDvbApi(int n)
|
||||||
|
{
|
||||||
|
if (n < MAXDVBAPI)
|
||||||
|
useDvbApi |= (1 << n);
|
||||||
|
}
|
||||||
|
|
||||||
bool cDvbApi::SetPrimaryDvbApi(int n)
|
bool cDvbApi::SetPrimaryDvbApi(int n)
|
||||||
{
|
{
|
||||||
n--;
|
n--;
|
||||||
@ -1685,6 +1692,7 @@ bool cDvbApi::Init(void)
|
|||||||
{
|
{
|
||||||
NumDvbApis = 0;
|
NumDvbApis = 0;
|
||||||
for (int i = 0; i < MAXDVBAPI; i++) {
|
for (int i = 0; i < MAXDVBAPI; i++) {
|
||||||
|
if (useDvbApi == 0 || (useDvbApi & (1 << i)) != 0) {
|
||||||
char fileName[strlen(VIDEODEVICE) + 10];
|
char fileName[strlen(VIDEODEVICE) + 10];
|
||||||
sprintf(fileName, "%s%d", VIDEODEVICE, i);
|
sprintf(fileName, "%s%d", VIDEODEVICE, i);
|
||||||
if (access(fileName, F_OK | R_OK | W_OK) == 0) {
|
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)) {
|
if (r == 0 && (cap.type & VID_TYPE_DVB)) {
|
||||||
char vbiFileName[strlen(VBIDEVICE) + 10];
|
char vbiFileName[strlen(VBIDEVICE) + 10];
|
||||||
sprintf(vbiFileName, "%s%d", VBIDEVICE, i);
|
sprintf(vbiFileName, "%s%d", VBIDEVICE, i);
|
||||||
dvbApi[i] = new cDvbApi(fileName, vbiFileName);
|
dvbApi[NumDvbApis++] = new cDvbApi(fileName, vbiFileName);
|
||||||
NumDvbApis++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1713,6 +1720,7 @@ bool cDvbApi::Init(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
PrimaryDvbApi = dvbApi[0];
|
PrimaryDvbApi = dvbApi[0];
|
||||||
if (NumDvbApis > 0) {
|
if (NumDvbApis > 0) {
|
||||||
isyslog(LOG_INFO, "found %d video device%s", NumDvbApis, NumDvbApis > 1 ? "s" : "");
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __DVBAPI_H
|
||||||
@ -73,8 +73,13 @@ public:
|
|||||||
static int NumDvbApis;
|
static int NumDvbApis;
|
||||||
private:
|
private:
|
||||||
static cDvbApi *dvbApi[MAXDVBAPI];
|
static cDvbApi *dvbApi[MAXDVBAPI];
|
||||||
|
static int useDvbApi;
|
||||||
public:
|
public:
|
||||||
static cDvbApi *PrimaryDvbApi;
|
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);
|
static bool SetPrimaryDvbApi(int n);
|
||||||
// Sets the primary DVB device to 'n' (which must be in the range
|
// Sets the primary DVB device to 'n' (which must be in the range
|
||||||
// 1...NumDvbApis) and returns true if this was possible.
|
// 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
|
* 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>
|
#include <getopt.h>
|
||||||
@ -66,6 +66,7 @@ int main(int argc, char *argv[])
|
|||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "config", required_argument, NULL, 'c' },
|
{ "config", required_argument, NULL, 'c' },
|
||||||
{ "daemon", no_argument, NULL, 'd' },
|
{ "daemon", no_argument, NULL, 'd' },
|
||||||
|
{ "device", required_argument, NULL, 'D' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "log", required_argument, NULL, 'l' },
|
{ "log", required_argument, NULL, 'l' },
|
||||||
{ "port", required_argument, NULL, 'p' },
|
{ "port", required_argument, NULL, 'p' },
|
||||||
@ -75,16 +76,29 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
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) {
|
switch (c) {
|
||||||
case 'c': ConfigDirectory = optarg;
|
case 'c': ConfigDirectory = optarg;
|
||||||
break;
|
break;
|
||||||
case 'd': DaemonMode = true; 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|
|
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"
|
" -c DIR, --config=DIR read config files from DIR (default is to read them\n"
|
||||||
" from the video directory)\n"
|
" from the video directory)\n"
|
||||||
" -h, --help display this help and exit\n"
|
" -h, --help display this help and exit\n"
|
||||||
" -d, --daemon run in daemon mode\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"
|
" -l LEVEL, --log=LEVEL set log level (default: 3)\n"
|
||||||
" 0 = no logging, 1 = errors only,\n"
|
" 0 = no logging, 1 = errors only,\n"
|
||||||
" 2 = errors and info, 3 = errors, info and debug\n"
|
" 2 = errors and info, 3 = errors, info and debug\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user