summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-03-09 10:07:40 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-03-09 10:07:40 +0100
commit18ab84b0c108763f6c591abdbea228faabfdea1c (patch)
tree564ac04e0f8dfb51ce6f536ee7f4a47408002b6a
parent7ada973f6c9672f704e183310d733b1579b0d5b4 (diff)
downloadvdr-18ab84b0c108763f6c591abdbea228faabfdea1c.tar.gz
vdr-18ab84b0c108763f6c591abdbea228faabfdea1c.tar.bz2
New SVDRP command VOLU
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--config.h4
-rw-r--r--dvbapi.h6
-rw-r--r--svdrp.c33
-rw-r--r--svdrp.h3
-rw-r--r--vdr.c4
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
diff --git a/HISTORY b/HISTORY
index c97193c8..93d27d9e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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).
diff --git a/config.h b/config.h
index f5e83435..1913764f 100644
--- a/config.h
+++ b/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.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
diff --git a/dvbapi.h b/dvbapi.h
index 9e0bc58f..1767877d 100644
--- a/dvbapi.h
+++ b/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.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);
diff --git a/svdrp.c b/svdrp.c
index 228003ea..06f8ebbc 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -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);
}
diff --git a/svdrp.h b/svdrp.h
index 42e5b691..29ef83cd 100644
--- a/svdrp.h
+++ b/svdrp.h
@@ -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);
diff --git a/vdr.c b/vdr.c
index daf0baaf..922bdcaa 100644
--- a/vdr.c
+++ b/vdr.c
@@ -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)