summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2001-11-04 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2001-11-04 18:00:00 +0100
commit6e1fd835558b4e70ad94a280a209f050ec0f7a75 (patch)
treec7807d423152fecf6e7fd98aaa6fb69324238431 /svdrp.c
parent8465398c6d2a57bc30a07fb61353a7c8ba6db574 (diff)
downloadvdr-patch-lnbsharing-6e1fd835558b4e70ad94a280a209f050ec0f7a75.tar.gz
vdr-patch-lnbsharing-6e1fd835558b4e70ad94a280a209f050ec0f7a75.tar.bz2
Version 0.98vdr-0.98
- Completed storing the current audio volume in the setup.conf file (thanks to Andy Grobb). - Fixed closing the progress display with the "Back" key when in trick mode and Setup.ShowReplayMode is enabled (thanks to Stefan Huelswitt). - New SVDRP commands LSTR and DELR to list and delete recordings (thanks to Thomas Heiligenmann). - Fixed a crash when pressing the '2' button while replaying a DVD. - Updated 'channels.conf' for the "Bundesliga" channels of Premiere World (thanks to Mel Schächner). - Changed the tuning code to use FrontendInfo to detect the type of DVB card. - Removed the recursion stuff from cThread (cMutex already does this). - Fixed handling the repeat function in the channel display. - Avoiding multiple EPG entries for the same event (thanks to Rolf Hakenes for some valuable information on how to do this). - A recording on the primary interface can now be stopped to make it continue on an other free DVB card (if one is free at the moment). See MANUAL for details. - Added some missing teletext PIDs (thanks to Norbert Schmidt). - Added PTS to the converted PCM audio when replaying a DVD (thanks to Andreas Schultz). Now the audio and video of a DVD replayed over the DVB card's A/V out should always be in sync. - Fixed handling the "Power" key in case Setup.MinUserInactivity is set to 0 to disable automatic shutdown. - Added a fifth parameter to the 'shutdown' call that indicates the reason for this shutdown request (see INSTALL). - Fixed releasing 'index' memory after recording or playback. - Fixed ejecting a DVD while it is being replayed. - Removed all video overlay stuff from cDvbApi and SVDRP. Guido Fiala's new 'kvdr' version 0.4 now does these things itself. As a consequence of this you will now need to use kvdr 0.4 or later. - The device /dev/video is now opened only if necessary (to GRAB an image), allowing other programs (like 'kvdr', for instance) to use that device.
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c183
1 files changed, 66 insertions, 117 deletions
diff --git a/svdrp.c b/svdrp.c
index 43c55e4..48c9563 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.25 2001/10/07 15:13:42 kls Exp $
+ * $Id: svdrp.c 1.27 2001/11/04 11:25:05 kls Exp $
*/
#include "svdrp.h"
@@ -27,6 +27,7 @@
#include <sys/time.h>
#include <unistd.h>
#include "config.h"
+#include "dvbapi.h"
#include "interface.h"
#include "tools.h"
@@ -120,6 +121,12 @@ const char *HelpPages[] = {
" it returns the current channel number and name.",
"DELC <number>\n"
" Delete channel.",
+ "DELR <number>\n"
+ " Delete the recording with the given number. Before a recording can be\n"
+ " deleted, an LSTR command must have been executed in order to retrieve\n"
+ " the recording numbers. The numbers don't change during subsequent DELR\n"
+ " commands. CAUTION: THERE IS NO CONFIRMATION PROMPT WHEN DELETING A\n"
+ " RECORDING - BE SURE YOU KNOW WHAT YOU ARE DOING!",
"DELT <number>\n"
" Delete timer.",
"GRAB <filename> [ jpeg | pnm [ <quality> [ <sizex> <sizey> ] ] ]\n"
@@ -137,6 +144,9 @@ const char *HelpPages[] = {
" containing the given string as part of their name are listed.",
"LSTE\n"
" List EPG data.",
+ "LSTR [ <number> ]\n"
+ " List recordings. Without option, all recordings are listed. Otherwise\n"
+ " the summary for the given recording is listed.",
"LSTT [ <number> ]\n"
" List timers. Without option, all timers are listed. Otherwise\n"
" only the given timer is listed.",
@@ -174,16 +184,6 @@ const char *HelpPages[] = {
" zero, this means that the timer is currently recording and has started\n"
" at the given time. The first value in the resulting line is the number\n"
" of the timer.",
- "OVLF <sizex> <sizey> <fbaddr> <bpp> <palette>\n"
- " Set the size, address depth and palette of the overlay.",
- "OVLG <sizex> <sizey> <posx> <posy>\n"
- " Set the size and position of the overlay.",
- "OVLC <clipcount> <base16-CRect-array>\n"
- " Set the overlay clipping rectangles.",
- "OVLP <brightness> <colour> <hue> <contrast>\n"
- " Set the picture parameters for the overlay.",
- "OVLO 0 | 1\n"
- " Switch the overlay on or off.",
"UPDT <settings>\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"
@@ -278,7 +278,6 @@ bool cSVDRP::Send(const char *s, int length)
if (wbytes < 0) {
LOG_ERROR;
file.Close();
- cDvbApi::PrimaryDvbApi->OvlO(false);
}
else //XXX while...???
esyslog(LOG_ERR, "Wrote %d bytes to client while expecting %d\n", wbytes, length);
@@ -380,6 +379,27 @@ void cSVDRP::CmdDELC(const char *Option)
Reply(502, "DELC not yet implemented");
}
+void cSVDRP::CmdDELR(const char *Option)
+{
+ if (*Option) {
+ if (isnumber(Option)) {
+ cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1);
+ if (recording) {
+ if (recording->Delete())
+ Reply(250, "Recording \"%s\" deleted", Option);
+ else
+ Reply(554, "Error while deleting recording!");
+ }
+ else
+ Reply(550, "Recording \"%s\" not found%s", Option, Recordings.Count() ? "" : " (use LSTR before deleting)");
+ }
+ else
+ Reply(501, "Error in recording number \"%s\"", Option);
+ }
+ else
+ Reply(501, "Missing recording number");
+}
+
void cSVDRP::CmdDELT(const char *Option)
{
if (*Option) {
@@ -589,6 +609,38 @@ void cSVDRP::CmdLSTE(const char *Option)
Reply(451, "Can't get EPG data");
}
+void cSVDRP::CmdLSTR(const char *Option)
+{
+ bool recordings = Recordings.Load();
+ if (*Option) {
+ if (isnumber(Option)) {
+ cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1);
+ if (recording) {
+ if (recording->Summary()) {
+ char *summary = strdup(recording->Summary());
+ Reply(250, "%s", strreplace(summary,'\n','|'));
+ delete summary;
+ }
+ else
+ Reply(550, "No summary availabe");
+ }
+ else
+ Reply(550, "Recording \"%s\" not found", Option);
+ }
+ else
+ Reply(501, "Error in recording number \"%s\"", Option);
+ }
+ else if (recordings) {
+ cRecording *recording = Recordings.First();
+ while (recording) {
+ Reply(recording == Recordings.Last() ? 250 : -250, "%d %s", recording->Index() + 1, recording->Title(' ', true));
+ recording = Recordings.Next(recording);
+ }
+ }
+ else
+ Reply(550, "No recordings available");
+}
+
void cSVDRP::CmdLSTT(const char *Option)
{
if (*Option) {
@@ -767,106 +819,6 @@ void cSVDRP::CmdNEXT(const char *Option)
Reply(550, "No active timers");
}
-void cSVDRP::CmdOVLF(const char *Option)
-{
- if (*Option) {
- int SizeX = 0, SizeY = 0, Bpp = 0, Palette = 0, FbAddr = 0;
- if (5 == sscanf(Option, "%d %d %x %d %d", &SizeX, &SizeY, &FbAddr, &Bpp, &Palette)) {
- //somehow_set_overlay_geometry;
- if (cDvbApi::PrimaryDvbApi->OvlF(SizeX, SizeY, FbAddr, Bpp, Palette))
- Reply(250, "Overlay framebuffer set");
- else
- Reply(451, "Illegal overlay framebuffer settings");
- }
- else
- Reply(501, "Could not parse overlay framebuffer settings");
- }
- else
- Reply(501, "Missing overlay framebuffer settings");
-}
-
-void cSVDRP::CmdOVLG(const char *Option)
-{
- if (*Option) {
- int SizeX = 0, SizeY = 0, PosX = 0, PosY = 0;
- if (4 == sscanf(Option, "%d %d %d %d", &SizeX, &SizeY, &PosX, &PosY)) {
- //somehow_set_overlay_geometry;
- if (cDvbApi::PrimaryDvbApi->OvlG(SizeX, SizeY, PosX, PosY))
- Reply(250, "Overlay geometry set");
- else
- Reply(451, "Illegal overlay geometry settings");
- }
- else
- Reply(501, "Could not parse overlay geometry settings");
- }
- else
- Reply(501, "Missing overlay geometry settings");
-}
-
-void cSVDRP::CmdOVLC(const char *Option)
-{
- if (*Option) {
- int ClipCount = 0;
- unsigned char s[2 * MAXCLIPRECTS * sizeof(CRect) + 2];
- if (2 == sscanf(Option, "%d %s", &ClipCount, s)) {
- // Base16-decoding of CRect-array:
- unsigned char *p = (unsigned char*)ovlClipRects;
- int i = 0, size = sizeof(CRect)*ClipCount;
- for (int j = 0; i < size; i++) {
- p[i] = (s[j++] - 65);
- p[i] += (s[j++] - 65) << 4;
- }
- if (((unsigned)ClipCount == (i / sizeof(CRect))) && (ClipCount >= 0)) {
- // apply it:
- if (cDvbApi::PrimaryDvbApi->OvlC(ClipCount, ovlClipRects))
- Reply(250, "Overlay-Clipping set");
- else
- Reply(451, "Illegal overlay clipping settings");
- return;
- }
- }
- Reply(501, "Error parsing Overlay-Clipping settings");
- }
- else
- Reply(501, "Missing Clipping settings");
-}
-
-void cSVDRP::CmdOVLP(const char *Option)
-{
- if (*Option) {
- int Brightness = 0, Colour = 0, Hue = 0, Contrast = 0;
- if (4 == sscanf(Option, "%d %d %d %d", &Brightness, &Colour, &Hue, &Contrast)) {
- //somehow_set_overlay_picture_settings;
- if (cDvbApi::PrimaryDvbApi->OvlP(Brightness, Colour, Hue, Contrast))
- Reply(250, "Overlay picture settings set");
- else
- Reply(451, "Illegal overlay picture settings");
- }
- else
- Reply(501, "Could not parse overlay picture settings");
- }
- else
- Reply(501, "Missing overlay picture settings");
-}
-
-void cSVDRP::CmdOVLO(const char *Option)
-{
- if (*Option) {
- int Value;
- if (1 == sscanf(Option, "%d", &Value)) {
- //somehow_set_overlay_picture_settings;
- if (cDvbApi::PrimaryDvbApi->OvlO(Value))
- Reply(250, "Overlay capture set");
- else
- Reply(451, "Error setting overlay capture");
- }
- else
- Reply(501, "Could not parse status");
- }
- else
- Reply(501, "Missing overlay capture status");
-}
-
void cSVDRP::CmdUPDT(const char *Option)
{
if (*Option) {
@@ -910,12 +862,14 @@ void cSVDRP::Execute(char *Cmd)
s = skipspace(s);
if (CMD("CHAN")) CmdCHAN(s);
else if (CMD("DELC")) CmdDELC(s);
+ else if (CMD("DELR")) CmdDELR(s);
else if (CMD("DELT")) CmdDELT(s);
else if (CMD("GRAB")) CmdGRAB(s);
else if (CMD("HELP")) CmdHELP(s);
else if (CMD("HITK")) CmdHITK(s);
else if (CMD("LSTC")) CmdLSTC(s);
else if (CMD("LSTE")) CmdLSTE(s);
+ else if (CMD("LSTR")) CmdLSTR(s);
else if (CMD("LSTT")) CmdLSTT(s);
else if (CMD("MESG")) CmdMESG(s);
else if (CMD("MODC")) CmdMODC(s);
@@ -925,11 +879,6 @@ 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("OVLF")) CmdOVLF(s);
- else if (CMD("OVLG")) CmdOVLG(s);
- else if (CMD("OVLC")) CmdOVLC(s);
- else if (CMD("OVLP")) CmdOVLP(s);
- else if (CMD("OVLO")) CmdOVLO(s);
else if (CMD("UPDT")) CmdUPDT(s);
else if (CMD("QUIT")) Close();
else Reply(500, "Command unrecognized: \"%s\"", Cmd);