diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-03-09 10:07:40 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-03-09 10:07:40 +0100 |
commit | 18ab84b0c108763f6c591abdbea228faabfdea1c (patch) | |
tree | 564ac04e0f8dfb51ce6f536ee7f4a47408002b6a /svdrp.c | |
parent | 7ada973f6c9672f704e183310d733b1579b0d5b4 (diff) | |
download | vdr-18ab84b0c108763f6c591abdbea228faabfdea1c.tar.gz vdr-18ab84b0c108763f6c591abdbea228faabfdea1c.tar.bz2 |
New SVDRP command VOLU
Diffstat (limited to 'svdrp.c')
-rw-r--r-- | svdrp.c | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -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); } |