diff options
Diffstat (limited to 'vdr.c')
-rw-r--r-- | vdr.c | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.98 2002/03/03 14:56:03 kls Exp $ + * $Id: vdr.c 1.101 2002/03/09 17:10:16 kls Exp $ */ #include <getopt.h> @@ -50,8 +50,6 @@ #define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown #define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start -#define VOLUMEDELTA 5 // used to increase/decrease the volume - static int Interrupted = 0; static void SignalHandler(int signum) @@ -85,6 +83,7 @@ int main(int argc, char *argv[]) int SVDRPport = DEFAULTSVDRPPORT; const char *ConfigDirectory = NULL; bool DaemonMode = false; + bool MuteAudio = false; int WatchdogTimeout = DEFAULTWATCHDOG; const char *Terminal = NULL; const char *Shutdown = NULL; @@ -97,6 +96,7 @@ int main(int argc, char *argv[]) { "epgfile", required_argument, NULL, 'E' }, { "help", no_argument, NULL, 'h' }, { "log", required_argument, NULL, 'l' }, + { "mute", no_argument, NULL, 'm' }, { "port", required_argument, NULL, 'p' }, { "record", required_argument, NULL, 'r' }, { "shutdown", required_argument, NULL, 's' }, @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) int c; int option_index = 0; - while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:p:r:s:t:v:w:", long_options, &option_index)) != -1) { + while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:mp:r:s:t:v:w:", long_options, &option_index)) != -1) { switch (c) { case 'a': cDvbApi::SetAudioCommand(optarg); break; @@ -143,6 +143,7 @@ int main(int argc, char *argv[]) " -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" + " -m, --mute mute audio of the primary DVB device at startup\n" " -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n" " 0 turns off SVDRP\n" " -r CMD, --record=CMD call CMD before and after a recording\n" @@ -170,6 +171,8 @@ int main(int argc, char *argv[]) fprintf(stderr, "vdr: invalid log level: %s\n", optarg); return 2; break; + case 'm': MuteAudio = true; + break; case 'p': if (isnumber(optarg)) SVDRPport = atoi(optarg); else { @@ -269,7 +272,10 @@ int main(int argc, char *argv[]) cSIProcessor::Read(); Channels.SwitchTo(Setup.CurrentChannel); - cDvbApi::PrimaryDvbApi->SetVolume(Setup.CurrentVolume, true); + if (MuteAudio) + cDvbApi::PrimaryDvbApi->ToggleMute(); + else + cDvbApi::PrimaryDvbApi->SetVolume(Setup.CurrentVolume, true); cEITScanner EITScanner; @@ -351,10 +357,16 @@ int main(int argc, char *argv[]) case kVolUp: case kVolDn|k_Repeat: case kVolDn: - cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA); - break; case kMute: - cDvbApi::PrimaryDvbApi->ToggleMute(); + if (key == kMute) { + if (!cDvbApi::PrimaryDvbApi->ToggleMute() && !Menu) + break; // no need to display "mute off" + } + else + cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA); + if (!Menu && (!ReplayControl || !ReplayControl->Visible())) + Menu = cDisplayVolume::Create(); + cDisplayVolume::Process(key); break; // Power off: case kPower: isyslog(LOG_INFO, "Power button pressed"); |