mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
New SVDRP command VOLU
This commit is contained in:
parent
7ada973f6c
commit
18ab84b0c1
@ -223,3 +223,4 @@ Bernd Schweikert <bernd.schweikert@dit-gmbh.de>
|
|||||||
|
|
||||||
Mirko Günther <mi.guenther@ib-helms.de>
|
Mirko Günther <mi.guenther@ib-helms.de>
|
||||||
for suggesting the -m command line option
|
for suggesting the -m command line option
|
||||||
|
for suggesting the SVDRP command VOLU
|
||||||
|
2
HISTORY
2
HISTORY
@ -1078,3 +1078,5 @@ Video Disk Recorder Revision History
|
|||||||
is currently being replayed.
|
is currently being replayed.
|
||||||
- New command line option '-m' to mute audio of the primary DVB device at
|
- New command line option '-m' to mute audio of the primary DVB device at
|
||||||
startup (suggested by Mirko Günther).
|
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
config.h
4
config.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __CONFIG_H
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#define VDRVERSION "1.0.0pre3"
|
#define VDRVERSION "1.0.0pre4"
|
||||||
|
|
||||||
#define MAXPRIORITY 99
|
#define MAXPRIORITY 99
|
||||||
#define MAXLIFETIME 99
|
#define MAXLIFETIME 99
|
||||||
|
4
dvbapi.h
4
dvbapi.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __DVBAPI_H
|
||||||
@ -44,6 +44,7 @@
|
|||||||
#define MINVIDEOFILESIZE 100 // 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);
|
const char *IndexToHMSF(int Index, bool WithFrame = false);
|
||||||
// Converts the given index to a string, optionally containing the frame number.
|
// Converts the given index to a string, optionally containing the frame number.
|
||||||
@ -307,6 +308,7 @@ private:
|
|||||||
bool mute;
|
bool mute;
|
||||||
int volume;
|
int volume;
|
||||||
public:
|
public:
|
||||||
|
bool IsMute(void) { return mute; }
|
||||||
void ToggleMute(void);
|
void ToggleMute(void);
|
||||||
// Turns the volume off or on.
|
// Turns the volume off or on.
|
||||||
void SetVolume(int Volume, bool Absolute = false);
|
void SetVolume(int Volume, bool Absolute = false);
|
||||||
|
33
svdrp.c
33
svdrp.c
@ -10,7 +10,7 @@
|
|||||||
* and interact with the Video Disk Recorder - or write a full featured
|
* and interact with the Video Disk Recorder - or write a full featured
|
||||||
* graphical interface that sits on top of an SVDRP connection.
|
* 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"
|
#include "svdrp.h"
|
||||||
@ -247,6 +247,12 @@ const char *HelpPages[] = {
|
|||||||
" Updates a timer. Settings must be in the same format as returned\n"
|
" 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"
|
" 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.",
|
" 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"
|
"QUIT\n"
|
||||||
" Exit vdr (SVDRP).\n"
|
" Exit vdr (SVDRP).\n"
|
||||||
" You can also hit Ctrl-D to exit.",
|
" You can also hit Ctrl-D to exit.",
|
||||||
@ -920,6 +926,28 @@ void cSVDRP::CmdUPDT(const char *Option)
|
|||||||
Reply(501, "Missing timer settings");
|
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)
|
#define CMD(c) (strcasecmp(Cmd, c) == 0)
|
||||||
|
|
||||||
void cSVDRP::Execute(char *Cmd)
|
void cSVDRP::Execute(char *Cmd)
|
||||||
@ -960,8 +988,9 @@ void cSVDRP::Execute(char *Cmd)
|
|||||||
else if (CMD("NEWC")) CmdNEWC(s);
|
else if (CMD("NEWC")) CmdNEWC(s);
|
||||||
else if (CMD("NEWT")) CmdNEWT(s);
|
else if (CMD("NEWT")) CmdNEWT(s);
|
||||||
else if (CMD("NEXT")) CmdNEXT(s);
|
else if (CMD("NEXT")) CmdNEXT(s);
|
||||||
else if (CMD("UPDT")) CmdUPDT(s);
|
|
||||||
else if (CMD("PUTE")) CmdPUTE(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 if (CMD("QUIT")) Close();
|
||||||
else Reply(500, "Command unrecognized: \"%s\"", Cmd);
|
else Reply(500, "Command unrecognized: \"%s\"", Cmd);
|
||||||
}
|
}
|
||||||
|
3
svdrp.h
3
svdrp.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __SVDRP_H
|
||||||
@ -73,6 +73,7 @@ private:
|
|||||||
void CmdNEXT(const char *Option);
|
void CmdNEXT(const char *Option);
|
||||||
void CmdPUTE(const char *Option);
|
void CmdPUTE(const char *Option);
|
||||||
void CmdUPDT(const char *Option);
|
void CmdUPDT(const char *Option);
|
||||||
|
void CmdVOLU(const char *Option);
|
||||||
void Execute(char *Cmd);
|
void Execute(char *Cmd);
|
||||||
public:
|
public:
|
||||||
cSVDRP(int Port);
|
cSVDRP(int Port);
|
||||||
|
4
vdr.c
4
vdr.c
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
* 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>
|
#include <getopt.h>
|
||||||
@ -50,8 +50,6 @@
|
|||||||
#define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown
|
#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 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 int Interrupted = 0;
|
||||||
|
|
||||||
static void SignalHandler(int signum)
|
static void SignalHandler(int signum)
|
||||||
|
Loading…
Reference in New Issue
Block a user