mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
spark: remove unused blank and zoom code from cVideo
This commit is contained in:
@@ -59,11 +59,6 @@ int system_rev = 0;
|
||||
#define VIDEO_STREAMTYPE_MPEG1 6
|
||||
|
||||
|
||||
static pthread_mutex_t stillp_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* debugging hacks */
|
||||
static bool noscart = false;
|
||||
|
||||
static int proc_put(const char *path, const char *value, const int len)
|
||||
{
|
||||
int ret, ret2;
|
||||
@@ -109,52 +104,11 @@ cVideo::cVideo(int, void *, void *)
|
||||
//croppingMode = VID_DISPMODE_NORM;
|
||||
//outputformat = VID_OUTFMT_RGBC_SVIDEO;
|
||||
scartvoltage = -1;
|
||||
z[0] = 100;
|
||||
z[1] = 100;
|
||||
zoomvalue = &z[0];
|
||||
const char *blanknames[2] = { "/share/tuxbox/blank_576.mpg", "/share/tuxbox/blank_480.mpg" };
|
||||
int blankfd;
|
||||
struct stat st;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
blank_data[i] = NULL; /* initialize */
|
||||
blank_size[i] = 0;
|
||||
blankfd = open(blanknames[i], O_RDONLY);
|
||||
if (blankfd < 0)
|
||||
{
|
||||
lt_info("%s cannot open %s: %m", __FUNCTION__, blanknames[i]);
|
||||
continue;
|
||||
}
|
||||
if (fstat(blankfd, &st) != -1 && st.st_size > 0)
|
||||
{
|
||||
blank_size[i] = st.st_size;
|
||||
blank_data[i] = malloc(blank_size[i]);
|
||||
if (! blank_data[i])
|
||||
lt_info("%s malloc failed (%m)\n", __FUNCTION__);
|
||||
else if (read(blankfd, blank_data[i], blank_size[i]) != blank_size[i])
|
||||
{
|
||||
lt_info("%s short read (%m)\n", __FUNCTION__);
|
||||
free(blank_data[i]); /* don't leak... */
|
||||
blank_data[i] = NULL;
|
||||
}
|
||||
}
|
||||
close(blankfd);
|
||||
}
|
||||
video_standby = 0;
|
||||
noscart = (getenv("TRIPLE_NOSCART") != NULL);
|
||||
if (noscart)
|
||||
lt_info("%s TRIPLE_NOSCART variable prevents SCART switching\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
cVideo::~cVideo(void)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (blank_data[i])
|
||||
free(blank_data[i]);
|
||||
blank_data[i] = NULL;
|
||||
}
|
||||
/* disable DACs and SCART voltage */
|
||||
Standby(true);
|
||||
closeDevice();
|
||||
@@ -252,53 +206,6 @@ int cVideo::Stop(bool blank)
|
||||
int cVideo::setBlank(int)
|
||||
{
|
||||
return Stop(1);
|
||||
#if 0
|
||||
lt_debug("%s\n", __FUNCTION__);
|
||||
/* The TripleDragon has no VIDEO_SET_BLANK ioctl.
|
||||
instead, you write a black still-MPEG Iframe into the decoder.
|
||||
The original software uses different files for 4:3 and 16:9 and
|
||||
for PAL and NTSC. I optimized that a little bit
|
||||
*/
|
||||
int index = 0; /* default PAL */
|
||||
int ret = 0;
|
||||
VIDEOINFO v;
|
||||
BUFINFO buf;
|
||||
pthread_mutex_lock(&stillp_mutex);
|
||||
memset(&v, 0, sizeof(v));
|
||||
ioctl(fd, MPEG_VID_GET_V_INFO, &v);
|
||||
|
||||
if ((v.v_size % 240) == 0) /* NTSC */
|
||||
{
|
||||
lt_info("%s NTSC format detected", __FUNCTION__);
|
||||
index = 1;
|
||||
}
|
||||
|
||||
if (blank_data[index] == NULL) /* no MPEG found */
|
||||
{
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
/* hack: this might work only on those two still-MPEG files!
|
||||
I diff'ed the 4:3 and the 16:9 still mpeg from the original
|
||||
soft and spotted the single bit difference, so there is no
|
||||
need to keep two different MPEGs in memory
|
||||
If we would read them from disk all the time it would be
|
||||
slower and it might wake up the drive occasionally */
|
||||
if (v.pel_aspect_ratio == VID_DISPSIZE_4x3)
|
||||
((char *)blank_data[index])[7] &= ~0x10; // clear the bit
|
||||
else
|
||||
((char *)blank_data[index])[7] |= 0x10; // set the bit
|
||||
|
||||
//WARN("blank[7] == 0x%02x", ((char *)blank_data[index])[7]);
|
||||
|
||||
buf.ulLen = blank_size[index];
|
||||
buf.ulStartAdrOff = (int)blank_data[index];
|
||||
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
|
||||
ret = fop(ioctl, MPEG_VID_SELECT_SOURCE, VID_SOURCE_DEMUX);
|
||||
out:
|
||||
pthread_mutex_unlock(&stillp_mutex);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
int cVideo::SetVideoSystem(int video_system, bool remember)
|
||||
@@ -455,96 +362,6 @@ int cVideo::getBlank(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set zoom in percent (100% == 1:1) */
|
||||
int cVideo::setZoom(int zoom)
|
||||
{
|
||||
return 1;
|
||||
#if 0
|
||||
if (zoom == -1) // "auto" reset
|
||||
zoom = *zoomvalue;
|
||||
|
||||
if (zoom > 150 || zoom < 100)
|
||||
return -1;
|
||||
|
||||
*zoomvalue = zoom;
|
||||
|
||||
if (zoom == 100)
|
||||
{
|
||||
setCroppingMode(croppingMode);
|
||||
return fop(ioctl, MPEG_VID_SCALE_OFF);
|
||||
}
|
||||
|
||||
/* the SCALEINFO describes the source and destination of the scaled
|
||||
video. "src" is the part of the source picture that gets scaled,
|
||||
"dst" is the area on the screen where this part is displayed
|
||||
Messing around with MPEG_VID_SET_SCALE_POS disables the automatic
|
||||
letterboxing, which, as I guess, is only a special case of
|
||||
MPEG_VID_SET_SCALE_POS. Therefor we need to care for letterboxing
|
||||
etc here, which is probably not yet totally correct */
|
||||
SCALEINFO s;
|
||||
memset(&s, 0, sizeof(s));
|
||||
if (zoom > 100)
|
||||
{
|
||||
/* 1 = 4:3, 3 = 16:9, 4 = 2.21:1, 0 = unknown */
|
||||
int x = getAspectRatio();
|
||||
if (x < 3 && croppingMode == VID_DISPMODE_NORM)
|
||||
{
|
||||
s.src.hori_size = 720;
|
||||
s.des.hori_size = 720 * 3/4 * zoom / 100;
|
||||
if (s.des.hori_size > 720)
|
||||
{
|
||||
/* the destination exceeds the screen size.
|
||||
TODO: decrease source size to allow higher
|
||||
zoom factors (is this useful ?) */
|
||||
s.des.hori_size = 720;
|
||||
zoom = 133; // (720*4*100)/(720*3)
|
||||
*zoomvalue = zoom;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s.src.hori_size = 2 * 720 - 720 * zoom / 100;
|
||||
s.des.hori_size = 720;
|
||||
}
|
||||
s.src.vert_size = 2 * 576 - 576 * zoom / 100;
|
||||
s.des.hori_off = (720 - s.des.hori_size) / 2;
|
||||
s.des.vert_size = 576;
|
||||
}
|
||||
/* not working correctly (wrong formula) and does not make sense IMHO
|
||||
else
|
||||
{
|
||||
s.src.hori_size = 720;
|
||||
s.src.vert_size = 576;
|
||||
s.des.hori_size = 720 * zoom / 100;
|
||||
s.des.vert_size = 576 * zoom / 100;
|
||||
s.des.hori_off = (720 - s.des.hori_size) / 2;
|
||||
s.des.vert_off = (576 - s.des.vert_size) / 2;
|
||||
}
|
||||
*/
|
||||
lt_debug("%s %d%% src: %d:%d:%d:%d dst: %d:%d:%d:%d\n", __FUNCTION__, zoom,
|
||||
s.src.hori_off,s.src.vert_off,s.src.hori_size,s.src.vert_size,
|
||||
s.des.hori_off,s.des.vert_off,s.des.hori_size,s.des.vert_size);
|
||||
fop(ioctl, MPEG_VID_SET_DISPMODE, VID_DISPMODE_SCALE);
|
||||
fop(ioctl, MPEG_VID_SCALE_ON);
|
||||
return fop(ioctl, MPEG_VID_SET_SCALE_POS, &s);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
int cVideo::getZoom(void)
|
||||
{
|
||||
return *zoomvalue;
|
||||
}
|
||||
|
||||
void cVideo::setZoomAspect(int index)
|
||||
{
|
||||
if (index < 0 || index > 1)
|
||||
WARN("index out of range");
|
||||
else
|
||||
zoomvalue = &z[index];
|
||||
}
|
||||
#endif
|
||||
|
||||
/* this function is regularly called, checks if video parameters
|
||||
changed and triggers appropriate actions */
|
||||
void cVideo::VideoParamWatchdog(void)
|
||||
|
@@ -122,10 +122,6 @@ class cVideo
|
||||
int /*vidDispMode_t*/ croppingMode;
|
||||
int /*vidOutFmt_t*/ outputformat;
|
||||
int scartvoltage;
|
||||
int z[2]; /* zoomvalue for 4:3 (0) and 16:9 (1) in percent */
|
||||
int *zoomvalue;
|
||||
void *blank_data[2]; /* we store two blank MPEGs (PAL/NTSC) in there */
|
||||
int blank_size[2];
|
||||
|
||||
VIDEO_FORMAT StreamType;
|
||||
VIDEO_DEFINITION VideoDefinition;
|
||||
@@ -182,7 +178,6 @@ class cVideo
|
||||
void Standby(unsigned int bOn);
|
||||
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600);
|
||||
void SetControl(int, int) { return; };
|
||||
int setZoom(int);
|
||||
void VideoParamWatchdog(void);
|
||||
void setContrast(int val);
|
||||
void SetVideoMode(analog_mode_t mode);
|
||||
|
Reference in New Issue
Block a user