Removed all video overlay stuff from cDvbApi and SVDRP

This commit is contained in:
Klaus Schmidinger 2001-11-04 11:38:23 +01:00
parent 6deb1cea38
commit 9bba1ce73e
6 changed files with 10 additions and 314 deletions

View File

@ -23,6 +23,8 @@ Guido Fiala <gfiala@s.netic.de>
for implementing the SVDRP command 'HITK'
for implementing image grabbing
for implementing overlay capabilities (see his 'kvdr' tool at http://www.s.netic.de/gfiala)
(overlay capabilities have been removed again in VDR 0.98, since kvdr version 0.4
now does these things itself)
for making the replay progress display avoid unnecessary code execution
Robert Schneider <Robert.Schneider@lotus.com>

View File

@ -860,3 +860,6 @@ Video Disk Recorder Revision History
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.

168
dvbapi.c
View File

@ -7,7 +7,7 @@
* DVD support initially written by Andreas Schultz <aschultz@warp10.net>
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
*
* $Id: dvbapi.c 1.135 2001/11/03 12:46:45 kls Exp $
* $Id: dvbapi.c 1.136 2001/11/04 11:30:00 kls Exp $
*/
//#define DVDDEBUG 1
@ -2583,10 +2583,6 @@ cDvbApi::cDvbApi(int n)
esyslog(LOG_ERR, "ERROR: can't open video device %d", n);
cols = rows = 0;
ovlGeoSet = ovlStat = ovlFbSet = false;
ovlBrightness = ovlColour = ovlHue = ovlContrast = 32768;
ovlClipCount = 0;
#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
initscr();
keypad(stdscr, true);
@ -2615,7 +2611,6 @@ cDvbApi::~cDvbApi()
StopReplay();
StopRecord();
StopTransfer();
OvlO(false); //Overlay off!
// We're not explicitly closing any device files here, since this sometimes
// caused segfaults. Besides, the program is about to terminate anyway...
#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
@ -2814,171 +2809,10 @@ bool cDvbApi::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX,
result |= 1;
}
if (ovlStat && ovlGeoSet) {
// switch the Overlay on again (gf: why have i to do anything again?)
OvlG(ovlSizeX, ovlSizeY, ovlPosX, ovlPosY);
}
if (ovlFbSet)
OvlP(ovlBrightness, ovlColour, ovlHue, ovlContrast);
munmap(mem, msize);
return result == 0;
}
bool cDvbApi::OvlF(int SizeX, int SizeY, int FbAddr, int Bpp, int Palette)
{
if (videoDev < 0)
return false;
int result = 0;
// get the actual X-Server settings???
// plausibility-check problem: can't be verified w/o X-server!!!
if (SizeX <= 0 || SizeY <= 0 || FbAddr == 0 || Bpp / 8 > 4 ||
Bpp / 8 <= 0 || Palette <= 0 || Palette > 13 || ovlClipCount < 0 ||
SizeX > 4096 || SizeY > 4096) {
ovlFbSet = ovlGeoSet = false;
OvlO(false);
return false;
}
else {
dsyslog(LOG_INFO, "OvlF: %d %d %x %d %d", SizeX, SizeY, FbAddr, Bpp, Palette);
// this is the problematic part!
struct video_buffer vb;
result |= ioctl(videoDev, VIDIOCGFBUF, &vb);
vb.base = (void*)FbAddr;
vb.depth = Bpp;
vb.height = SizeY;
vb.width = SizeX;
vb.bytesperline = ((vb.depth + 1) / 8) * vb.width;
//now the real thing: setting the framebuffer
result |= ioctl(videoDev, VIDIOCSFBUF, &vb);
if (result) {
ovlFbSet = ovlGeoSet = false;
ovlClipCount = 0;
OvlO(false);
return false;
}
else {
ovlFbSizeX = SizeX;
ovlFbSizeY = SizeY;
ovlBpp = Bpp;
ovlPalette = Palette;
ovlFbSet = true;
return true;
}
}
}
bool cDvbApi::OvlG(int SizeX, int SizeY, int PosX, int PosY)
{
if (videoDev < 0)
return false;
int result = 0;
// get the actual X-Server settings???
struct video_capability vc;
result |= ioctl(videoDev, VIDIOCGCAP, &vc);
if (!ovlFbSet)
return false;
if (SizeX < vc.minwidth || SizeY < vc.minheight ||
SizeX > vc.maxwidth || SizeY>vc.maxheight
// || PosX > FbSizeX || PosY > FbSizeY
// PosX < -SizeX || PosY < -SizeY ||
) {
ovlGeoSet = false;
OvlO(false);
return false;
}
else {
struct video_window vw;
result |= ioctl(videoDev, VIDIOCGWIN, &vw);
vw.x = PosX;
vw.y = PosY;
vw.width = SizeX;
vw.height = SizeY;
vw.chromakey = ovlPalette;
#ifndef VID_TYPE_CHROMAKEY // name changed somewhere down the road in kernel 2.4.x
#define VID_TYPE_CHROMAKEY VIDEO_WINDOW_CHROMAKEY
#endif
vw.flags = VID_TYPE_CHROMAKEY; // VIDEO_WINDOW_INTERLACE; //VIDEO_CLIP_BITMAP;
vw.clips = ovlClipRects;
vw.clipcount = ovlClipCount;
result |= ioctl(videoDev, VIDIOCSWIN, &vw);
if (result) {
ovlGeoSet = false;
ovlClipCount = 0;
return false;
}
else {
ovlSizeX = SizeX;
ovlSizeY = SizeY;
ovlPosX = PosX;
ovlPosY = PosY;
ovlGeoSet = true;
ovlStat = true;
return true;
}
}
}
bool cDvbApi::OvlC(int ClipCount, CRect *cr)
{
if (videoDev < 0)
return false;
if (ovlGeoSet && ovlFbSet) {
for (int i = 0; i < ClipCount; i++) {
ovlClipRects[i].x = cr[i].x;
ovlClipRects[i].y = cr[i].y;
ovlClipRects[i].width = cr[i].width;
ovlClipRects[i].height = cr[i].height;
ovlClipRects[i].next = &(ovlClipRects[i + 1]);
}
ovlClipCount = ClipCount;
//use it:
return OvlG(ovlSizeX, ovlSizeY, ovlPosX, ovlPosY);
}
return false;
}
bool cDvbApi::OvlP(__u16 Brightness, __u16 Colour, __u16 Hue, __u16 Contrast)
{
if (videoDev < 0)
return false;
int result = 0;
ovlBrightness = Brightness;
ovlColour = Colour;
ovlHue = Hue;
ovlContrast = Contrast;
struct video_picture vp;
if (!ovlFbSet)
return false;
result |= ioctl(videoDev, VIDIOCGPICT, &vp);
vp.brightness = Brightness;
vp.colour = Colour;
vp.hue = Hue;
vp.contrast = Contrast;
vp.depth = ovlBpp;
vp.palette = ovlPalette; // gf: is this always ok? VIDEO_PALETTE_RGB565;
result |= ioctl(videoDev, VIDIOCSPICT, &vp);
return result == 0;
}
bool cDvbApi::OvlO(bool Value)
{
if (videoDev < 0)
return false;
int result = 0;
if (!ovlGeoSet && Value)
return false;
int one = 1;
int zero = 0;
result |= ioctl(videoDev, VIDIOCCAPTURE, Value ? &one : &zero);
ovlStat = Value;
if (result) {
ovlStat = false;
return false;
}
return true;
}
#ifdef DEBUG_OSD
void cDvbApi::SetColor(eDvbColor colorFg, eDvbColor colorBg)
{

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.h 1.56 2001/10/28 15:47:10 kls Exp $
* $Id: dvbapi.h 1.57 2001/11/04 11:27:18 kls Exp $
*/
#ifndef __DVBAPI_H
@ -34,12 +34,6 @@
#include "eit.h"
#include "thread.h"
// Overlay facilities
#define MAXCLIPRECTS 100
typedef struct CRect {
signed short x, y, width, height;
};
#define FRAMESPERSEC 25
// The maximum file size is limited by the range that can be covered
@ -155,21 +149,6 @@ public:
bool GrabImage(const char *FileName, bool Jpeg = true, int Quality = -1, int SizeX = -1, int SizeY = -1);
// Overlay facilities
private:
bool ovlStat, ovlGeoSet, ovlFbSet;
int ovlSizeX, ovlSizeY, ovlPosX, ovlPosY, ovlBpp, ovlPalette, ovlClips, ovlClipCount;
int ovlFbSizeX, ovlFbSizeY;
__u16 ovlBrightness, ovlColour, ovlHue, ovlContrast;
struct video_clip ovlClipRects[MAXCLIPRECTS];
public:
bool OvlF(int SizeX, int SizeY, int FbAddr, int Bpp, int Palette);
bool OvlG(int SizeX, int SizeY, int PosX, int PosY);
bool OvlC(int ClipCount, CRect *Cr);
bool OvlP(__u16 Brightness, __u16 Color, __u16 Hue, __u16 Contrast);
bool OvlO(bool Value);
// On Screen Display facilities
private:

119
svdrp.c
View File

@ -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.26 2001/10/27 11:35:38 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"
@ -183,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"
@ -287,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);
@ -829,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) {
@ -989,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);

View File

@ -4,13 +4,12 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: svdrp.h 1.12 2001/10/27 11:36:49 kls Exp $
* $Id: svdrp.h 1.13 2001/11/04 11:20:46 kls Exp $
*/
#ifndef __SVDRP_H
#define __SVDRP_H
#include "dvbapi.h"
#include "recording.h"
#include "tools.h"
@ -31,7 +30,6 @@ class cSVDRP {
private:
cSocket socket;
cFile file;
CRect ovlClipRects[MAXCLIPRECTS];
cRecordings Recordings;
uint numChars;
char cmdLine[MAXPARSEBUFFER];
@ -59,11 +57,6 @@ private:
void CmdNEWC(const char *Option);
void CmdNEWT(const char *Option);
void CmdNEXT(const char *Option);
void CmdOVLF(const char *Option);
void CmdOVLG(const char *Option);
void CmdOVLC(const char *Option);
void CmdOVLP(const char *Option);
void CmdOVLO(const char *Option);
void CmdUPDT(const char *Option);
void Execute(char *Cmd);
public: