Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] [PATCH] set channel on command line
Hello,
Here is a little patch for vdr-1.3.11 that allows you to set the channel
to start on, on the command line. I find this especially useful for
testing when brining VDR up and down often. Some people may also like
to startup VDR on the same channel all the time as well.
The flags are -C and --channel=, ie: vdr -C50. I hope someone finds
this useful and maybe it could be included in VDR by default. Enjoy. :)
-Rob
--- vdr-1.3.11-orig/vdr.c 2004-06-13 10:52:09.000000000 -0300
+++ vdr-1.3.11/vdr.c 2004-07-12 13:53:28.000000000 -0300
@@ -126,6 +126,7 @@
bool DisplayHelp = false;
bool DisplayVersion = false;
bool DaemonMode = false;
+ int StartupChannel = 0;
int SysLogTarget = LOG_USER;
bool MuteAudio = false;
int WatchdogTimeout = DEFAULTWATCHDOG;
@@ -135,6 +136,7 @@
static struct option long_options[] = {
{ "audio", required_argument, NULL, 'a' },
+ { "channel", required_argument, NULL, 'C' },
{ "config", required_argument, NULL, 'c' },
{ "daemon", no_argument, NULL, 'd' },
{ "device", required_argument, NULL, 'D' },
@@ -155,12 +157,18 @@
};
int c;
- while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:L:mp:P:r:s:t:v:Vw:", long_options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "a:c:C:dD:E:hl:L:mp:P:r:s:t:v:Vw:", long_options, NULL)) != -1) {
switch (c) {
case 'a': AudioCommand = optarg;
break;
case 'c': ConfigDirectory = optarg;
break;
+ case 'C': if (isnumber(optarg)) {
+ StartupChannel = atoi(optarg);
+ break;
+ }
+ fprintf(stderr, "vdr: invalid channel number (%s), using default\n", optarg);
+ break;
case 'd': DaemonMode = true; break;
case 'D': if (isnumber(optarg)) {
int n = atoi(optarg);
@@ -260,6 +268,7 @@
" -a CMD, --audio=CMD send Dolby Digital audio to stdin of command CMD\n"
" -c DIR, --config=DIR read config files from DIR (default is to read them\n"
" from the video directory)\n"
+ " -C CH, --channel=CH switch to channel CH on startup\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"
@@ -469,7 +478,11 @@
// Channel:
- Channels.SwitchTo(Setup.CurrentChannel);
+ if (StartupChannel > 0)
+ Channels.SwitchTo(StartupChannel);
+ else
+ Channels.SwitchTo(Setup.CurrentChannel);
+
if (MuteAudio)
cDevice::PrimaryDevice()->ToggleMute();
else
Home |
Main Index |
Thread Index