diff options
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | config.h | 4 | ||||
-rw-r--r-- | dvbapi.h | 6 | ||||
-rw-r--r-- | svdrp.c | 33 | ||||
-rw-r--r-- | svdrp.h | 3 | ||||
-rw-r--r-- | vdr.c | 4 |
7 files changed, 43 insertions, 10 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index bdf43032..03e8bbe7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -223,3 +223,4 @@ Bernd Schweikert <bernd.schweikert@dit-gmbh.de> Mirko Günther <mi.guenther@ib-helms.de> for suggesting the -m command line option + for suggesting the SVDRP command VOLU @@ -1078,3 +1078,5 @@ Video Disk Recorder Revision History is currently being replayed. - New command line option '-m' to mute audio of the primary DVB device at startup (suggested by Mirko Günther). +- The new SVDRP command VOLU can be used to control the audio volume (suggested + by Mirko Günther). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.102 2002/03/03 16:04:43 kls Exp $ + * $Id: config.h 1.103 2002/03/08 17:59:02 kls Exp $ */ #ifndef __CONFIG_H @@ -19,7 +19,7 @@ #include "eit.h" #include "tools.h" -#define VDRVERSION "1.0.0pre3" +#define VDRVERSION "1.0.0pre4" #define MAXPRIORITY 99 #define MAXLIFETIME 99 @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.65 2002/03/08 15:11:50 kls Exp $ + * $Id: dvbapi.h 1.66 2002/03/08 17:16:31 kls Exp $ */ #ifndef __DVBAPI_H @@ -43,7 +43,8 @@ #define MAXVIDEOFILESIZE 2000 // MB #define MINVIDEOFILESIZE 100 // MB -#define MAXVOLUME 255 +#define MAXVOLUME 255 +#define VOLUMEDELTA 5 // used to increase/decrease the volume const char *IndexToHMSF(int Index, bool WithFrame = false); // Converts the given index to a string, optionally containing the frame number. @@ -307,6 +308,7 @@ private: bool mute; int volume; public: + bool IsMute(void) { return mute; } void ToggleMute(void); // Turns the volume off or on. void SetVolume(int Volume, bool Absolute = false); @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 1.33 2002/02/24 14:16:03 kls Exp $ + * $Id: svdrp.c 1.34 2002/03/08 17:17:05 kls Exp $ */ #include "svdrp.h" @@ -247,6 +247,12 @@ const char *HelpPages[] = { " Updates a timer. Settings must be in the same format as returned\n" " by the LSTT command. If a timer with the same channel, day, start\n" " and stop time does not yet exists, it will be created.", + "VOLU [ <number> | + | - | mute ]\n" + " Set the audio volume to the given number (which is limited to the range\n" + " 0...255). If the special options '+' or '-' are given, the volume will\n" + " be turned up or down, respectively. The option 'mute' will toggle the\n" + " audio muting. If no option is given, the current audio volume level will\n" + " be returned.", "QUIT\n" " Exit vdr (SVDRP).\n" " You can also hit Ctrl-D to exit.", @@ -920,6 +926,28 @@ void cSVDRP::CmdUPDT(const char *Option) Reply(501, "Missing timer settings"); } +void cSVDRP::CmdVOLU(const char *Option) +{ + if (*Option) { + if (isnumber(Option)) + cDvbApi::PrimaryDvbApi->SetVolume(strtol(Option, NULL, 10), true); + else if (strcmp(Option, "+") == 0) + cDvbApi::PrimaryDvbApi->SetVolume(VOLUMEDELTA); + else if (strcmp(Option, "-") == 0) + cDvbApi::PrimaryDvbApi->SetVolume(-VOLUMEDELTA); + else if (strcasecmp(Option, "MUTE") == 0) + cDvbApi::PrimaryDvbApi->ToggleMute(); + else { + Reply(501, "Unknown option: \"%s\"", Option); + return; + } + } + if (cDvbApi::PrimaryDvbApi->IsMute()) + Reply(250, "Audio is mute"); + else + Reply(250, "Audio volume is %d", cDvbApi::CurrentVolume()); +} + #define CMD(c) (strcasecmp(Cmd, c) == 0) void cSVDRP::Execute(char *Cmd) @@ -960,8 +988,9 @@ void cSVDRP::Execute(char *Cmd) else if (CMD("NEWC")) CmdNEWC(s); else if (CMD("NEWT")) CmdNEWT(s); else if (CMD("NEXT")) CmdNEXT(s); - else if (CMD("UPDT")) CmdUPDT(s); else if (CMD("PUTE")) CmdPUTE(s); + else if (CMD("UPDT")) CmdUPDT(s); + else if (CMD("VOLU")) CmdVOLU(s); else if (CMD("QUIT")) Close(); else Reply(500, "Command unrecognized: \"%s\"", Cmd); } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: svdrp.h 1.14 2002/02/24 10:48:21 kls Exp $ + * $Id: svdrp.h 1.15 2002/03/08 16:40:23 kls Exp $ */ #ifndef __SVDRP_H @@ -73,6 +73,7 @@ private: void CmdNEXT(const char *Option); void CmdPUTE(const char *Option); void CmdUPDT(const char *Option); + void CmdVOLU(const char *Option); void Execute(char *Cmd); public: cSVDRP(int Port); @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.99 2002/03/08 16:34:29 kls Exp $ + * $Id: vdr.c 1.100 2002/03/08 17:14:43 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) |