2011-12-07 14:37:51 +01:00
|
|
|
///
|
|
|
|
/// @file softhddevice.cpp @brief A software HD device plugin for VDR.
|
|
|
|
///
|
2013-01-01 12:40:12 +01:00
|
|
|
/// Copyright (c) 2011 - 2013 by Johns. All Rights Reserved.
|
2011-12-07 14:37:51 +01:00
|
|
|
///
|
|
|
|
/// Contributor(s):
|
|
|
|
///
|
|
|
|
/// License: AGPLv3
|
|
|
|
///
|
|
|
|
/// This program is free software: you can redistribute it and/or modify
|
|
|
|
/// it under the terms of the GNU Affero General Public License as
|
|
|
|
/// published by the Free Software Foundation, either version 3 of the
|
|
|
|
/// License.
|
|
|
|
///
|
|
|
|
/// This program is distributed in the hope that it will be useful,
|
|
|
|
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
/// GNU Affero General Public License for more details.
|
|
|
|
///
|
|
|
|
/// $Id$
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <vdr/interface.h>
|
|
|
|
#include <vdr/plugin.h>
|
|
|
|
#include <vdr/player.h>
|
|
|
|
#include <vdr/osd.h>
|
|
|
|
#include <vdr/dvbspu.h>
|
|
|
|
#include <vdr/shutdown.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "softhddev.h"
|
|
|
|
#include "softhddevice.h"
|
2012-04-30 14:47:08 +02:00
|
|
|
#include "softhddevice_service.h"
|
2012-01-06 15:39:32 +01:00
|
|
|
extern "C"
|
|
|
|
{
|
2012-04-17 16:45:27 +02:00
|
|
|
#include "audio.h"
|
2012-01-06 15:39:32 +01:00
|
|
|
#include "video.h"
|
2012-03-26 20:49:18 +02:00
|
|
|
extern const char *X11DisplayName; ///< x11 display name
|
2012-03-15 15:42:51 +01:00
|
|
|
|
2012-04-20 18:28:25 +02:00
|
|
|
extern void CodecSetAudioDrift(int);
|
2012-01-07 03:05:43 +01:00
|
|
|
extern void CodecSetAudioPassthrough(int);
|
2012-02-21 22:24:28 +01:00
|
|
|
extern void CodecSetAudioDownmix(int);
|
2011-12-12 17:06:05 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-03-10 17:46:00 +01:00
|
|
|
/// vdr-plugin version number.
|
|
|
|
/// Makefile extracts the version number for generating the file name
|
|
|
|
/// for the distribution archive.
|
2012-11-25 00:35:39 +01:00
|
|
|
static const char *const VERSION = "0.5.3"
|
2012-02-23 23:33:00 +01:00
|
|
|
#ifdef GIT_REV
|
|
|
|
"-GIT" GIT_REV
|
|
|
|
#endif
|
|
|
|
;
|
2012-03-10 17:46:00 +01:00
|
|
|
|
|
|
|
/// vdr-plugin description.
|
2011-12-07 14:37:51 +01:00
|
|
|
static const char *const DESCRIPTION =
|
|
|
|
trNOOP("A software and GPU emulated HD device");
|
|
|
|
|
2012-03-10 17:46:00 +01:00
|
|
|
/// vdr-plugin text of main menu entry
|
2012-02-19 19:22:03 +01:00
|
|
|
static const char *MAINMENUENTRY = trNOOP("SoftHdDevice");
|
2012-03-10 17:46:00 +01:00
|
|
|
|
|
|
|
/// single instance of softhddevice plugin device.
|
2011-12-07 14:37:51 +01:00
|
|
|
static class cSoftHdDevice *MyDevice;
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
#define RESOLUTIONS 4 ///< number of resolutions
|
|
|
|
|
2012-01-18 15:15:37 +01:00
|
|
|
/// resolutions names
|
2012-01-09 17:03:04 +01:00
|
|
|
static const char *const Resolution[RESOLUTIONS] = {
|
|
|
|
"576i", "720p", "1080i_fake", "1080i"
|
|
|
|
};
|
|
|
|
|
2012-01-05 17:20:44 +01:00
|
|
|
static char ConfigMakePrimary; ///< config primary wanted
|
2012-01-10 15:52:07 +01:00
|
|
|
static char ConfigHideMainMenuEntry; ///< config hide main menu entry
|
2012-04-15 22:59:52 +02:00
|
|
|
static char ConfigSuspendClose; ///< suspend should close devices
|
|
|
|
static char ConfigSuspendX11; ///< suspend should stop x11
|
2012-01-09 17:03:04 +01:00
|
|
|
|
2012-02-24 15:15:50 +01:00
|
|
|
static uint32_t ConfigVideoBackground; ///< config video background color
|
2012-05-21 15:34:33 +02:00
|
|
|
static int ConfigOsdWidth; ///< config OSD width
|
|
|
|
static int ConfigOsdHeight; ///< config OSD height
|
2012-03-06 12:16:47 +01:00
|
|
|
static char ConfigVideoStudioLevels; ///< config use studio levels
|
|
|
|
static char ConfigVideo60HzMode; ///< config use 60Hz display mode
|
|
|
|
static char ConfigVideoSoftStartSync; ///< config use softstart sync
|
2012-04-20 15:40:14 +02:00
|
|
|
static char ConfigVideoBlackPicture; ///< config enable black picture mode
|
2012-02-02 16:00:26 +01:00
|
|
|
|
2012-09-03 16:39:33 +02:00
|
|
|
static int ConfigVideoBrightness; ///< config video brightness
|
|
|
|
static int ConfigVideoContrast = 1000; ///< config video contrast
|
|
|
|
static int ConfigVideoSaturation = 1000; ///< config video saturation
|
|
|
|
static int ConfigVideoHue; ///< config video hue
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
/// config deinterlace
|
|
|
|
static int ConfigVideoDeinterlace[RESOLUTIONS];
|
|
|
|
|
|
|
|
/// config skip chroma
|
|
|
|
static int ConfigVideoSkipChromaDeinterlace[RESOLUTIONS];
|
|
|
|
|
2012-02-14 22:29:17 +01:00
|
|
|
/// config inverse telecine
|
|
|
|
static int ConfigVideoInverseTelecine[RESOLUTIONS];
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
/// config denoise
|
|
|
|
static int ConfigVideoDenoise[RESOLUTIONS];
|
|
|
|
|
|
|
|
/// config sharpen
|
|
|
|
static int ConfigVideoSharpen[RESOLUTIONS];
|
|
|
|
|
|
|
|
/// config scaling
|
|
|
|
static int ConfigVideoScaling[RESOLUTIONS];
|
|
|
|
|
2012-04-05 22:51:20 +02:00
|
|
|
/// config cut top and bottom pixels
|
|
|
|
static int ConfigVideoCutTopBottom[RESOLUTIONS];
|
|
|
|
|
|
|
|
/// config cut left and right pixels
|
|
|
|
static int ConfigVideoCutLeftRight[RESOLUTIONS];
|
|
|
|
|
2012-04-14 21:25:44 +02:00
|
|
|
static int ConfigAutoCropEnabled; ///< auto crop detection enabled
|
2012-01-20 15:33:37 +01:00
|
|
|
static int ConfigAutoCropInterval; ///< auto crop detection interval
|
|
|
|
static int ConfigAutoCropDelay; ///< auto crop detection delay
|
2012-01-27 23:49:05 +01:00
|
|
|
static int ConfigAutoCropTolerance; ///< auto crop detection tolerance
|
2012-01-20 15:33:37 +01:00
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
static int ConfigVideoAudioDelay; ///< config audio delay
|
2012-04-20 18:28:25 +02:00
|
|
|
static char ConfigAudioDrift; ///< config audio drift
|
|
|
|
static char ConfigAudioPassthrough; ///< config audio pass-through
|
|
|
|
static char ConfigAudioDownmix; ///< config ffmpeg audio downmix
|
2012-04-15 22:59:52 +02:00
|
|
|
static char ConfigAudioSoftvol; ///< config use software volume
|
|
|
|
static char ConfigAudioNormalize; ///< config use normalize volume
|
|
|
|
static int ConfigAudioMaxNormalize; ///< config max normalize factor
|
|
|
|
static char ConfigAudioCompression; ///< config use volume compression
|
|
|
|
static int ConfigAudioMaxCompression; ///< config max volume compression
|
|
|
|
static int ConfigAudioStereoDescent; ///< config reduce stereo loudness
|
2012-04-17 16:45:27 +02:00
|
|
|
int ConfigAudioBufferTime; ///< config size ms of audio buffer
|
2012-01-26 15:00:49 +01:00
|
|
|
|
2012-10-30 16:50:31 +01:00
|
|
|
static char *ConfigX11Display; ///< config x11 display
|
|
|
|
static char *ConfigAudioDevice; ///< config audio stereo device
|
|
|
|
static char *ConfigAC3Device; ///< config audio passthrough device
|
2012-10-29 16:00:45 +01:00
|
|
|
|
2012-03-08 15:28:10 +01:00
|
|
|
static volatile int DoMakePrimary; ///< switch primary device to this
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-03-01 22:12:22 +01:00
|
|
|
#define SUSPEND_EXTERNAL -1 ///< play external suspend mode
|
2012-03-11 14:12:49 +01:00
|
|
|
#define NOT_SUSPENDED 0 ///< not suspend mode
|
|
|
|
#define SUSPEND_NORMAL 1 ///< normal suspend mode
|
|
|
|
#define SUSPEND_DETACHED 2 ///< detached suspend mode
|
2012-03-01 22:12:22 +01:00
|
|
|
static char SuspendMode; ///< suspend mode
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// C Callbacks
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-03-09 12:08:56 +01:00
|
|
|
/**
|
|
|
|
** Soft device plugin remote class.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
class cSoftRemote:public cRemote
|
|
|
|
{
|
|
|
|
public:
|
2012-03-09 12:08:56 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Soft device remote class constructor.
|
|
|
|
**
|
|
|
|
** @param name remote name
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
cSoftRemote(const char *name):cRemote(name)
|
|
|
|
{
|
2011-12-14 18:01:03 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-03-09 12:08:56 +01:00
|
|
|
/**
|
|
|
|
** Put keycode into vdr event queue.
|
|
|
|
**
|
|
|
|
** @param code key code
|
|
|
|
** @param repeat flag key repeated
|
|
|
|
** @param release flag key released
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
bool Put(const char *code, bool repeat = false, bool release = false) {
|
|
|
|
return cRemote::Put(code, repeat, release);
|
2011-12-14 18:01:03 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
};
|
|
|
|
|
2012-03-09 12:08:56 +01:00
|
|
|
/**
|
|
|
|
** Feed key press as remote input (called from C part).
|
|
|
|
**
|
|
|
|
** @param keymap target keymap "XKeymap" name
|
|
|
|
** @param key pressed/released key name
|
|
|
|
** @param repeat repeated key flag
|
|
|
|
** @param release released key flag
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat,
|
|
|
|
int release)
|
|
|
|
{
|
|
|
|
cRemote *remote;
|
|
|
|
cSoftRemote *csoft;
|
|
|
|
|
|
|
|
if (!keymap || !key) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// find remote
|
|
|
|
for (remote = Remotes.First(); remote; remote = Remotes.Next(remote)) {
|
|
|
|
if (!strcmp(remote->Name(), keymap)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-03-09 12:08:56 +01:00
|
|
|
// if remote not already exists, create it
|
2011-12-07 14:37:51 +01:00
|
|
|
if (remote) {
|
|
|
|
csoft = (cSoftRemote *) remote;
|
|
|
|
} else {
|
|
|
|
dsyslog("[softhddev]%s: remote '%s' not found\n", __FUNCTION__,
|
|
|
|
keymap);
|
|
|
|
csoft = new cSoftRemote(keymap);
|
|
|
|
}
|
|
|
|
|
2012-01-20 21:46:22 +01:00
|
|
|
//dsyslog("[softhddev]%s %s, %s\n", __FUNCTION__, keymap, key);
|
2012-02-17 16:37:38 +01:00
|
|
|
if (key[1]) { // no single character
|
|
|
|
csoft->Put(key, repeat, release);
|
|
|
|
} else if (!csoft->Put(key, repeat, release)) {
|
|
|
|
cRemote::Put(KBDKEY(key[0])); // feed it for edit mode
|
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// OSD
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-02-16 15:31:53 +01:00
|
|
|
/**
|
|
|
|
** Soft device plugin OSD class.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
class cSoftOsd:public cOsd
|
|
|
|
{
|
|
|
|
public:
|
2012-03-10 17:46:00 +01:00
|
|
|
static volatile char Dirty; ///< flag force redraw everything
|
2012-08-07 16:46:23 +02:00
|
|
|
int OsdLevel; ///< current osd level
|
2012-03-10 17:46:00 +01:00
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
cSoftOsd(int, int, uint); ///< osd constructor
|
|
|
|
virtual ~ cSoftOsd(void); ///< osd destructor
|
2012-03-10 17:46:00 +01:00
|
|
|
virtual void Flush(void); ///< commits all data to the hardware
|
|
|
|
virtual void SetActive(bool); ///< sets OSD to be the active one
|
2011-12-07 14:37:51 +01:00
|
|
|
};
|
|
|
|
|
2012-03-10 17:46:00 +01:00
|
|
|
volatile char cSoftOsd::Dirty; ///< flag force redraw everything
|
2012-02-06 20:54:20 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Sets this OSD to be the active one.
|
|
|
|
**
|
|
|
|
** @param on true on, false off
|
|
|
|
**
|
|
|
|
** @note only needed as workaround for text2skin plugin with
|
|
|
|
** undrawn areas.
|
|
|
|
*/
|
|
|
|
void cSoftOsd::SetActive(bool on)
|
|
|
|
{
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: %d level %d\n", __FUNCTION__, on, OsdLevel);
|
|
|
|
#endif
|
2012-02-06 20:54:20 +01:00
|
|
|
|
|
|
|
if (Active() == on) {
|
|
|
|
return; // already active, no action
|
|
|
|
}
|
|
|
|
cOsd::SetActive(on);
|
2012-08-07 16:46:23 +02:00
|
|
|
|
|
|
|
// ignore sub-title if menu is open
|
|
|
|
if (OsdLevel >= OSD_LEVEL_SUBTITLES && IsOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-02-06 20:54:20 +01:00
|
|
|
if (on) {
|
2012-03-10 17:46:00 +01:00
|
|
|
Dirty = 1;
|
2012-08-07 16:46:23 +02:00
|
|
|
// only flush here if there are already bitmaps
|
|
|
|
if (GetBitmap(0)) {
|
|
|
|
Flush();
|
|
|
|
}
|
2012-02-06 20:54:20 +01:00
|
|
|
} else {
|
|
|
|
OsdClose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-10 17:46:00 +01:00
|
|
|
/**
|
|
|
|
** Constructor OSD.
|
|
|
|
**
|
|
|
|
** Initializes the OSD with the given coordinates.
|
|
|
|
**
|
|
|
|
** @param left x-coordinate of osd on display
|
|
|
|
** @param top y-coordinate of osd on display
|
|
|
|
** @param level level of the osd (smallest is shown)
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
cSoftOsd::cSoftOsd(int left, int top, uint level)
|
|
|
|
:cOsd(left, top, level)
|
|
|
|
{
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
2012-01-21 15:56:45 +01:00
|
|
|
/* FIXME: OsdWidth/OsdHeight not correct!
|
|
|
|
*/
|
2012-08-07 16:46:23 +02:00
|
|
|
dsyslog("[softhddev]%s: %dx%d+%d+%d, %d\n", __FUNCTION__, OsdWidth(),
|
|
|
|
OsdHeight(), left, top, level);
|
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
OsdLevel = level;
|
2012-01-21 15:56:45 +01:00
|
|
|
SetActive(true);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-03-10 17:46:00 +01:00
|
|
|
/**
|
|
|
|
** OSD Destructor.
|
|
|
|
**
|
|
|
|
** Shuts down the OSD.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
cSoftOsd::~cSoftOsd(void)
|
|
|
|
{
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: level %d\n", __FUNCTION__, OsdLevel);
|
|
|
|
#endif
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
SetActive(false);
|
2012-02-06 20:54:20 +01:00
|
|
|
// done by SetActive: OsdClose();
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-01-07 23:47:07 +01:00
|
|
|
#ifdef USE_YAEPG
|
2012-01-18 15:15:37 +01:00
|
|
|
// support yaepghd, video window
|
|
|
|
if (vidWin.bpp) { // restore fullsized video
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
double video_aspect;
|
|
|
|
|
|
|
|
::GetOsdSize(&width, &height, &video_aspect);
|
|
|
|
// works osd relative
|
|
|
|
VideoSetOutputPosition(0, 0, width, height);
|
2012-01-07 22:36:06 +01:00
|
|
|
}
|
2012-01-07 23:47:07 +01:00
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-06 20:54:20 +01:00
|
|
|
/**
|
|
|
|
** Actually commits all data to the OSD hardware.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cSoftOsd::Flush(void)
|
|
|
|
{
|
|
|
|
cPixmapMemory *pm;
|
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: level %d active %d\n", __FUNCTION__, OsdLevel,
|
|
|
|
Active());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!Active()) { // this osd is not active
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// don't draw sub-title if menu is active
|
|
|
|
if (OsdLevel >= OSD_LEVEL_SUBTITLES && IsOpen()) {
|
2011-12-07 14:37:51 +01:00
|
|
|
return;
|
|
|
|
}
|
2012-01-07 23:47:07 +01:00
|
|
|
#ifdef USE_YAEPG
|
2012-01-18 15:15:37 +01:00
|
|
|
// support yaepghd, video window
|
2012-01-07 22:36:06 +01:00
|
|
|
if (vidWin.bpp) {
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
2012-01-09 17:03:04 +01:00
|
|
|
dsyslog("[softhddev]%s: %dx%d+%d+%d\n", __FUNCTION__, vidWin.Width(),
|
|
|
|
vidWin.Height(), vidWin.x1, vidWin.y2);
|
2012-08-07 16:46:23 +02:00
|
|
|
#endif
|
2012-01-07 22:36:06 +01:00
|
|
|
|
|
|
|
// FIXME: vidWin is OSD relative not video window.
|
|
|
|
VideoSetOutputPosition(Left() + vidWin.x1, Top() + vidWin.y1,
|
|
|
|
vidWin.Width(), vidWin.Height());
|
|
|
|
}
|
2012-01-07 23:47:07 +01:00
|
|
|
#endif
|
2012-01-07 22:36:06 +01:00
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
//
|
|
|
|
// VDR draws subtitle without clearing the old
|
|
|
|
//
|
|
|
|
if (OsdLevel >= OSD_LEVEL_SUBTITLES) {
|
|
|
|
VideoOsdClear();
|
|
|
|
cSoftOsd::Dirty = 1;
|
2012-11-01 14:12:31 +01:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: subtitle clear\n", __FUNCTION__);
|
|
|
|
#endif
|
2012-08-07 16:46:23 +02:00
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
if (!IsTrueColor()) {
|
|
|
|
cBitmap *bitmap;
|
|
|
|
int i;
|
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
static char warned;
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
if (!warned) {
|
|
|
|
dsyslog("[softhddev]%s: FIXME: should be truecolor\n",
|
|
|
|
__FUNCTION__);
|
|
|
|
warned = 1;
|
|
|
|
}
|
2012-08-07 16:46:23 +02:00
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
// draw all bitmaps
|
|
|
|
for (i = 0; (bitmap = GetBitmap(i)); ++i) {
|
|
|
|
uint8_t *argb;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int w;
|
|
|
|
int h;
|
|
|
|
int x1;
|
|
|
|
int y1;
|
|
|
|
int x2;
|
|
|
|
int y2;
|
|
|
|
|
|
|
|
// get dirty bounding box
|
2012-03-10 17:46:00 +01:00
|
|
|
if (Dirty) { // forced complete update
|
2012-02-06 20:54:20 +01:00
|
|
|
x1 = 0;
|
|
|
|
y1 = 0;
|
|
|
|
x2 = bitmap->Width() - 1;
|
|
|
|
y2 = bitmap->Height() - 1;
|
|
|
|
} else if (!bitmap->Dirty(x1, y1, x2, y2)) {
|
2011-12-07 14:37:51 +01:00
|
|
|
continue; // nothing dirty continue
|
|
|
|
}
|
2012-01-18 15:15:37 +01:00
|
|
|
// convert and upload only dirty areas
|
|
|
|
w = x2 - x1 + 1;
|
|
|
|
h = y2 - y1 + 1;
|
2012-02-06 20:54:20 +01:00
|
|
|
if (1) { // just for the case it makes trouble
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
double video_aspect;
|
|
|
|
|
|
|
|
::GetOsdSize(&width, &height, &video_aspect);
|
|
|
|
if (w > width) {
|
|
|
|
w = width;
|
|
|
|
x2 = x1 + width - 1;
|
|
|
|
}
|
|
|
|
if (h > height) {
|
|
|
|
h = height;
|
|
|
|
y2 = y1 + height - 1;
|
|
|
|
}
|
|
|
|
}
|
2012-01-18 15:15:37 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (w > bitmap->Width() || h > bitmap->Height()) {
|
2012-02-23 15:32:43 +01:00
|
|
|
esyslog(tr("[softhddev]: dirty area too big\n"));
|
2012-01-18 15:15:37 +01:00
|
|
|
abort();
|
2012-01-12 18:55:07 +01:00
|
|
|
}
|
2012-01-18 15:15:37 +01:00
|
|
|
#endif
|
|
|
|
argb = (uint8_t *) malloc(w * h * sizeof(uint32_t));
|
|
|
|
for (y = y1; y <= y2; ++y) {
|
|
|
|
for (x = x1; x <= x2; ++x) {
|
|
|
|
((uint32_t *) argb)[x - x1 + (y - y1) * w] =
|
|
|
|
bitmap->GetColor(x, y);
|
|
|
|
}
|
|
|
|
}
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: draw %dx%d+%d+%d bm\n", __FUNCTION__, w, h,
|
|
|
|
Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1);
|
|
|
|
#endif
|
2012-01-18 15:15:37 +01:00
|
|
|
OsdDrawARGB(Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1,
|
|
|
|
w, h, argb);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
bitmap->Clean();
|
2012-02-06 20:54:20 +01:00
|
|
|
// FIXME: reuse argb
|
2011-12-07 14:37:51 +01:00
|
|
|
free(argb);
|
|
|
|
}
|
2012-03-10 17:46:00 +01:00
|
|
|
cSoftOsd::Dirty = 0;
|
2011-12-07 14:37:51 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOCK_PIXMAPS;
|
|
|
|
while ((pm = RenderPixmaps())) {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int w;
|
|
|
|
int h;
|
|
|
|
|
|
|
|
x = Left() + pm->ViewPort().X();
|
|
|
|
y = Top() + pm->ViewPort().Y();
|
|
|
|
w = pm->ViewPort().Width();
|
|
|
|
h = pm->ViewPort().Height();
|
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: draw %dx%d+%d+%d %p\n", __FUNCTION__, w, h, x,
|
|
|
|
y, pm->Data());
|
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
OsdDrawARGB(x, y, w, h, pm->Data());
|
|
|
|
|
|
|
|
delete pm;
|
|
|
|
}
|
2012-08-07 16:46:23 +02:00
|
|
|
cSoftOsd::Dirty = 0;
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// OSD provider
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-02-16 15:31:53 +01:00
|
|
|
/**
|
|
|
|
** Soft device plugin OSD provider class.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
class cSoftOsdProvider:public cOsdProvider
|
|
|
|
{
|
|
|
|
private:
|
2012-08-07 16:46:23 +02:00
|
|
|
static cOsd *Osd; ///< single OSD
|
2011-12-07 14:37:51 +01:00
|
|
|
public:
|
|
|
|
virtual cOsd * CreateOsd(int, int, uint);
|
|
|
|
virtual bool ProvidesTrueColor(void);
|
2012-08-07 16:46:23 +02:00
|
|
|
cSoftOsdProvider(void); ///< OSD provider constructor
|
|
|
|
//virtual ~cSoftOsdProvider(); ///< OSD provider destructor
|
2011-12-07 14:37:51 +01:00
|
|
|
};
|
|
|
|
|
2012-01-05 17:20:44 +01:00
|
|
|
cOsd *cSoftOsdProvider::Osd; ///< single osd
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Create a new OSD.
|
2012-02-06 20:54:20 +01:00
|
|
|
**
|
|
|
|
** @param left x-coordinate of OSD
|
|
|
|
** @param top y-coordinate of OSD
|
|
|
|
** @param level layer level of OSD
|
2011-12-07 14:37:51 +01:00
|
|
|
*/
|
|
|
|
cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level)
|
|
|
|
{
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s: %d, %d, %d\n", __FUNCTION__, left, top, level);
|
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-02-16 15:31:53 +01:00
|
|
|
return Osd = new cSoftOsd(left, top, level);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-02-16 15:31:53 +01:00
|
|
|
** Check if this OSD provider is able to handle a true color OSD.
|
|
|
|
**
|
|
|
|
** @returns true we are able to handle a true color OSD.
|
2011-12-07 14:37:51 +01:00
|
|
|
*/
|
|
|
|
bool cSoftOsdProvider::ProvidesTrueColor(void)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-01-07 22:36:06 +01:00
|
|
|
/**
|
|
|
|
** Create cOsdProvider class.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
cSoftOsdProvider::cSoftOsdProvider(void)
|
|
|
|
: cOsdProvider()
|
|
|
|
{
|
2012-08-07 16:46:23 +02:00
|
|
|
#ifdef OSD_DEBUG
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
/**
|
|
|
|
** Destroy cOsdProvider class.
|
|
|
|
cSoftOsdProvider::~cSoftOsdProvider()
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// cMenuSetupPage
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-02-19 19:22:03 +01:00
|
|
|
/**
|
|
|
|
** Soft device plugin menu setup page class.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
class cMenuSetupSoft:public cMenuSetupPage
|
|
|
|
{
|
|
|
|
protected:
|
2012-02-19 19:22:03 +01:00
|
|
|
///
|
|
|
|
/// local copies of global setup variables:
|
|
|
|
/// @{
|
2012-04-15 22:59:52 +02:00
|
|
|
int General;
|
2011-12-07 14:37:51 +01:00
|
|
|
int MakePrimary;
|
2012-01-10 15:52:07 +01:00
|
|
|
int HideMainMenuEntry;
|
2012-05-21 15:34:33 +02:00
|
|
|
int OsdSize;
|
|
|
|
int OsdWidth;
|
|
|
|
int OsdHeight;
|
2012-04-15 22:59:52 +02:00
|
|
|
int SuspendClose;
|
|
|
|
int SuspendX11;
|
|
|
|
|
|
|
|
int Video;
|
2012-04-17 16:45:27 +02:00
|
|
|
int VideoFormat;
|
|
|
|
int VideoDisplayFormat;
|
2012-02-24 15:15:50 +01:00
|
|
|
uint32_t Background;
|
|
|
|
uint32_t BackgroundAlpha;
|
2012-02-13 14:13:24 +01:00
|
|
|
int StudioLevels;
|
2012-03-06 12:16:47 +01:00
|
|
|
int _60HzMode;
|
|
|
|
int SoftStartSync;
|
2012-04-20 15:40:14 +02:00
|
|
|
int BlackPicture;
|
2012-04-15 22:59:52 +02:00
|
|
|
|
2012-09-03 16:39:33 +02:00
|
|
|
int Brightness;
|
|
|
|
int Contrast;
|
|
|
|
int Saturation;
|
|
|
|
int Hue;
|
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
int ResolutionShown[RESOLUTIONS];
|
2012-01-09 17:03:04 +01:00
|
|
|
int Scaling[RESOLUTIONS];
|
|
|
|
int Deinterlace[RESOLUTIONS];
|
|
|
|
int SkipChromaDeinterlace[RESOLUTIONS];
|
2012-02-14 22:29:17 +01:00
|
|
|
int InverseTelecine[RESOLUTIONS];
|
2012-01-09 17:03:04 +01:00
|
|
|
int Denoise[RESOLUTIONS];
|
|
|
|
int Sharpen[RESOLUTIONS];
|
2012-04-05 22:51:20 +02:00
|
|
|
int CutTopBottom[RESOLUTIONS];
|
|
|
|
int CutLeftRight[RESOLUTIONS];
|
2012-04-15 22:59:52 +02:00
|
|
|
|
2012-01-20 15:33:37 +01:00
|
|
|
int AutoCropInterval;
|
|
|
|
int AutoCropDelay;
|
2012-01-27 23:49:05 +01:00
|
|
|
int AutoCropTolerance;
|
2012-04-15 22:59:52 +02:00
|
|
|
|
|
|
|
int Audio;
|
|
|
|
int AudioDelay;
|
2012-04-20 18:28:25 +02:00
|
|
|
int AudioDrift;
|
2012-04-15 22:59:52 +02:00
|
|
|
int AudioPassthrough;
|
|
|
|
int AudioDownmix;
|
|
|
|
int AudioSoftvol;
|
|
|
|
int AudioNormalize;
|
|
|
|
int AudioMaxNormalize;
|
|
|
|
int AudioCompression;
|
|
|
|
int AudioMaxCompression;
|
|
|
|
int AudioStereoDescent;
|
2012-04-17 16:45:27 +02:00
|
|
|
int AudioBufferTime;
|
2012-02-19 19:22:03 +01:00
|
|
|
/// @}
|
2012-04-15 22:59:52 +02:00
|
|
|
private:
|
|
|
|
inline cOsdItem * CollapsedItem(const char *, int &, const char * = NULL);
|
|
|
|
void Create(void); // create sub-menu
|
2011-12-07 14:37:51 +01:00
|
|
|
protected:
|
|
|
|
virtual void Store(void);
|
|
|
|
public:
|
|
|
|
cMenuSetupSoft(void);
|
2012-04-15 22:59:52 +02:00
|
|
|
virtual eOSState ProcessKey(eKeys); // handle input
|
2011-12-07 14:37:51 +01:00
|
|
|
};
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
/**
|
|
|
|
** Create a seperator item.
|
2012-01-20 15:33:37 +01:00
|
|
|
**
|
|
|
|
** @param label text inside separator
|
2012-01-09 17:03:04 +01:00
|
|
|
*/
|
|
|
|
static inline cOsdItem *SeparatorItem(const char *label)
|
|
|
|
{
|
|
|
|
cOsdItem *item;
|
|
|
|
|
|
|
|
item = new cOsdItem(cString::sprintf("* %s: ", label));
|
|
|
|
item->SetSelectable(false);
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
/**
|
2012-04-15 22:59:52 +02:00
|
|
|
** Create a collapsed item.
|
|
|
|
**
|
|
|
|
** @param label text inside collapsed
|
|
|
|
** @param flag flag handling collapsed or opened
|
|
|
|
** @param msg open message
|
2011-12-07 14:37:51 +01:00
|
|
|
*/
|
2012-04-15 22:59:52 +02:00
|
|
|
inline cOsdItem *cMenuSetupSoft::CollapsedItem(const char *label, int &flag,
|
|
|
|
const char *msg)
|
|
|
|
{
|
|
|
|
cOsdItem *item;
|
|
|
|
|
|
|
|
item =
|
2012-07-02 15:20:14 +02:00
|
|
|
new cMenuEditBoolItem(cString::sprintf("* %s", label), &flag,
|
2012-04-15 22:59:52 +02:00
|
|
|
msg ? msg : tr("show"), tr("hide"));
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Create setup menu.
|
|
|
|
*/
|
|
|
|
void cMenuSetupSoft::Create(void)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-05-21 15:34:33 +02:00
|
|
|
static const char *const osd_size[] = {
|
|
|
|
"auto", "1920x1080", "1280x720", "custom",
|
|
|
|
};
|
2012-06-29 15:23:17 +02:00
|
|
|
#if 0
|
2012-04-17 16:45:27 +02:00
|
|
|
static const char *const video_display_formats_4_3[] = {
|
|
|
|
"pan&scan", "letterbox", "center cut-out",
|
|
|
|
};
|
|
|
|
static const char *const video_display_formats_16_9[] = {
|
|
|
|
"pan&scan", "pillarbox", "center cut-out",
|
|
|
|
};
|
2012-06-29 15:23:17 +02:00
|
|
|
#endif
|
2012-01-05 17:20:44 +01:00
|
|
|
static const char *const deinterlace[] = {
|
2012-02-09 21:22:42 +01:00
|
|
|
"Bob", "Weave/None", "Temporal", "TemporalSpatial", "Software Bob",
|
|
|
|
"Software Spatial",
|
2012-01-05 17:20:44 +01:00
|
|
|
};
|
2012-06-23 16:47:04 +02:00
|
|
|
static const char *const deinterlace_short[] = {
|
|
|
|
"B", "W", "T", "T+S", "S+B", "S+S",
|
|
|
|
};
|
2012-01-05 17:20:44 +01:00
|
|
|
static const char *const scaling[] = {
|
|
|
|
"Normal", "Fast", "HQ", "Anamorphic"
|
|
|
|
};
|
2012-06-23 16:47:04 +02:00
|
|
|
static const char *const scaling_short[] = {
|
|
|
|
"N", "F", "HQ", "A"
|
|
|
|
};
|
2012-04-20 18:28:25 +02:00
|
|
|
static const char *const audiodrift[] = {
|
|
|
|
"None", "PCM", "AC-3", "PCM + AC-3"
|
|
|
|
};
|
2012-01-07 03:05:43 +01:00
|
|
|
static const char *const passthrough[] = {
|
|
|
|
"None", "AC-3"
|
|
|
|
};
|
2012-01-09 17:03:04 +01:00
|
|
|
static const char *const resolution[RESOLUTIONS] = {
|
|
|
|
"576i", "720p", "fake 1080i", "1080i"
|
|
|
|
};
|
2012-04-15 22:59:52 +02:00
|
|
|
int current;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
current = Current(); // get current menu item index
|
|
|
|
Clear(); // clear the menu
|
|
|
|
|
|
|
|
//
|
|
|
|
// general
|
|
|
|
//
|
|
|
|
Add(CollapsedItem(tr("General"), General));
|
|
|
|
|
|
|
|
if (General) {
|
|
|
|
Add(new cMenuEditBoolItem(tr("Make primary device"), &MakePrimary,
|
|
|
|
trVDR("no"), trVDR("yes")));
|
|
|
|
Add(new cMenuEditBoolItem(tr("Hide main menu entry"),
|
|
|
|
&HideMainMenuEntry, trVDR("no"), trVDR("yes")));
|
|
|
|
//
|
2012-05-21 15:34:33 +02:00
|
|
|
// osd
|
|
|
|
//
|
|
|
|
Add(new cMenuEditStraItem(tr("Osd size"), &OsdSize, 4, osd_size));
|
|
|
|
if (OsdSize == 3) {
|
|
|
|
Add(new cMenuEditIntItem(tr("Osd width"), &OsdWidth, 0, 4096));
|
|
|
|
Add(new cMenuEditIntItem(tr("Osd height"), &OsdHeight, 0, 4096));
|
|
|
|
}
|
|
|
|
//
|
2012-04-15 22:59:52 +02:00
|
|
|
// suspend
|
|
|
|
//
|
|
|
|
Add(SeparatorItem(tr("Suspend")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Suspend closes video+audio"),
|
2012-04-15 22:59:52 +02:00
|
|
|
&SuspendClose, trVDR("no"), trVDR("yes")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Suspend stops x11"), &SuspendX11,
|
2012-04-15 22:59:52 +02:00
|
|
|
trVDR("no"), trVDR("yes")));
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// video
|
|
|
|
//
|
|
|
|
Add(CollapsedItem(tr("Video"), Video));
|
|
|
|
if (Video) {
|
2012-07-02 17:05:36 +02:00
|
|
|
#if 0 // disabled, not working as expected
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditBoolItem(trVDR("Setup.DVB$Video format"),
|
|
|
|
&VideoFormat, "4:3", "16:9"));
|
|
|
|
if (VideoFormat) {
|
|
|
|
Add(new cMenuEditStraItem(trVDR("Setup.DVB$Video display format"),
|
2012-04-20 16:51:04 +02:00
|
|
|
&VideoDisplayFormat, 3, video_display_formats_16_9));
|
2012-04-17 16:45:27 +02:00
|
|
|
} else {
|
|
|
|
Add(new cMenuEditStraItem(trVDR("Setup.DVB$Video display format"),
|
2012-04-20 16:51:04 +02:00
|
|
|
&VideoDisplayFormat, 3, video_display_formats_4_3));
|
2012-04-17 16:45:27 +02:00
|
|
|
}
|
2012-06-29 15:23:17 +02:00
|
|
|
#endif
|
2012-04-17 16:45:27 +02:00
|
|
|
|
|
|
|
// FIXME: switch config gray/color configuration
|
|
|
|
Add(new cMenuEditIntItem(tr("Video background color (RGB)"),
|
2012-04-15 22:59:52 +02:00
|
|
|
(int *)&Background, 0, 0x00FFFFFF));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditIntItem(tr("Video background color (Alpha)"),
|
2012-04-15 22:59:52 +02:00
|
|
|
(int *)&BackgroundAlpha, 0, 0xFF));
|
|
|
|
Add(new cMenuEditBoolItem(tr("Use studio levels (vdpau only)"),
|
|
|
|
&StudioLevels, trVDR("no"), trVDR("yes")));
|
|
|
|
Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode,
|
|
|
|
trVDR("no"), trVDR("yes")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync,
|
2012-04-15 22:59:52 +02:00
|
|
|
trVDR("no"), trVDR("yes")));
|
2012-04-20 15:40:14 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Black during channel switch"),
|
|
|
|
&BlackPicture, trVDR("no"), trVDR("yes")));
|
2012-04-15 22:59:52 +02:00
|
|
|
|
2012-09-03 16:39:33 +02:00
|
|
|
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"),
|
|
|
|
&Brightness, -1000, 1000, tr("min"), tr("max")));
|
|
|
|
Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast,
|
|
|
|
0, 10000, tr("min"), tr("max")));
|
|
|
|
Add(new cMenuEditIntItem(tr("Saturation (0..10000) (vdpau)"),
|
|
|
|
&Saturation, 0, 10000, tr("min"), tr("max")));
|
2012-10-29 16:00:45 +01:00
|
|
|
Add(new cMenuEditIntItem(tr("Hue (-3141..3141) (vdpau)"), &Hue, -3141,
|
|
|
|
3141, tr("min"), tr("max")));
|
2012-09-03 16:39:33 +02:00
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
for (i = 0; i < RESOLUTIONS; ++i) {
|
2012-06-23 16:47:04 +02:00
|
|
|
cString msg;
|
|
|
|
|
|
|
|
// short hidden informations
|
|
|
|
msg =
|
|
|
|
cString::sprintf("%s,%s%s...", scaling_short[Scaling[i]],
|
|
|
|
deinterlace_short[Deinterlace[i]],
|
|
|
|
SkipChromaDeinterlace[i] ? ",skip" : "");
|
|
|
|
Add(CollapsedItem(resolution[i], ResolutionShown[i], msg));
|
2012-04-15 22:59:52 +02:00
|
|
|
|
|
|
|
if (ResolutionShown[i]) {
|
|
|
|
Add(new cMenuEditStraItem(tr("Scaling"), &Scaling[i], 4,
|
|
|
|
scaling));
|
|
|
|
Add(new cMenuEditStraItem(tr("Deinterlace"), &Deinterlace[i],
|
|
|
|
6, deinterlace));
|
|
|
|
Add(new cMenuEditBoolItem(tr("SkipChromaDeinterlace (vdpau)"),
|
|
|
|
&SkipChromaDeinterlace[i], trVDR("no"), trVDR("yes")));
|
|
|
|
Add(new cMenuEditBoolItem(tr("Inverse Telecine (vdpau)"),
|
|
|
|
&InverseTelecine[i], trVDR("no"), trVDR("yes")));
|
|
|
|
Add(new cMenuEditIntItem(tr("Denoise (0..1000) (vdpau)"),
|
|
|
|
&Denoise[i], 0, 1000, tr("off"), tr("max")));
|
|
|
|
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
|
|
|
|
&Sharpen[i], -1000, 1000, tr("blur max"),
|
|
|
|
tr("sharpen max")));
|
|
|
|
|
|
|
|
Add(new cMenuEditIntItem(tr("Cut top and bottom (pixel)"),
|
|
|
|
&CutTopBottom[i], 0, 250));
|
|
|
|
Add(new cMenuEditIntItem(tr("Cut left and right (pixel)"),
|
|
|
|
&CutLeftRight[i], 0, 250));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// auto-crop
|
|
|
|
//
|
|
|
|
Add(SeparatorItem(tr("Auto-crop")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditIntItem(tr("Autocrop interval (frames)"),
|
2012-04-15 22:59:52 +02:00
|
|
|
&AutoCropInterval, 0, 200, tr("off")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditIntItem(tr("Autocrop delay (n * interval)"),
|
2012-04-15 22:59:52 +02:00
|
|
|
&AutoCropDelay, 0, 200));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"),
|
2012-04-15 22:59:52 +02:00
|
|
|
&AutoCropTolerance, 0, 32));
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// audio
|
|
|
|
//
|
|
|
|
Add(CollapsedItem(tr("Audio"), Audio));
|
|
|
|
|
|
|
|
if (Audio) {
|
|
|
|
Add(new cMenuEditIntItem(tr("Audio/Video delay (ms)"), &AudioDelay,
|
|
|
|
-1000, 1000));
|
2012-04-30 14:47:08 +02:00
|
|
|
Add(new cMenuEditStraItem(tr("Audio drift correction"), &AudioDrift, 4,
|
|
|
|
audiodrift));
|
2012-04-15 22:59:52 +02:00
|
|
|
Add(new cMenuEditStraItem(tr("Audio pass-through"), &AudioPassthrough,
|
|
|
|
2, passthrough));
|
2012-05-13 16:58:45 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Enable AC-3 (decoder) downmix"),
|
|
|
|
&AudioDownmix, trVDR("no"), trVDR("yes")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Volume control"), &AudioSoftvol,
|
|
|
|
tr("Hardware"), tr("Software")));
|
|
|
|
Add(new cMenuEditBoolItem(tr("Enable normalize volume"),
|
2012-04-19 16:01:20 +02:00
|
|
|
&AudioNormalize, trVDR("no"), trVDR("yes")));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditIntItem(tr(" Max normalize factor (/1000)"),
|
2012-04-19 16:01:20 +02:00
|
|
|
&AudioMaxNormalize, 0, 10000));
|
2012-04-17 16:45:27 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Enable volume compression"),
|
|
|
|
&AudioCompression, trVDR("no"), trVDR("yes")));
|
|
|
|
Add(new cMenuEditIntItem(tr(" Max compression factor (/1000)"),
|
|
|
|
&AudioMaxCompression, 0, 10000));
|
|
|
|
Add(new cMenuEditIntItem(tr("Reduce stereo volume (/1000)"),
|
|
|
|
&AudioStereoDescent, 0, 1000));
|
|
|
|
Add(new cMenuEditIntItem(tr("Audio buffer size (ms)"),
|
|
|
|
&AudioBufferTime, 0, 1000));
|
2012-04-15 22:59:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SetCurrent(Get(current)); // restore selected menu entry
|
|
|
|
Display(); // display build menu
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Process key for setup menu.
|
|
|
|
*/
|
|
|
|
eOSState cMenuSetupSoft::ProcessKey(eKeys key)
|
|
|
|
{
|
|
|
|
eOSState state;
|
|
|
|
int old_general;
|
|
|
|
int old_video;
|
|
|
|
int old_audio;
|
2012-05-21 15:34:33 +02:00
|
|
|
int old_osd_size;
|
2012-04-17 16:45:27 +02:00
|
|
|
int old_video_format;
|
2012-04-15 22:59:52 +02:00
|
|
|
int old_resolution_shown[RESOLUTIONS];
|
2012-01-09 17:03:04 +01:00
|
|
|
int i;
|
2011-12-12 17:06:05 +01:00
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
old_general = General;
|
|
|
|
old_video = Video;
|
|
|
|
old_audio = Audio;
|
2012-05-21 15:34:33 +02:00
|
|
|
old_osd_size = OsdSize;
|
2012-04-17 16:45:27 +02:00
|
|
|
old_video_format = VideoFormat;
|
2012-04-15 22:59:52 +02:00
|
|
|
memcpy(old_resolution_shown, ResolutionShown, sizeof(ResolutionShown));
|
|
|
|
state = cMenuSetupPage::ProcessKey(key);
|
|
|
|
|
|
|
|
if (key != kNone) {
|
|
|
|
// update menu only, if something on the structure has changed
|
2012-05-21 15:34:33 +02:00
|
|
|
// this is needed because VDR menus are evil slow
|
2012-04-20 16:51:04 +02:00
|
|
|
if (old_general != General || old_video != Video || old_audio != Audio
|
2012-05-21 15:34:33 +02:00
|
|
|
|| old_osd_size != OsdSize || old_video_format != VideoFormat) {
|
2012-04-15 22:59:52 +02:00
|
|
|
Create(); // update menu
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < RESOLUTIONS; ++i) {
|
|
|
|
if (old_resolution_shown[i] != ResolutionShown[i]) {
|
|
|
|
Create(); // update menu
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Constructor setup menu.
|
|
|
|
**
|
|
|
|
** Import global config variables into setup.
|
|
|
|
*/
|
|
|
|
cMenuSetupSoft::cMenuSetupSoft(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
//
|
|
|
|
// general
|
|
|
|
//
|
|
|
|
General = 0;
|
2011-12-15 16:02:32 +01:00
|
|
|
MakePrimary = ConfigMakePrimary;
|
2012-01-10 15:52:07 +01:00
|
|
|
HideMainMenuEntry = ConfigHideMainMenuEntry;
|
2012-01-09 17:03:04 +01:00
|
|
|
//
|
2012-05-21 15:34:33 +02:00
|
|
|
// osd
|
|
|
|
//
|
|
|
|
OsdWidth = ConfigOsdWidth;
|
|
|
|
OsdHeight = ConfigOsdHeight;
|
|
|
|
if (!OsdWidth && !OsdHeight) {
|
|
|
|
OsdSize = 0;
|
|
|
|
} else if (OsdWidth == 1920 && OsdHeight == 1080) {
|
|
|
|
OsdSize = 1;
|
|
|
|
} else if (OsdWidth == 1280 && OsdHeight == 720) {
|
|
|
|
OsdSize = 2;
|
|
|
|
} else {
|
|
|
|
OsdSize = 3;
|
|
|
|
}
|
|
|
|
//
|
2012-04-15 22:59:52 +02:00
|
|
|
// suspend
|
2012-01-09 17:03:04 +01:00
|
|
|
//
|
2012-04-15 22:59:52 +02:00
|
|
|
SuspendClose = ConfigSuspendClose;
|
|
|
|
SuspendX11 = ConfigSuspendX11;
|
2012-02-02 16:00:26 +01:00
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
//
|
|
|
|
// video
|
|
|
|
//
|
|
|
|
Video = 0;
|
2012-04-17 16:45:27 +02:00
|
|
|
VideoFormat = Setup.VideoFormat;
|
|
|
|
VideoDisplayFormat = Setup.VideoDisplayFormat;
|
2012-02-24 15:15:50 +01:00
|
|
|
// no unsigned int menu item supported, split background color/alpha
|
|
|
|
Background = ConfigVideoBackground >> 8;
|
|
|
|
BackgroundAlpha = ConfigVideoBackground & 0xFF;
|
2012-02-13 14:13:24 +01:00
|
|
|
StudioLevels = ConfigVideoStudioLevels;
|
2012-03-06 12:16:47 +01:00
|
|
|
_60HzMode = ConfigVideo60HzMode;
|
|
|
|
SoftStartSync = ConfigVideoSoftStartSync;
|
2012-04-20 15:40:14 +02:00
|
|
|
BlackPicture = ConfigVideoBlackPicture;
|
2012-02-02 16:00:26 +01:00
|
|
|
|
2012-09-03 16:39:33 +02:00
|
|
|
Brightness = ConfigVideoBrightness;
|
|
|
|
Contrast = ConfigVideoContrast;
|
|
|
|
Saturation = ConfigVideoSaturation;
|
|
|
|
Hue = ConfigVideoHue;
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
for (i = 0; i < RESOLUTIONS; ++i) {
|
2012-04-15 22:59:52 +02:00
|
|
|
ResolutionShown[i] = 0;
|
2012-01-09 17:03:04 +01:00
|
|
|
Scaling[i] = ConfigVideoScaling[i];
|
|
|
|
Deinterlace[i] = ConfigVideoDeinterlace[i];
|
|
|
|
SkipChromaDeinterlace[i] = ConfigVideoSkipChromaDeinterlace[i];
|
2012-02-14 22:29:17 +01:00
|
|
|
InverseTelecine[i] = ConfigVideoInverseTelecine[i];
|
2012-01-09 17:03:04 +01:00
|
|
|
Denoise[i] = ConfigVideoDenoise[i];
|
|
|
|
Sharpen[i] = ConfigVideoSharpen[i];
|
2012-04-05 22:51:20 +02:00
|
|
|
|
|
|
|
CutTopBottom[i] = ConfigVideoCutTopBottom[i];
|
|
|
|
CutLeftRight[i] = ConfigVideoCutLeftRight[i];
|
2012-01-09 17:03:04 +01:00
|
|
|
}
|
|
|
|
//
|
2012-01-20 15:33:37 +01:00
|
|
|
// auto-crop
|
|
|
|
//
|
|
|
|
AutoCropInterval = ConfigAutoCropInterval;
|
|
|
|
AutoCropDelay = ConfigAutoCropDelay;
|
2012-01-27 23:49:05 +01:00
|
|
|
AutoCropTolerance = ConfigAutoCropTolerance;
|
2012-04-15 22:59:52 +02:00
|
|
|
|
2012-01-22 20:49:43 +01:00
|
|
|
//
|
2012-04-15 22:59:52 +02:00
|
|
|
// audio
|
2012-01-22 20:49:43 +01:00
|
|
|
//
|
2012-04-15 22:59:52 +02:00
|
|
|
Audio = 0;
|
|
|
|
AudioDelay = ConfigVideoAudioDelay;
|
2012-04-20 18:28:25 +02:00
|
|
|
AudioDrift = ConfigAudioDrift;
|
2012-04-15 22:59:52 +02:00
|
|
|
AudioPassthrough = ConfigAudioPassthrough;
|
|
|
|
AudioDownmix = ConfigAudioDownmix;
|
|
|
|
AudioSoftvol = ConfigAudioSoftvol;
|
|
|
|
AudioNormalize = ConfigAudioNormalize;
|
|
|
|
AudioMaxNormalize = ConfigAudioMaxNormalize;
|
|
|
|
AudioCompression = ConfigAudioCompression;
|
|
|
|
AudioMaxCompression = ConfigAudioMaxCompression;
|
|
|
|
AudioStereoDescent = ConfigAudioStereoDescent;
|
2012-04-17 16:45:27 +02:00
|
|
|
AudioBufferTime = ConfigAudioBufferTime;
|
2012-04-15 22:59:52 +02:00
|
|
|
|
|
|
|
Create();
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Store setup.
|
|
|
|
*/
|
|
|
|
void cMenuSetupSoft::Store(void)
|
|
|
|
{
|
2012-01-09 17:03:04 +01:00
|
|
|
int i;
|
|
|
|
|
2011-12-17 19:25:08 +01:00
|
|
|
SetupStore("MakePrimary", ConfigMakePrimary = MakePrimary);
|
2012-01-10 15:52:07 +01:00
|
|
|
SetupStore("HideMainMenuEntry", ConfigHideMainMenuEntry =
|
|
|
|
HideMainMenuEntry);
|
2012-05-21 15:34:33 +02:00
|
|
|
switch (OsdSize) {
|
|
|
|
case 0:
|
|
|
|
OsdWidth = 0;
|
|
|
|
OsdHeight = 0;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
OsdWidth = 1920;
|
|
|
|
OsdHeight = 1080;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
OsdWidth = 1280;
|
|
|
|
OsdHeight = 720;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ConfigOsdWidth != OsdWidth || ConfigOsdHeight != OsdHeight) {
|
|
|
|
VideoSetOsdSize(ConfigOsdWidth = OsdWidth, ConfigOsdHeight =
|
|
|
|
OsdHeight);
|
2012-06-23 16:47:04 +02:00
|
|
|
// FIXME: shown osd size not updated
|
2012-05-21 15:34:33 +02:00
|
|
|
}
|
|
|
|
SetupStore("Osd.Width", ConfigOsdWidth);
|
|
|
|
SetupStore("Osd.Height", ConfigOsdHeight);
|
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
SetupStore("Suspend.Close", ConfigSuspendClose = SuspendClose);
|
|
|
|
SetupStore("Suspend.X11", ConfigSuspendX11 = SuspendX11);
|
2012-04-17 16:45:27 +02:00
|
|
|
// FIXME: this is also in VDR-DVB setup
|
|
|
|
if (Setup.VideoFormat != VideoFormat) {
|
|
|
|
Setup.VideoFormat = VideoFormat;
|
|
|
|
cDevice::PrimaryDevice()->SetVideoFormat(Setup.VideoFormat);
|
|
|
|
}
|
2012-05-13 16:58:45 +02:00
|
|
|
//SetupStore("VideoFormat", Setup.VideoFormat);
|
2012-04-17 16:45:27 +02:00
|
|
|
if (Setup.VideoDisplayFormat != VideoDisplayFormat) {
|
|
|
|
Setup.VideoDisplayFormat = VideoDisplayFormat;
|
2012-07-02 17:05:36 +02:00
|
|
|
cDevice::PrimaryDevice()->
|
|
|
|
SetVideoDisplayFormat(eVideoDisplayFormat(Setup.
|
|
|
|
VideoDisplayFormat));
|
2012-04-17 16:45:27 +02:00
|
|
|
}
|
2012-05-13 16:58:45 +02:00
|
|
|
//SetupStore("VideoDisplayFormat", Setup.VideoDisplayFormat);
|
2012-01-09 17:03:04 +01:00
|
|
|
|
2012-02-24 15:15:50 +01:00
|
|
|
ConfigVideoBackground = Background << 8 | (BackgroundAlpha & 0xFF);
|
|
|
|
SetupStore("Background", ConfigVideoBackground);
|
|
|
|
VideoSetBackground(ConfigVideoBackground);
|
2012-02-13 14:13:24 +01:00
|
|
|
SetupStore("StudioLevels", ConfigVideoStudioLevels = StudioLevels);
|
|
|
|
VideoSetStudioLevels(ConfigVideoStudioLevels);
|
2012-03-06 12:16:47 +01:00
|
|
|
SetupStore("60HzMode", ConfigVideo60HzMode = _60HzMode);
|
|
|
|
VideoSet60HzMode(ConfigVideo60HzMode);
|
|
|
|
SetupStore("SoftStartSync", ConfigVideoSoftStartSync = SoftStartSync);
|
|
|
|
VideoSetSoftStartSync(ConfigVideoSoftStartSync);
|
2012-04-20 15:40:14 +02:00
|
|
|
SetupStore("BlackPicture", ConfigVideoBlackPicture = BlackPicture);
|
|
|
|
VideoSetBlackPicture(ConfigVideoBlackPicture);
|
2012-02-02 16:00:26 +01:00
|
|
|
|
2012-09-03 16:39:33 +02:00
|
|
|
SetupStore("Brightness", ConfigVideoBrightness = Brightness);
|
|
|
|
VideoSetBrightness(ConfigVideoBrightness);
|
|
|
|
SetupStore("Contrast", ConfigVideoContrast = Contrast);
|
|
|
|
VideoSetContrast(ConfigVideoContrast);
|
|
|
|
SetupStore("Saturation", ConfigVideoSaturation = Saturation);
|
|
|
|
VideoSetSaturation(ConfigVideoSaturation);
|
|
|
|
SetupStore("Hue", ConfigVideoHue = Hue);
|
|
|
|
VideoSetHue(ConfigVideoHue);
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
for (i = 0; i < RESOLUTIONS; ++i) {
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Scaling");
|
|
|
|
SetupStore(buf, ConfigVideoScaling[i] = Scaling[i]);
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Deinterlace");
|
|
|
|
SetupStore(buf, ConfigVideoDeinterlace[i] = Deinterlace[i]);
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i],
|
|
|
|
"SkipChromaDeinterlace");
|
|
|
|
SetupStore(buf, ConfigVideoSkipChromaDeinterlace[i] =
|
|
|
|
SkipChromaDeinterlace[i]);
|
2012-02-14 22:29:17 +01:00
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "InverseTelecine");
|
|
|
|
SetupStore(buf, ConfigVideoInverseTelecine[i] = InverseTelecine[i]);
|
2012-01-09 17:03:04 +01:00
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Denoise");
|
|
|
|
SetupStore(buf, ConfigVideoDenoise[i] = Denoise[i]);
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Sharpen");
|
|
|
|
SetupStore(buf, ConfigVideoSharpen[i] = Sharpen[i]);
|
2012-04-05 22:51:20 +02:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutTopBottom");
|
|
|
|
SetupStore(buf, ConfigVideoCutTopBottom[i] = CutTopBottom[i]);
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutLeftRight");
|
|
|
|
SetupStore(buf, ConfigVideoCutLeftRight[i] = CutLeftRight[i]);
|
2012-01-09 17:03:04 +01:00
|
|
|
}
|
|
|
|
VideoSetScaling(ConfigVideoScaling);
|
2011-12-17 19:25:08 +01:00
|
|
|
VideoSetDeinterlace(ConfigVideoDeinterlace);
|
2012-01-05 17:20:44 +01:00
|
|
|
VideoSetSkipChromaDeinterlace(ConfigVideoSkipChromaDeinterlace);
|
2012-02-14 22:29:17 +01:00
|
|
|
VideoSetInverseTelecine(ConfigVideoInverseTelecine);
|
2012-01-05 17:20:44 +01:00
|
|
|
VideoSetDenoise(ConfigVideoDenoise);
|
|
|
|
VideoSetSharpen(ConfigVideoSharpen);
|
2012-04-05 22:51:20 +02:00
|
|
|
VideoSetCutTopBottom(ConfigVideoCutTopBottom);
|
|
|
|
VideoSetCutLeftRight(ConfigVideoCutLeftRight);
|
2012-01-09 17:03:04 +01:00
|
|
|
|
2012-01-20 15:33:37 +01:00
|
|
|
SetupStore("AutoCrop.Interval", ConfigAutoCropInterval = AutoCropInterval);
|
|
|
|
SetupStore("AutoCrop.Delay", ConfigAutoCropDelay = AutoCropDelay);
|
2012-02-02 16:00:26 +01:00
|
|
|
SetupStore("AutoCrop.Tolerance", ConfigAutoCropTolerance =
|
|
|
|
AutoCropTolerance);
|
|
|
|
VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay,
|
|
|
|
ConfigAutoCropTolerance);
|
2012-04-17 16:45:27 +02:00
|
|
|
ConfigAutoCropEnabled = ConfigAutoCropInterval != 0;
|
2012-01-22 20:49:43 +01:00
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
SetupStore("AudioDelay", ConfigVideoAudioDelay = AudioDelay);
|
|
|
|
VideoSetAudioDelay(ConfigVideoAudioDelay);
|
2012-04-20 18:28:25 +02:00
|
|
|
SetupStore("AudioDrift", ConfigAudioDrift = AudioDrift);
|
|
|
|
CodecSetAudioDrift(ConfigAudioDrift);
|
2012-04-15 22:59:52 +02:00
|
|
|
SetupStore("AudioPassthrough", ConfigAudioPassthrough = AudioPassthrough);
|
|
|
|
CodecSetAudioPassthrough(ConfigAudioPassthrough);
|
|
|
|
SetupStore("AudioDownmix", ConfigAudioDownmix = AudioDownmix);
|
|
|
|
CodecSetAudioDownmix(ConfigAudioDownmix);
|
2012-04-20 16:51:04 +02:00
|
|
|
SetupStore("AudioSoftvol", ConfigAudioSoftvol = AudioSoftvol);
|
2012-04-17 16:45:27 +02:00
|
|
|
AudioSetSoftvol(ConfigAudioSoftvol);
|
2012-04-20 16:51:04 +02:00
|
|
|
SetupStore("AudioNormalize", ConfigAudioNormalize = AudioNormalize);
|
|
|
|
SetupStore("AudioMaxNormalize", ConfigAudioMaxNormalize =
|
|
|
|
AudioMaxNormalize);
|
2012-04-17 16:45:27 +02:00
|
|
|
AudioSetNormalize(ConfigAudioNormalize, ConfigAudioMaxNormalize);
|
2012-04-20 16:51:04 +02:00
|
|
|
SetupStore("AudioCompression", ConfigAudioCompression = AudioCompression);
|
|
|
|
SetupStore("AudioMaxCompression", ConfigAudioMaxCompression =
|
|
|
|
AudioMaxCompression);
|
2012-04-17 16:45:27 +02:00
|
|
|
AudioSetCompression(ConfigAudioCompression, ConfigAudioMaxCompression);
|
2012-04-20 16:51:04 +02:00
|
|
|
SetupStore("AudioStereoDescent", ConfigAudioStereoDescent =
|
|
|
|
AudioStereoDescent);
|
2012-04-17 16:45:27 +02:00
|
|
|
AudioSetStereoDescent(ConfigAudioStereoDescent);
|
2012-04-20 16:51:04 +02:00
|
|
|
SetupStore("AudioBufferTime", ConfigAudioBufferTime = AudioBufferTime);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-22 11:12:57 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// cPlayer
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Dummy player for suspend mode.
|
|
|
|
*/
|
|
|
|
class cSoftHdPlayer:public cPlayer
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
public:
|
|
|
|
cSoftHdPlayer(void);
|
|
|
|
virtual ~ cSoftHdPlayer();
|
|
|
|
};
|
|
|
|
|
|
|
|
cSoftHdPlayer::cSoftHdPlayer(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
cSoftHdPlayer::~cSoftHdPlayer()
|
|
|
|
{
|
|
|
|
Detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// cControl
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
2012-03-11 14:12:49 +01:00
|
|
|
** Dummy control class for suspend mode.
|
2012-01-22 11:12:57 +01:00
|
|
|
*/
|
|
|
|
class cSoftHdControl:public cControl
|
|
|
|
{
|
|
|
|
public:
|
2012-02-08 23:26:49 +01:00
|
|
|
static cSoftHdPlayer *Player; ///< dummy player
|
2012-03-11 14:12:49 +01:00
|
|
|
virtual void Hide(void) ///< hide control
|
2012-01-22 11:12:57 +01:00
|
|
|
{
|
|
|
|
}
|
2012-03-11 14:12:49 +01:00
|
|
|
virtual eOSState ProcessKey(eKeys); ///< process input events
|
2012-01-22 11:12:57 +01:00
|
|
|
|
2012-03-11 14:12:49 +01:00
|
|
|
cSoftHdControl(void); ///< control constructor
|
2012-01-22 11:12:57 +01:00
|
|
|
|
2012-03-11 14:12:49 +01:00
|
|
|
virtual ~ cSoftHdControl(); ///< control destructor
|
2012-01-22 11:12:57 +01:00
|
|
|
};
|
|
|
|
|
2012-03-11 14:12:49 +01:00
|
|
|
cSoftHdPlayer *cSoftHdControl::Player; ///< dummy player instance
|
2012-02-08 23:26:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Handle a key event.
|
|
|
|
**
|
|
|
|
** @param key key pressed
|
|
|
|
*/
|
2012-01-22 11:12:57 +01:00
|
|
|
eOSState cSoftHdControl::ProcessKey(eKeys key)
|
|
|
|
{
|
2012-03-01 22:12:22 +01:00
|
|
|
if (SuspendMode == SUSPEND_NORMAL && (!ISMODELESSKEY(key)
|
|
|
|
|| key == kMenu || key == kBack || key == kStop)) {
|
2012-08-09 16:22:06 +02:00
|
|
|
delete Player;
|
2012-09-03 16:39:33 +02:00
|
|
|
|
2012-08-09 16:22:06 +02:00
|
|
|
Player = NULL;
|
2012-02-08 23:26:49 +01:00
|
|
|
Resume();
|
2012-03-11 14:12:49 +01:00
|
|
|
SuspendMode = NOT_SUSPENDED;
|
2012-01-22 11:12:57 +01:00
|
|
|
return osEnd;
|
|
|
|
}
|
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
|
2012-02-19 19:22:03 +01:00
|
|
|
/**
|
|
|
|
** Player control constructor.
|
|
|
|
*/
|
2012-01-22 11:12:57 +01:00
|
|
|
cSoftHdControl::cSoftHdControl(void)
|
|
|
|
: cControl(Player = new cSoftHdPlayer)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-02-19 19:22:03 +01:00
|
|
|
/**
|
|
|
|
** Player control destructor.
|
|
|
|
*/
|
2012-01-22 11:12:57 +01:00
|
|
|
cSoftHdControl::~cSoftHdControl()
|
|
|
|
{
|
2012-08-09 16:22:06 +02:00
|
|
|
delete Player;
|
2012-09-03 16:39:33 +02:00
|
|
|
|
2012-08-09 16:22:06 +02:00
|
|
|
Player = NULL;
|
|
|
|
// loose control resume
|
|
|
|
if (SuspendMode == SUSPEND_NORMAL) {
|
|
|
|
Resume();
|
|
|
|
SuspendMode = NOT_SUSPENDED;
|
2012-01-22 11:12:57 +01:00
|
|
|
}
|
2012-03-01 22:12:22 +01:00
|
|
|
|
2012-03-11 14:12:49 +01:00
|
|
|
dsyslog("[softhddev]%s: dummy player stopped\n", __FUNCTION__);
|
2012-01-22 11:12:57 +01:00
|
|
|
}
|
|
|
|
|
2012-02-19 19:22:03 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// cOsdMenu
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Soft device plugin menu class.
|
|
|
|
*/
|
|
|
|
class cSoftHdMenu:public cOsdMenu
|
|
|
|
{
|
2012-07-02 17:05:36 +02:00
|
|
|
private:
|
2012-02-19 19:22:03 +01:00
|
|
|
int HotkeyState; ///< current hot-key state
|
|
|
|
int HotkeyCode; ///< current hot-key code
|
2012-07-02 17:05:36 +02:00
|
|
|
void Create(void); ///< create plugin main menu
|
2012-02-19 19:22:03 +01:00
|
|
|
public:
|
|
|
|
cSoftHdMenu(const char *, int = 0, int = 0, int = 0, int = 0, int = 0);
|
|
|
|
virtual ~ cSoftHdMenu();
|
|
|
|
virtual eOSState ProcessKey(eKeys);
|
|
|
|
};
|
|
|
|
|
2012-07-02 17:05:36 +02:00
|
|
|
/**
|
|
|
|
** Create main menu.
|
|
|
|
*/
|
|
|
|
void cSoftHdMenu::Create(void)
|
|
|
|
{
|
|
|
|
int current;
|
|
|
|
int missed;
|
|
|
|
int duped;
|
|
|
|
int dropped;
|
|
|
|
int counter;
|
|
|
|
|
|
|
|
current = Current(); // get current menu item index
|
|
|
|
Clear(); // clear the menu
|
|
|
|
|
|
|
|
SetHasHotkeys();
|
|
|
|
Add(new cOsdItem(hk(tr("Suspend SoftHdDevice")), osUser1));
|
|
|
|
Add(new cOsdItem(NULL, osUnknown, false));
|
|
|
|
Add(new cOsdItem(NULL, osUnknown, false));
|
|
|
|
GetStats(&missed, &duped, &dropped, &counter);
|
|
|
|
Add(new cOsdItem(cString::
|
|
|
|
sprintf(tr(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"),
|
|
|
|
missed, duped, dropped, counter), osUnknown, false));
|
|
|
|
|
|
|
|
SetCurrent(Get(current)); // restore selected menu entry
|
|
|
|
Display(); // display build menu
|
|
|
|
}
|
|
|
|
|
2012-02-19 19:22:03 +01:00
|
|
|
/**
|
|
|
|
** Soft device menu constructor.
|
|
|
|
*/
|
|
|
|
cSoftHdMenu::cSoftHdMenu(const char *title, int c0, int c1, int c2, int c3,
|
|
|
|
int c4)
|
|
|
|
:cOsdMenu(title, c0, c1, c2, c3, c4)
|
|
|
|
{
|
|
|
|
HotkeyState = 0;
|
|
|
|
|
2012-07-02 17:05:36 +02:00
|
|
|
Create();
|
2012-02-19 19:22:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Soft device menu destructor.
|
|
|
|
*/
|
|
|
|
cSoftHdMenu::~cSoftHdMenu()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Handle hot key commands.
|
2012-02-25 13:02:15 +01:00
|
|
|
**
|
|
|
|
** @param code numeric hot key code
|
2012-02-19 19:22:03 +01:00
|
|
|
*/
|
|
|
|
static void HandleHotkey(int code)
|
|
|
|
{
|
|
|
|
switch (code) {
|
|
|
|
case 10: // disable pass-through
|
|
|
|
CodecSetAudioPassthrough(ConfigAudioPassthrough = 0);
|
2012-04-11 18:20:08 +02:00
|
|
|
Skins.QueueMessage(mtInfo, tr("pass-through disabled"));
|
2012-02-19 19:22:03 +01:00
|
|
|
break;
|
|
|
|
case 11: // enable pass-through
|
|
|
|
CodecSetAudioPassthrough(ConfigAudioPassthrough = 1);
|
2012-04-11 18:20:08 +02:00
|
|
|
Skins.QueueMessage(mtInfo, tr("pass-through enabled"));
|
2012-02-19 19:22:03 +01:00
|
|
|
break;
|
|
|
|
case 12: // toggle pass-through
|
|
|
|
CodecSetAudioPassthrough(ConfigAudioPassthrough ^= 1);
|
2012-04-11 18:20:08 +02:00
|
|
|
if (ConfigAudioPassthrough) {
|
|
|
|
Skins.QueueMessage(mtInfo, tr("pass-through enabled"));
|
|
|
|
} else {
|
|
|
|
Skins.QueueMessage(mtInfo, tr("pass-through disabled"));
|
|
|
|
}
|
2012-02-19 19:22:03 +01:00
|
|
|
break;
|
2012-04-07 00:15:57 +02:00
|
|
|
case 13: // decrease audio delay
|
2012-04-07 13:43:51 +02:00
|
|
|
ConfigVideoAudioDelay -= 10;
|
|
|
|
VideoSetAudioDelay(ConfigVideoAudioDelay);
|
2012-04-11 18:20:08 +02:00
|
|
|
Skins.QueueMessage(mtInfo,
|
|
|
|
cString::sprintf(tr("audio delay changed to %d"),
|
|
|
|
ConfigVideoAudioDelay));
|
2012-04-07 00:15:57 +02:00
|
|
|
break;
|
|
|
|
case 14: // increase audio delay
|
2012-04-07 13:43:51 +02:00
|
|
|
ConfigVideoAudioDelay += 10;
|
|
|
|
VideoSetAudioDelay(ConfigVideoAudioDelay);
|
2012-04-11 18:20:08 +02:00
|
|
|
Skins.QueueMessage(mtInfo,
|
|
|
|
cString::sprintf(tr("audio delay changed to %d"),
|
|
|
|
ConfigVideoAudioDelay));
|
2012-04-07 00:15:57 +02:00
|
|
|
break;
|
|
|
|
|
2012-04-06 14:38:51 +02:00
|
|
|
case 20: // disable full screen
|
|
|
|
VideoSetFullscreen(0);
|
|
|
|
break;
|
|
|
|
case 21: // enable full screen
|
|
|
|
VideoSetFullscreen(1);
|
|
|
|
break;
|
|
|
|
case 22: // toggle full screen
|
|
|
|
VideoSetFullscreen(-1);
|
|
|
|
break;
|
2012-04-14 21:25:44 +02:00
|
|
|
case 23: // disable auto-crop
|
|
|
|
ConfigAutoCropEnabled = 0;
|
2012-04-15 22:59:52 +02:00
|
|
|
VideoSetAutoCrop(0, ConfigAutoCropDelay, ConfigAutoCropTolerance);
|
|
|
|
Skins.QueueMessage(mtInfo, tr("auto-crop disabled and freezed"));
|
2012-04-14 21:25:44 +02:00
|
|
|
break;
|
|
|
|
case 24: // enable auto-crop
|
|
|
|
ConfigAutoCropEnabled = 1;
|
2012-04-15 22:59:52 +02:00
|
|
|
if (!ConfigAutoCropInterval) {
|
2012-04-14 21:25:44 +02:00
|
|
|
ConfigAutoCropInterval = 50;
|
|
|
|
}
|
|
|
|
VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay,
|
|
|
|
ConfigAutoCropTolerance);
|
2012-04-15 22:59:52 +02:00
|
|
|
Skins.QueueMessage(mtInfo, tr("auto-crop enabled"));
|
2012-04-14 21:25:44 +02:00
|
|
|
break;
|
|
|
|
case 25: // toggle auto-crop
|
2012-04-17 16:45:27 +02:00
|
|
|
ConfigAutoCropEnabled ^= 1;
|
2012-04-14 21:25:44 +02:00
|
|
|
// no interval configured, use some default
|
2012-04-15 22:59:52 +02:00
|
|
|
if (!ConfigAutoCropInterval) {
|
2012-04-14 21:25:44 +02:00
|
|
|
ConfigAutoCropInterval = 50;
|
|
|
|
}
|
|
|
|
VideoSetAutoCrop(ConfigAutoCropEnabled * ConfigAutoCropInterval,
|
|
|
|
ConfigAutoCropDelay, ConfigAutoCropTolerance);
|
2012-04-15 22:59:52 +02:00
|
|
|
if (ConfigAutoCropEnabled) {
|
|
|
|
Skins.QueueMessage(mtInfo, tr("auto-crop enabled"));
|
|
|
|
} else {
|
|
|
|
Skins.QueueMessage(mtInfo,
|
|
|
|
tr("auto-crop disabled and freezed"));
|
|
|
|
}
|
2012-04-14 21:25:44 +02:00
|
|
|
break;
|
2012-04-11 12:15:12 +02:00
|
|
|
case 30: // change 4:3 -> 16:9 mode
|
|
|
|
case 31:
|
|
|
|
case 32:
|
|
|
|
VideoSetDisplayFormat(code - 30);
|
|
|
|
break;
|
|
|
|
case 39: // rortate 4:3 -> 16:9 mode
|
|
|
|
VideoSetDisplayFormat(-1);
|
|
|
|
break;
|
2012-02-19 19:22:03 +01:00
|
|
|
default:
|
2012-02-23 15:32:43 +01:00
|
|
|
esyslog(tr("[softhddev]: hot key %d is not supported\n"), code);
|
2012-02-19 19:22:03 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Handle key event.
|
|
|
|
**
|
|
|
|
** @param key key event
|
|
|
|
*/
|
|
|
|
eOSState cSoftHdMenu::ProcessKey(eKeys key)
|
|
|
|
{
|
|
|
|
eOSState state;
|
|
|
|
|
|
|
|
//dsyslog("[softhddev]%s: %x\n", __FUNCTION__, key);
|
|
|
|
|
|
|
|
switch (HotkeyState) {
|
|
|
|
case 0: // initial state, waiting for hot key
|
|
|
|
if (key == kBlue) {
|
|
|
|
HotkeyState = 1;
|
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (k0 <= key && key <= k9) {
|
|
|
|
HotkeyCode = key - k0;
|
|
|
|
HotkeyState = 2;
|
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
HotkeyState = 0;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (k0 <= key && key <= k9) {
|
|
|
|
HotkeyCode *= 10;
|
|
|
|
HotkeyCode += key - k0;
|
|
|
|
HotkeyState = 0;
|
|
|
|
dsyslog("[softhddev]%s: hot-key %d\n", __FUNCTION__,
|
|
|
|
HotkeyCode);
|
|
|
|
HandleHotkey(HotkeyCode);
|
|
|
|
return osEnd;
|
|
|
|
}
|
|
|
|
if (key == kOk) {
|
|
|
|
HotkeyState = 0;
|
|
|
|
dsyslog("[softhddev]%s: hot-key %d\n", __FUNCTION__,
|
|
|
|
HotkeyCode);
|
|
|
|
HandleHotkey(HotkeyCode);
|
|
|
|
return osEnd;
|
|
|
|
}
|
|
|
|
HotkeyState = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// call standard function
|
|
|
|
state = cOsdMenu::ProcessKey(key);
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case osUser1:
|
2012-03-11 14:12:49 +01:00
|
|
|
// not already suspended
|
|
|
|
if (SuspendMode == NOT_SUSPENDED && !cSoftHdControl::Player) {
|
2012-02-19 19:22:03 +01:00
|
|
|
cControl::Launch(new cSoftHdControl);
|
|
|
|
cControl::Attach();
|
|
|
|
Suspend(ConfigSuspendClose, ConfigSuspendClose,
|
|
|
|
ConfigSuspendX11);
|
2012-03-03 18:47:07 +01:00
|
|
|
SuspendMode = SUSPEND_NORMAL;
|
2012-02-19 19:22:03 +01:00
|
|
|
if (ShutdownHandler.GetUserInactiveTime()) {
|
|
|
|
dsyslog("[softhddev]%s: set user inactive\n",
|
|
|
|
__FUNCTION__);
|
|
|
|
ShutdownHandler.SetUserInactive();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return osEnd;
|
|
|
|
default:
|
2012-07-02 17:05:36 +02:00
|
|
|
Create();
|
2012-02-19 19:22:03 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// cDevice
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class cSoftHdDevice:public cDevice
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cSoftHdDevice(void);
|
2012-02-19 19:22:03 +01:00
|
|
|
virtual ~ cSoftHdDevice(void);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
virtual bool HasDecoder(void) const;
|
|
|
|
virtual bool CanReplay(void) const;
|
|
|
|
virtual bool SetPlayMode(ePlayMode);
|
|
|
|
virtual void TrickSpeed(int);
|
|
|
|
virtual void Clear(void);
|
|
|
|
virtual void Play(void);
|
|
|
|
virtual void Freeze(void);
|
|
|
|
virtual void Mute(void);
|
|
|
|
virtual void StillPicture(const uchar *, int);
|
|
|
|
virtual bool Poll(cPoller &, int = 0);
|
|
|
|
virtual bool Flush(int = 0);
|
|
|
|
virtual int64_t GetSTC(void);
|
2012-02-01 16:50:48 +01:00
|
|
|
virtual void SetVideoDisplayFormat(eVideoDisplayFormat);
|
2012-02-17 15:10:24 +01:00
|
|
|
virtual void SetVideoFormat(bool);
|
2012-01-18 15:15:37 +01:00
|
|
|
virtual void GetVideoSize(int &, int &, double &);
|
2011-12-07 14:37:51 +01:00
|
|
|
virtual void GetOsdSize(int &, int &, double &);
|
|
|
|
virtual int PlayVideo(const uchar *, int);
|
2012-02-21 20:55:28 +01:00
|
|
|
virtual int PlayAudio(const uchar *, int, uchar);
|
2012-02-25 13:02:15 +01:00
|
|
|
#ifdef USE_TS_VIDEO
|
|
|
|
virtual int PlayTsVideo(const uchar *, int);
|
2012-02-21 20:55:28 +01:00
|
|
|
#endif
|
2012-03-03 18:47:07 +01:00
|
|
|
#if !defined(USE_AUDIO_THREAD) || !defined(NO_TS_AUDIO)
|
2012-01-03 21:31:03 +01:00
|
|
|
virtual int PlayTsAudio(const uchar *, int);
|
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
virtual void SetAudioChannelDevice(int);
|
|
|
|
virtual int GetAudioChannelDevice(void);
|
|
|
|
virtual void SetDigitalAudioDevice(bool);
|
|
|
|
virtual void SetAudioTrackDevice(eTrackType);
|
2012-02-12 20:14:43 +01:00
|
|
|
virtual void SetVolumeDevice(int);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
// Image Grab facilities
|
|
|
|
|
|
|
|
virtual uchar *GrabImage(int &, bool, int, int, int);
|
|
|
|
|
2012-01-12 18:55:07 +01:00
|
|
|
#if 0
|
2011-12-07 14:37:51 +01:00
|
|
|
// SPU facilities
|
|
|
|
private:
|
2012-02-19 19:22:03 +01:00
|
|
|
cDvbSpuDecoder * spuDecoder;
|
2011-12-07 14:37:51 +01:00
|
|
|
public:
|
2012-02-19 19:22:03 +01:00
|
|
|
virtual cSpuDecoder * GetSpuDecoder(void);
|
2012-01-12 18:55:07 +01:00
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
protected:
|
2012-02-19 19:22:03 +01:00
|
|
|
virtual void MakePrimaryDevice(bool);
|
2011-12-07 14:37:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
cSoftHdDevice::cSoftHdDevice(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s\n", __FUNCTION__);
|
2011-12-08 20:50:32 +01:00
|
|
|
|
2012-01-12 18:55:07 +01:00
|
|
|
#if 0
|
2011-12-08 20:50:32 +01:00
|
|
|
spuDecoder = NULL;
|
2012-01-12 18:55:07 +01:00
|
|
|
#endif
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cSoftHdDevice::~cSoftHdDevice(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-19 00:16:15 +01:00
|
|
|
/**
|
|
|
|
** Informs a device that it will be the primary device.
|
|
|
|
**
|
|
|
|
** @param on flag if becoming or loosing primary
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cSoftHdDevice::MakePrimaryDevice(bool on)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, on);
|
|
|
|
|
|
|
|
cDevice::MakePrimaryDevice(on);
|
|
|
|
if (on) {
|
|
|
|
new cSoftOsdProvider();
|
2012-03-06 12:16:47 +01:00
|
|
|
|
2012-03-02 00:22:08 +01:00
|
|
|
if (SuspendMode == SUSPEND_DETACHED) {
|
|
|
|
Resume();
|
2012-03-11 14:12:49 +01:00
|
|
|
SuspendMode = NOT_SUSPENDED;
|
2012-03-02 00:22:08 +01:00
|
|
|
}
|
2012-03-11 14:12:49 +01:00
|
|
|
} else if (SuspendMode == NOT_SUSPENDED) {
|
2012-03-02 00:22:08 +01:00
|
|
|
Suspend(1, 1, 0);
|
|
|
|
SuspendMode = SUSPEND_DETACHED;
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-12 18:55:07 +01:00
|
|
|
#if 0
|
|
|
|
|
2012-01-18 15:15:37 +01:00
|
|
|
cSpuDecoder *cSoftHdDevice::GetSpuDecoder(void)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
|
|
|
|
|
|
|
if (IsPrimaryDevice() && !spuDecoder) {
|
|
|
|
spuDecoder = new cDvbSpuDecoder();
|
|
|
|
}
|
|
|
|
return spuDecoder;
|
2011-12-14 18:01:03 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-01-12 18:55:07 +01:00
|
|
|
#endif
|
|
|
|
|
2012-03-10 17:46:00 +01:00
|
|
|
/**
|
|
|
|
** Tells whether this device has a MPEG decoder.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
bool cSoftHdDevice::HasDecoder(void) const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-01-22 11:12:57 +01:00
|
|
|
/**
|
|
|
|
** Returns true if this device can currently start a replay session.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
bool cSoftHdDevice::CanReplay(void) const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-01-22 11:12:57 +01:00
|
|
|
/**
|
2012-03-01 22:12:22 +01:00
|
|
|
** Sets the device into the given play mode.
|
|
|
|
**
|
|
|
|
** @param play_mode new play mode (Audio/Video/External...)
|
2012-01-22 11:12:57 +01:00
|
|
|
*/
|
|
|
|
bool cSoftHdDevice::SetPlayMode(ePlayMode play_mode)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-01-22 11:12:57 +01:00
|
|
|
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, play_mode);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-01-22 11:12:57 +01:00
|
|
|
switch (play_mode) {
|
2011-12-07 14:37:51 +01:00
|
|
|
case pmAudioVideo:
|
|
|
|
break;
|
|
|
|
case pmAudioOnly:
|
|
|
|
case pmAudioOnlyBlack:
|
|
|
|
break;
|
|
|
|
case pmVideoOnly:
|
|
|
|
break;
|
|
|
|
case pmNone:
|
2012-01-11 18:01:18 +01:00
|
|
|
return true;
|
2011-12-07 14:37:51 +01:00
|
|
|
case pmExtern_THIS_SHOULD_BE_AVOIDED:
|
2012-01-22 20:49:43 +01:00
|
|
|
dsyslog("[softhddev] play mode external\n");
|
2012-04-17 16:45:27 +02:00
|
|
|
// FIXME: what if already suspended?
|
2012-01-26 15:00:49 +01:00
|
|
|
Suspend(1, 1, 0);
|
2012-03-03 18:47:07 +01:00
|
|
|
SuspendMode = SUSPEND_EXTERNAL;
|
2012-01-26 15:00:49 +01:00
|
|
|
return true;
|
2011-12-07 14:37:51 +01:00
|
|
|
default:
|
2012-02-22 15:06:05 +01:00
|
|
|
dsyslog("[softhddev] playmode not implemented... %d\n", play_mode);
|
2011-12-07 14:37:51 +01:00
|
|
|
break;
|
|
|
|
}
|
2012-02-23 15:32:43 +01:00
|
|
|
|
2012-03-11 14:12:49 +01:00
|
|
|
if (SuspendMode != NOT_SUSPENDED) {
|
2012-03-01 22:12:22 +01:00
|
|
|
if (SuspendMode != SUSPEND_EXTERNAL) {
|
2012-03-11 14:12:49 +01:00
|
|
|
return false;
|
2012-03-01 22:12:22 +01:00
|
|
|
}
|
|
|
|
Resume();
|
2012-03-11 14:12:49 +01:00
|
|
|
SuspendMode = NOT_SUSPENDED;
|
2012-03-01 22:12:22 +01:00
|
|
|
}
|
|
|
|
|
2012-02-23 23:33:00 +01:00
|
|
|
return::SetPlayMode(play_mode);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-30 15:58:21 +01:00
|
|
|
/**
|
|
|
|
** Gets the current System Time Counter, which can be used to
|
|
|
|
** synchronize audio, video and subtitles.
|
|
|
|
*/
|
2011-12-14 18:01:03 +01:00
|
|
|
int64_t cSoftHdDevice::GetSTC(void)
|
|
|
|
{
|
2012-01-22 17:07:08 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-14 18:01:03 +01:00
|
|
|
|
2012-03-31 21:27:54 +02:00
|
|
|
return::GetSTC();
|
2011-12-14 18:01:03 +01:00
|
|
|
}
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
/**
|
|
|
|
** Set trick play speed.
|
|
|
|
**
|
2012-02-16 15:31:53 +01:00
|
|
|
** Every single frame shall then be displayed the given number of
|
|
|
|
** times.
|
|
|
|
**
|
2012-01-08 21:46:00 +01:00
|
|
|
** @param speed trick speed
|
|
|
|
*/
|
|
|
|
void cSoftHdDevice::TrickSpeed(int speed)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-01-08 21:46:00 +01:00
|
|
|
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, speed);
|
2012-02-16 15:31:53 +01:00
|
|
|
|
|
|
|
::TrickSpeed(speed);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-16 15:31:53 +01:00
|
|
|
/**
|
|
|
|
** Clears all video and audio data from the device.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cSoftHdDevice::Clear(void)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-14 18:01:03 +01:00
|
|
|
|
|
|
|
cDevice::Clear();
|
|
|
|
::Clear();
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-16 15:31:53 +01:00
|
|
|
/**
|
|
|
|
** Sets the device into play mode (after a previous trick mode)
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cSoftHdDevice::Play(void)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-14 18:01:03 +01:00
|
|
|
|
|
|
|
cDevice::Play();
|
|
|
|
::Play();
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-10 15:52:07 +01:00
|
|
|
/**
|
|
|
|
** Puts the device into "freeze frame" mode.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cSoftHdDevice::Freeze(void)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-14 18:01:03 +01:00
|
|
|
|
|
|
|
cDevice::Freeze();
|
|
|
|
::Freeze();
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-12 20:14:43 +01:00
|
|
|
/**
|
|
|
|
** Turns off audio while replaying.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cSoftHdDevice::Mute(void)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
|
|
|
|
|
|
|
cDevice::Mute();
|
|
|
|
::Mute();
|
|
|
|
}
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
/**
|
|
|
|
** Display the given I-frame as a still picture.
|
2012-03-10 17:46:00 +01:00
|
|
|
**
|
|
|
|
** @param data pes or ts data of a frame
|
|
|
|
** @param length length of data area
|
2012-01-08 21:46:00 +01:00
|
|
|
*/
|
|
|
|
void cSoftHdDevice::StillPicture(const uchar * data, int length)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-01-24 16:37:11 +01:00
|
|
|
dsyslog("[softhddev]%s: %s %p %d\n", __FUNCTION__,
|
|
|
|
data[0] == 0x47 ? "ts" : "pes", data, length);
|
2012-01-08 21:46:00 +01:00
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
if (data[0] == 0x47) { // ts sync
|
2012-01-08 21:46:00 +01:00
|
|
|
cDevice::StillPicture(data, length);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
::StillPicture(data, length);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
/**
|
|
|
|
** Check if the device is ready for further action.
|
|
|
|
**
|
|
|
|
** @param poller file handles (unused)
|
|
|
|
** @param timeout_ms timeout in ms to become ready
|
2012-03-22 16:06:32 +01:00
|
|
|
**
|
|
|
|
** @retval true if ready
|
|
|
|
** @retval false if busy
|
2012-01-08 21:46:00 +01:00
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
bool cSoftHdDevice::Poll(
|
2011-12-12 17:06:05 +01:00
|
|
|
__attribute__ ((unused)) cPoller & poller, int timeout_ms)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-01-22 17:07:08 +01:00
|
|
|
//dsyslog("[softhddev]%s: %d\n", __FUNCTION__, timeout_ms);
|
2011-12-12 17:06:05 +01:00
|
|
|
|
2012-01-05 17:20:44 +01:00
|
|
|
return::Poll(timeout_ms);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
/**
|
|
|
|
** Flush the device output buffers.
|
|
|
|
**
|
|
|
|
** @param timeout_ms timeout in ms to become ready
|
|
|
|
*/
|
2011-12-14 18:01:03 +01:00
|
|
|
bool cSoftHdDevice::Flush(int timeout_ms)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2011-12-14 18:01:03 +01:00
|
|
|
dsyslog("[softhddev]%s: %d ms\n", __FUNCTION__, timeout_ms);
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
return::Flush(timeout_ms);
|
2011-12-14 18:01:03 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-02-01 16:50:48 +01:00
|
|
|
/**
|
|
|
|
** Sets the video display format to the given one (only useful if this
|
|
|
|
** device has an MPEG decoder).
|
|
|
|
*/
|
2012-07-02 17:05:36 +02:00
|
|
|
void cSoftHdDevice::
|
|
|
|
SetVideoDisplayFormat(eVideoDisplayFormat video_display_format)
|
2012-02-01 16:50:48 +01:00
|
|
|
{
|
|
|
|
static int last = -1;
|
|
|
|
|
|
|
|
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, video_display_format);
|
|
|
|
|
2012-02-12 20:30:50 +01:00
|
|
|
cDevice::SetVideoDisplayFormat(video_display_format);
|
|
|
|
|
2012-02-01 16:50:48 +01:00
|
|
|
// called on every channel switch, no need to kill osd...
|
|
|
|
if (last != video_display_format) {
|
|
|
|
last = video_display_format;
|
2012-02-06 20:54:20 +01:00
|
|
|
|
2012-02-01 16:50:48 +01:00
|
|
|
::VideoSetDisplayFormat(video_display_format);
|
2012-03-10 17:46:00 +01:00
|
|
|
cSoftOsd::Dirty = 1;
|
2012-02-01 16:50:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-17 15:10:24 +01:00
|
|
|
/**
|
|
|
|
** Sets the output video format to either 16:9 or 4:3 (only useful
|
|
|
|
** if this device has an MPEG decoder).
|
|
|
|
**
|
|
|
|
** Should call SetVideoDisplayFormat.
|
|
|
|
**
|
|
|
|
** @param video_format16_9 flag true 16:9.
|
|
|
|
*/
|
|
|
|
void cSoftHdDevice::SetVideoFormat(bool video_format16_9)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, video_format16_9);
|
|
|
|
|
|
|
|
// FIXME: 4:3 / 16:9 video format not supported.
|
|
|
|
|
|
|
|
SetVideoDisplayFormat(eVideoDisplayFormat(Setup.VideoDisplayFormat));
|
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
/**
|
2012-01-18 15:15:37 +01:00
|
|
|
** Returns the width, height and video_aspect ratio of the currently
|
|
|
|
** displayed video material.
|
|
|
|
**
|
2012-10-10 17:26:49 +02:00
|
|
|
** @note the video_aspect is used to scale the subtitle.
|
2012-01-18 15:15:37 +01:00
|
|
|
*/
|
|
|
|
void cSoftHdDevice::GetVideoSize(int &width, int &height, double &video_aspect)
|
|
|
|
{
|
2012-10-10 17:26:49 +02:00
|
|
|
::GetVideoSize(&width, &height, &video_aspect);
|
2012-01-18 15:15:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Returns the width, height and pixel_aspect ratio the OSD.
|
2011-12-07 14:37:51 +01:00
|
|
|
**
|
|
|
|
** FIXME: Called every second, for nothing (no OSD displayed)?
|
|
|
|
*/
|
|
|
|
void cSoftHdDevice::GetOsdSize(int &width, int &height, double &pixel_aspect)
|
|
|
|
{
|
|
|
|
::GetOsdSize(&width, &height, &pixel_aspect);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
/**
|
|
|
|
** Play a audio packet.
|
2012-02-21 20:55:28 +01:00
|
|
|
**
|
|
|
|
** @param data exactly one complete PES packet (which is incomplete)
|
|
|
|
** @param length length of PES packet
|
|
|
|
** @param id type of audio data this packet holds
|
2012-01-08 21:46:00 +01:00
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
int cSoftHdDevice::PlayAudio(const uchar * data, int length, uchar id)
|
|
|
|
{
|
|
|
|
//dsyslog("[softhddev]%s: %p %p %d %d\n", __FUNCTION__, this, data, length, id);
|
|
|
|
|
2012-01-08 21:46:00 +01:00
|
|
|
return::PlayAudio(data, length, id);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void cSoftHdDevice::SetAudioTrackDevice(
|
|
|
|
__attribute__ ((unused)) eTrackType type)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-06 15:39:32 +01:00
|
|
|
void cSoftHdDevice::SetDigitalAudioDevice( __attribute__ ((unused)) bool on)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s: %s\n", __FUNCTION__, on ? "true" : "false");
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-06 15:39:32 +01:00
|
|
|
void cSoftHdDevice::SetAudioChannelDevice( __attribute__ ((unused))
|
|
|
|
int audio_channel)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s: %d\n", __FUNCTION__, audio_channel);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int cSoftHdDevice::GetAudioChannelDevice(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-12 20:14:43 +01:00
|
|
|
/**
|
|
|
|
** Sets the audio volume on this device (Volume = 0...255).
|
|
|
|
**
|
|
|
|
** @param volume device volume
|
|
|
|
*/
|
|
|
|
void cSoftHdDevice::SetVolumeDevice(int volume)
|
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s: %d\n", __FUNCTION__, volume);
|
|
|
|
|
|
|
|
::SetVolumeDevice(volume);
|
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-02-06 20:54:20 +01:00
|
|
|
/**
|
|
|
|
** Play a video packet.
|
2012-02-21 20:55:28 +01:00
|
|
|
**
|
|
|
|
** @param data exactly one complete PES packet (which is incomplete)
|
|
|
|
** @param length length of PES packet
|
2012-02-06 20:54:20 +01:00
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
int cSoftHdDevice::PlayVideo(const uchar * data, int length)
|
|
|
|
{
|
|
|
|
//dsyslog("[softhddev]%s: %p %d\n", __FUNCTION__, data, length);
|
|
|
|
|
2012-01-05 17:20:44 +01:00
|
|
|
return::PlayVideo(data, length);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-25 13:02:15 +01:00
|
|
|
#ifdef USE_TS_VIDEO
|
|
|
|
|
2013-01-01 12:40:12 +01:00
|
|
|
/**
|
|
|
|
** Play a TS video packet.
|
|
|
|
**
|
|
|
|
** @param data ts data buffer
|
|
|
|
** @param length ts packet length (188)
|
|
|
|
*/
|
2012-01-19 00:16:15 +01:00
|
|
|
int cSoftHdDevice::PlayTsVideo(const uchar * data, int length)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
|
|
|
}
|
2012-02-25 13:02:15 +01:00
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
#endif
|
|
|
|
|
2012-03-03 18:47:07 +01:00
|
|
|
#if !defined(USE_AUDIO_THREAD) || !defined(NO_TS_AUDIO)
|
2012-01-19 00:16:15 +01:00
|
|
|
|
2013-01-01 12:40:12 +01:00
|
|
|
/**
|
|
|
|
** Play a TS audio packet.
|
|
|
|
**
|
|
|
|
** @param data ts data buffer
|
|
|
|
** @param length ts packet length (188)
|
|
|
|
*/
|
2012-01-03 21:31:03 +01:00
|
|
|
int cSoftHdDevice::PlayTsAudio(const uchar * data, int length)
|
|
|
|
{
|
2012-03-03 18:47:07 +01:00
|
|
|
#ifndef NO_TS_AUDIO
|
2012-02-19 19:22:03 +01:00
|
|
|
return::PlayTsAudio(data, length);
|
|
|
|
#else
|
2012-01-03 21:31:03 +01:00
|
|
|
AudioPoller();
|
|
|
|
|
2012-01-05 17:20:44 +01:00
|
|
|
return cDevice::PlayTsAudio(data, length);
|
2012-02-19 19:22:03 +01:00
|
|
|
#endif
|
2012-01-03 21:31:03 +01:00
|
|
|
}
|
2012-01-19 00:16:15 +01:00
|
|
|
|
2012-01-03 21:31:03 +01:00
|
|
|
#endif
|
|
|
|
|
2012-01-20 21:46:22 +01:00
|
|
|
/**
|
|
|
|
** Grabs the currently visible screen image.
|
|
|
|
**
|
|
|
|
** @param size size of the returned data
|
|
|
|
** @param jpeg flag true, create JPEG data
|
|
|
|
** @param quality JPEG quality
|
|
|
|
** @param width number of horizontal pixels in the frame
|
|
|
|
** @param height number of vertical pixels in the frame
|
|
|
|
*/
|
|
|
|
uchar *cSoftHdDevice::GrabImage(int &size, bool jpeg, int quality, int width,
|
|
|
|
int height)
|
2011-12-07 14:37:51 +01:00
|
|
|
{
|
|
|
|
dsyslog("[softhddev]%s: %d, %d, %d, %dx%d\n", __FUNCTION__, size, jpeg,
|
2012-01-20 21:46:22 +01:00
|
|
|
quality, width, height);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-05-13 16:58:45 +02:00
|
|
|
if (SuspendMode != NOT_SUSPENDED) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-21 15:56:45 +01:00
|
|
|
return::GrabImage(&size, jpeg, quality, width, height);
|
2011-12-14 18:01:03 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-02-12 20:30:50 +01:00
|
|
|
/**
|
|
|
|
** Call rgb to jpeg for C Plugin.
|
|
|
|
*/
|
|
|
|
extern "C" uint8_t * CreateJpeg(uint8_t * image, int *size, int quality,
|
|
|
|
int width, int height)
|
|
|
|
{
|
|
|
|
return (uint8_t *) RgbToJpeg((uchar *) image, width, height, *size,
|
|
|
|
quality);
|
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// cPlugin
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class cPluginSoftHdDevice:public cPlugin
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cPluginSoftHdDevice(void);
|
|
|
|
virtual ~ cPluginSoftHdDevice(void);
|
|
|
|
virtual const char *Version(void);
|
|
|
|
virtual const char *Description(void);
|
|
|
|
virtual const char *CommandLineHelp(void);
|
|
|
|
virtual bool ProcessArgs(int, char *[]);
|
|
|
|
virtual bool Initialize(void);
|
|
|
|
virtual bool Start(void);
|
|
|
|
virtual void Stop(void);
|
2012-04-05 15:43:32 +02:00
|
|
|
virtual void Housekeeping(void);
|
2011-12-07 14:37:51 +01:00
|
|
|
virtual void MainThreadHook(void);
|
2012-01-10 15:52:07 +01:00
|
|
|
virtual const char *MainMenuEntry(void);
|
|
|
|
virtual cOsdObject *MainMenuAction(void);
|
2011-12-07 14:37:51 +01:00
|
|
|
virtual cMenuSetupPage *SetupMenu(void);
|
|
|
|
virtual bool SetupParse(const char *, const char *);
|
2012-04-30 14:47:08 +02:00
|
|
|
virtual bool Service(const char *, void * = NULL);
|
2012-01-12 15:20:01 +01:00
|
|
|
virtual const char **SVDRPHelpPages(void);
|
|
|
|
virtual cString SVDRPCommand(const char *, const char *, int &);
|
2011-12-07 14:37:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
cPluginSoftHdDevice::cPluginSoftHdDevice(void)
|
|
|
|
{
|
|
|
|
// Initialize any member variables here.
|
|
|
|
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
|
|
|
|
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2013-01-01 12:40:12 +01:00
|
|
|
/**
|
|
|
|
** Clean up after yourself!
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
cPluginSoftHdDevice::~cPluginSoftHdDevice(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-08 20:50:32 +01:00
|
|
|
|
|
|
|
::SoftHdDeviceExit();
|
2012-10-29 16:00:45 +01:00
|
|
|
|
|
|
|
// keep ConfigX11Display ...
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-23 23:33:00 +01:00
|
|
|
/**
|
|
|
|
** Return plugin version number.
|
|
|
|
**
|
|
|
|
** @returns version number as constant string.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
const char *cPluginSoftHdDevice::Version(void)
|
|
|
|
{
|
|
|
|
return VERSION;
|
|
|
|
}
|
|
|
|
|
2013-01-01 12:40:12 +01:00
|
|
|
/**
|
|
|
|
** Return plugin short description.
|
|
|
|
**
|
|
|
|
** @returns short description as constant string.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
const char *cPluginSoftHdDevice::Description(void)
|
|
|
|
{
|
|
|
|
return tr(DESCRIPTION);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Return a string that describes all known command line options.
|
2013-01-01 12:40:12 +01:00
|
|
|
**
|
|
|
|
** @returns command line help as constant string.
|
2011-12-07 14:37:51 +01:00
|
|
|
*/
|
|
|
|
const char *cPluginSoftHdDevice::CommandLineHelp(void)
|
|
|
|
{
|
|
|
|
return::CommandLineHelp();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Process the command line arguments.
|
|
|
|
*/
|
|
|
|
bool cPluginSoftHdDevice::ProcessArgs(int argc, char *argv[])
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
return::ProcessArgs(argc, argv);
|
|
|
|
}
|
|
|
|
|
2013-01-01 12:40:12 +01:00
|
|
|
/**
|
|
|
|
** Initializes the DVB devices.
|
|
|
|
**
|
|
|
|
** Must be called before accessing any DVB functions.
|
|
|
|
**
|
|
|
|
** @returns true if any devices are available.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
bool cPluginSoftHdDevice::Initialize(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
MyDevice = new cSoftHdDevice();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-01-11 18:01:18 +01:00
|
|
|
/**
|
|
|
|
** Start any background activities the plugin shall perform.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
bool cPluginSoftHdDevice::Start(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-01-11 18:01:18 +01:00
|
|
|
if (!MyDevice->IsPrimaryDevice()) {
|
2012-04-11 12:15:12 +02:00
|
|
|
isyslog("[softhddev] softhddevice %d is not the primary device!",
|
|
|
|
MyDevice->DeviceNumber());
|
2011-12-07 14:37:51 +01:00
|
|
|
if (ConfigMakePrimary) {
|
|
|
|
// Must be done in the main thread
|
|
|
|
dsyslog("[softhddev] makeing softhddevice %d the primary device!",
|
|
|
|
MyDevice->DeviceNumber());
|
2012-03-08 15:28:10 +01:00
|
|
|
DoMakePrimary = MyDevice->DeviceNumber() + 1;
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-14 21:16:01 +02:00
|
|
|
switch (::Start()) {
|
|
|
|
case 1:
|
2012-10-06 19:16:10 +02:00
|
|
|
//cControl::Launch(new cSoftHdControl);
|
|
|
|
//cControl::Attach();
|
|
|
|
// FIXME: VDR overwrites the control
|
2012-04-14 21:16:01 +02:00
|
|
|
SuspendMode = SUSPEND_NORMAL;
|
|
|
|
break;
|
|
|
|
case -1:
|
|
|
|
SuspendMode = SUSPEND_DETACHED;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
default:
|
|
|
|
break;
|
2012-03-02 00:05:03 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-04-05 15:43:32 +02:00
|
|
|
/**
|
|
|
|
** Shutdown plugin. Stop any background activities the plugin is
|
|
|
|
** performing.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cPluginSoftHdDevice::Stop(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
::Stop();
|
|
|
|
}
|
|
|
|
|
2012-01-22 11:12:57 +01:00
|
|
|
/**
|
|
|
|
** Perform any cleanup or other regular tasks.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
void cPluginSoftHdDevice::Housekeeping(void)
|
|
|
|
{
|
2012-04-28 12:38:41 +02:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2012-01-22 11:12:57 +01:00
|
|
|
|
2012-04-05 15:43:32 +02:00
|
|
|
// check if user is inactive, automatic enter suspend mode
|
|
|
|
// FIXME: cControl prevents shutdown, disable this until fixed
|
|
|
|
if (0 && SuspendMode == NOT_SUSPENDED && ShutdownHandler.IsUserInactive()) {
|
|
|
|
// don't overwrite already suspended suspend mode
|
|
|
|
cControl::Launch(new cSoftHdControl);
|
|
|
|
cControl::Attach();
|
|
|
|
Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11);
|
|
|
|
SuspendMode = SUSPEND_NORMAL;
|
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-04-05 15:43:32 +02:00
|
|
|
::Housekeeping();
|
|
|
|
}
|
2012-01-10 15:52:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Create main menu entry.
|
|
|
|
*/
|
2011-12-07 14:37:51 +01:00
|
|
|
const char *cPluginSoftHdDevice::MainMenuEntry(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2012-01-10 15:52:07 +01:00
|
|
|
|
|
|
|
return ConfigHideMainMenuEntry ? NULL : tr(MAINMENUENTRY);
|
2011-12-07 14:37:51 +01:00
|
|
|
}
|
|
|
|
|
2012-01-10 15:52:07 +01:00
|
|
|
/**
|
|
|
|
** Perform the action when selected from the main VDR menu.
|
|
|
|
*/
|
|
|
|
cOsdObject *cPluginSoftHdDevice::MainMenuAction(void)
|
|
|
|
{
|
2012-01-22 17:07:08 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2012-01-10 15:52:07 +01:00
|
|
|
|
2012-02-19 19:22:03 +01:00
|
|
|
return new cSoftHdMenu("SoftHdDevice");
|
2012-01-10 15:52:07 +01:00
|
|
|
}
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Called for every plugin once during every cycle of VDR's main program
|
|
|
|
** loop.
|
|
|
|
*/
|
|
|
|
void cPluginSoftHdDevice::MainThreadHook(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-03-08 15:28:10 +01:00
|
|
|
if (DoMakePrimary) {
|
|
|
|
dsyslog("[softhddev]%s: switching primary device to %d\n",
|
|
|
|
__FUNCTION__, DoMakePrimary);
|
|
|
|
cDevice::SetPrimaryDevice(DoMakePrimary);
|
2011-12-07 14:37:51 +01:00
|
|
|
DoMakePrimary = 0;
|
|
|
|
}
|
2012-01-11 18:01:18 +01:00
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
::MainThreadHook();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Return our setup menu.
|
|
|
|
*/
|
|
|
|
cMenuSetupPage *cPluginSoftHdDevice::SetupMenu(void)
|
|
|
|
{
|
2012-01-06 15:39:32 +01:00
|
|
|
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
|
|
|
return new cMenuSetupSoft;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Parse setup parameters
|
2012-01-20 15:33:37 +01:00
|
|
|
**
|
|
|
|
** @param name paramter name (case sensetive)
|
|
|
|
** @param value value as string
|
|
|
|
**
|
|
|
|
** @returns true if the parameter is supported.
|
2011-12-07 14:37:51 +01:00
|
|
|
*/
|
|
|
|
bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
|
|
|
|
{
|
2012-01-09 17:03:04 +01:00
|
|
|
int i;
|
|
|
|
|
2012-01-10 15:52:07 +01:00
|
|
|
//dsyslog("[softhddev]%s: '%s' = '%s'\n", __FUNCTION__, name, value);
|
2011-12-07 14:37:51 +01:00
|
|
|
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "MakePrimary")) {
|
2011-12-07 14:37:51 +01:00
|
|
|
ConfigMakePrimary = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "HideMainMenuEntry")) {
|
2012-01-10 15:52:07 +01:00
|
|
|
ConfigHideMainMenuEntry = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-05-21 15:34:33 +02:00
|
|
|
if (!strcasecmp(name, "Osd.Width")) {
|
|
|
|
ConfigOsdWidth = atoi(value);
|
|
|
|
VideoSetOsdSize(ConfigOsdWidth, ConfigOsdHeight);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "Osd.Height")) {
|
|
|
|
ConfigOsdHeight = atoi(value);
|
|
|
|
VideoSetOsdSize(ConfigOsdWidth, ConfigOsdHeight);
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-15 22:59:52 +02:00
|
|
|
if (!strcasecmp(name, "Suspend.Close")) {
|
|
|
|
ConfigSuspendClose = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "Suspend.X11")) {
|
|
|
|
ConfigSuspendX11 = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-02-24 15:15:50 +01:00
|
|
|
if (!strcasecmp(name, "Background")) {
|
|
|
|
VideoSetBackground(ConfigVideoBackground = strtoul(value, NULL, 0));
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "StudioLevels")) {
|
2012-02-13 14:13:24 +01:00
|
|
|
VideoSetStudioLevels(ConfigVideoStudioLevels = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "60HzMode")) {
|
|
|
|
VideoSet60HzMode(ConfigVideo60HzMode = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-03-06 12:16:47 +01:00
|
|
|
if (!strcasecmp(name, "SoftStartSync")) {
|
|
|
|
VideoSetSoftStartSync(ConfigVideoSoftStartSync = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-20 15:40:14 +02:00
|
|
|
if (!strcasecmp(name, "BlackPicture")) {
|
|
|
|
VideoSetBlackPicture(ConfigVideoBlackPicture = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-03 16:39:33 +02:00
|
|
|
if (!strcasecmp(name, "Brightness")) {
|
|
|
|
VideoSetBrightness(ConfigVideoBrightness = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "Contrast")) {
|
|
|
|
VideoSetContrast(ConfigVideoContrast = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "Saturation")) {
|
|
|
|
VideoSetSaturation(ConfigVideoSaturation = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "Hue")) {
|
|
|
|
VideoSetHue(ConfigVideoHue = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-01-09 17:03:04 +01:00
|
|
|
for (i = 0; i < RESOLUTIONS; ++i) {
|
2012-01-20 15:33:37 +01:00
|
|
|
char buf[128];
|
|
|
|
|
2012-01-09 17:03:04 +01:00
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Scaling");
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, buf)) {
|
2012-01-09 17:03:04 +01:00
|
|
|
ConfigVideoScaling[i] = atoi(value);
|
|
|
|
VideoSetScaling(ConfigVideoScaling);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Deinterlace");
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, buf)) {
|
2012-01-09 17:03:04 +01:00
|
|
|
ConfigVideoDeinterlace[i] = atoi(value);
|
|
|
|
VideoSetDeinterlace(ConfigVideoDeinterlace);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i],
|
|
|
|
"SkipChromaDeinterlace");
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, buf)) {
|
2012-01-09 17:03:04 +01:00
|
|
|
ConfigVideoSkipChromaDeinterlace[i] = atoi(value);
|
|
|
|
VideoSetSkipChromaDeinterlace(ConfigVideoSkipChromaDeinterlace);
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-14 22:29:17 +01:00
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "InverseTelecine");
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, buf)) {
|
2012-02-14 22:29:17 +01:00
|
|
|
ConfigVideoInverseTelecine[i] = atoi(value);
|
|
|
|
VideoSetInverseTelecine(ConfigVideoInverseTelecine);
|
|
|
|
return true;
|
|
|
|
}
|
2012-01-09 17:03:04 +01:00
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Denoise");
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, buf)) {
|
2012-01-09 17:03:04 +01:00
|
|
|
ConfigVideoDenoise[i] = atoi(value);
|
|
|
|
VideoSetDenoise(ConfigVideoDenoise);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Sharpen");
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, buf)) {
|
2012-01-09 17:03:04 +01:00
|
|
|
ConfigVideoSharpen[i] = atoi(value);
|
|
|
|
VideoSetSharpen(ConfigVideoSharpen);
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-05 22:51:20 +02:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutTopBottom");
|
|
|
|
if (!strcasecmp(name, buf)) {
|
|
|
|
ConfigVideoCutTopBottom[i] = atoi(value);
|
|
|
|
VideoSetCutTopBottom(ConfigVideoCutTopBottom);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutLeftRight");
|
|
|
|
if (!strcasecmp(name, buf)) {
|
|
|
|
ConfigVideoCutLeftRight[i] = atoi(value);
|
|
|
|
VideoSetCutLeftRight(ConfigVideoCutLeftRight);
|
|
|
|
return true;
|
|
|
|
}
|
2011-12-12 17:06:05 +01:00
|
|
|
}
|
2012-01-20 15:33:37 +01:00
|
|
|
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "AutoCrop.Interval")) {
|
2012-01-20 15:33:37 +01:00
|
|
|
VideoSetAutoCrop(ConfigAutoCropInterval =
|
2012-01-27 23:49:05 +01:00
|
|
|
atoi(value), ConfigAutoCropDelay, ConfigAutoCropTolerance);
|
2012-04-17 16:45:27 +02:00
|
|
|
ConfigAutoCropEnabled = ConfigAutoCropInterval != 0;
|
2012-01-20 15:33:37 +01:00
|
|
|
return true;
|
|
|
|
}
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "AutoCrop.Delay")) {
|
2012-01-20 15:33:37 +01:00
|
|
|
VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay =
|
2012-01-27 23:49:05 +01:00
|
|
|
atoi(value), ConfigAutoCropTolerance);
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-22 15:06:05 +01:00
|
|
|
if (!strcasecmp(name, "AutoCrop.Tolerance")) {
|
2012-02-02 16:00:26 +01:00
|
|
|
VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay,
|
|
|
|
ConfigAutoCropTolerance = atoi(value));
|
2012-01-20 15:33:37 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-04-15 22:59:52 +02:00
|
|
|
if (!strcasecmp(name, "AudioDelay")) {
|
|
|
|
VideoSetAudioDelay(ConfigVideoAudioDelay = atoi(value));
|
2012-01-22 20:49:43 +01:00
|
|
|
return true;
|
|
|
|
}
|
2012-04-20 18:28:25 +02:00
|
|
|
if (!strcasecmp(name, "AudioDrift")) {
|
|
|
|
CodecSetAudioDrift(ConfigAudioDrift = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-15 22:59:52 +02:00
|
|
|
if (!strcasecmp(name, "AudioPassthrough")) {
|
|
|
|
CodecSetAudioPassthrough(ConfigAudioPassthrough = atoi(value));
|
2012-01-22 20:49:43 +01:00
|
|
|
return true;
|
|
|
|
}
|
2012-04-15 22:59:52 +02:00
|
|
|
if (!strcasecmp(name, "AudioDownmix")) {
|
|
|
|
CodecSetAudioDownmix(ConfigAudioDownmix = atoi(value));
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-17 16:45:27 +02:00
|
|
|
if (!strcasecmp(name, "AudioSoftvol")) {
|
2012-04-20 16:51:04 +02:00
|
|
|
AudioSetSoftvol(ConfigAudioSoftvol = atoi(value));
|
2012-04-17 16:45:27 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "AudioNormalize")) {
|
|
|
|
ConfigAudioNormalize = atoi(value);
|
|
|
|
AudioSetNormalize(ConfigAudioNormalize, ConfigAudioMaxNormalize);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "AudioMaxNormalize")) {
|
|
|
|
ConfigAudioMaxNormalize = atoi(value);
|
|
|
|
AudioSetNormalize(ConfigAudioNormalize, ConfigAudioMaxNormalize);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "AudioCompression")) {
|
|
|
|
ConfigAudioCompression = atoi(value);
|
|
|
|
AudioSetCompression(ConfigAudioCompression, ConfigAudioMaxCompression);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "AudioMaxCompression")) {
|
|
|
|
ConfigAudioMaxCompression = atoi(value);
|
|
|
|
AudioSetCompression(ConfigAudioCompression, ConfigAudioMaxCompression);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "AudioStereoDescent")) {
|
|
|
|
ConfigAudioStereoDescent = atoi(value);
|
|
|
|
AudioSetStereoDescent(ConfigAudioStereoDescent);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(name, "AudioBufferTime")) {
|
|
|
|
ConfigAudioBufferTime = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-15 22:59:52 +02:00
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-04-30 14:47:08 +02:00
|
|
|
/**
|
|
|
|
** Receive requests or messages.
|
|
|
|
**
|
|
|
|
** @param id unique identification string that identifies the
|
|
|
|
** service protocol
|
|
|
|
** @param data custom data structure
|
|
|
|
*/
|
|
|
|
bool cPluginSoftHdDevice::Service(const char *id, void *data)
|
2012-01-10 15:52:07 +01:00
|
|
|
{
|
2012-05-03 15:26:58 +02:00
|
|
|
//dsyslog("[softhddev]%s: id %s\n", __FUNCTION__, id);
|
2012-04-30 14:47:08 +02:00
|
|
|
|
2012-10-30 16:50:31 +01:00
|
|
|
if (strcmp(id, OSD_3DMODE_SERVICE) == 0) {
|
|
|
|
SoftHDDevice_Osd3DModeService_v1_0_t *r;
|
|
|
|
|
|
|
|
r = (SoftHDDevice_Osd3DModeService_v1_0_t *) data;
|
|
|
|
VideoSetOsd3DMode(r->Mode);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-04-30 14:47:08 +02:00
|
|
|
if (strcmp(id, ATMO_GRAB_SERVICE) == 0) {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
if (data == NULL) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-13 16:58:45 +02:00
|
|
|
if (SuspendMode != NOT_SUSPENDED) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-04-30 14:47:08 +02:00
|
|
|
SoftHDDevice_AtmoGrabService_v1_0_t *r =
|
|
|
|
(SoftHDDevice_AtmoGrabService_v1_0_t *) data;
|
|
|
|
if (r->structSize != sizeof(SoftHDDevice_AtmoGrabService_v1_0_t)
|
|
|
|
|| r->analyseSize < 64 || r->analyseSize > 256
|
|
|
|
|| r->clippedOverscan < 0 || r->clippedOverscan > 200) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
width = r->analyseSize * -1; // Internal marker for Atmo grab service
|
|
|
|
height = r->clippedOverscan;
|
2012-01-10 15:52:07 +01:00
|
|
|
|
2012-04-30 14:47:08 +02:00
|
|
|
r->img = VideoGrabService(&r->imgSize, &width, &height);
|
|
|
|
if (r->img == NULL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
r->imgType = GRAB_IMG_RGBA_FORMAT_B8G8R8A8;
|
|
|
|
r->width = width;
|
|
|
|
r->height = height;
|
|
|
|
return true;
|
|
|
|
}
|
2012-01-10 15:52:07 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-01-12 15:20:01 +01:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// cPlugin SVDRP
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2012-03-14 15:07:08 +01:00
|
|
|
/**
|
|
|
|
** SVDRP commands help text.
|
|
|
|
** FIXME: translation?
|
|
|
|
*/
|
|
|
|
static const char *SVDRPHelpText[] = {
|
2012-05-21 15:34:33 +02:00
|
|
|
"SUSP\n" "\040 Suspend plugin.\n\n"
|
2012-03-14 15:07:08 +01:00
|
|
|
" The plugin is suspended to save energie. Depending on the setup\n"
|
|
|
|
" 'softhddevice.Suspend.Close = 0' only the video and audio output\n"
|
|
|
|
" is stopped or with 'softhddevice.Suspend.Close = 1' the video\n"
|
|
|
|
" and audio devices are closed.\n"
|
|
|
|
" If 'softhddevice.Suspend.X11 = 1' is set and the X11 server was\n"
|
|
|
|
" started by the plugin, the X11 server would also be closed.\n"
|
|
|
|
" (Stopping X11 while suspended isn't supported yet)\n",
|
2012-05-21 15:34:33 +02:00
|
|
|
"RESU\n" "\040 Resume plugin.\n\n"
|
2012-03-14 15:07:08 +01:00
|
|
|
" Resume the suspended plugin. The plugin could be suspended by\n"
|
|
|
|
" the command line option '-s' or by a previous SUSP command.\n"
|
|
|
|
" If the x11 server was stopped by the plugin, it will be\n"
|
|
|
|
" restarted.",
|
2012-05-21 15:34:33 +02:00
|
|
|
"DETA\n" "\040 Detach plugin.\n\n"
|
2012-03-14 15:07:08 +01:00
|
|
|
" The plugin will be detached from the audio, video and DVB\n"
|
|
|
|
" devices. Other programs or plugins can use them now.\n",
|
2012-10-29 16:00:45 +01:00
|
|
|
"ATTA <-d display> <-a audio> <-p pass>\n" " Attach plugin.\n\n"
|
|
|
|
" Attach the plugin to audio, video and DVB devices. Use:\n"
|
|
|
|
" -d display\tdisplay of x11 server (fe. :0.0)\n"
|
2012-10-30 16:50:31 +01:00
|
|
|
" -a audio\taudio device (fe. alsa: hw:0,0 oss: /dev/dsp)\n"
|
2012-10-29 16:00:45 +01:00
|
|
|
" -p pass\t\taudio device for pass-through (hw:0,1 or /dev/dsp1)\n",
|
2012-03-14 15:07:08 +01:00
|
|
|
"PRIM <n>\n" " Make <n> the primary device.\n\n"
|
|
|
|
" <n> is the number of device. Without number softhddevice becomes\n"
|
|
|
|
" the primary device. If becoming primary, the plugin is attached\n"
|
|
|
|
" to the devices. If loosing primary, the plugin is detached from\n"
|
|
|
|
" the devices.",
|
|
|
|
"HOTK key\n" " Execute hotkey.\n\n"
|
|
|
|
" key is the hotkey number, following are supported:\n"
|
|
|
|
" 10: disable audio pass-through\n"
|
|
|
|
" 11: enable audio pass-through\n"
|
2012-04-06 14:38:51 +02:00
|
|
|
" 12: toggle audio pass-through\n"
|
2012-04-07 00:15:57 +02:00
|
|
|
" 13: decrease audio delay by 10ms\n"
|
|
|
|
" 14: increase audio delay by 10ms\n"
|
2012-05-21 15:34:33 +02:00
|
|
|
" 20: disable fullscreen\n\040 21: enable fullscreen\n"
|
2012-04-15 22:59:52 +02:00
|
|
|
" 22: toggle fullscreen\n"
|
2012-05-21 15:34:33 +02:00
|
|
|
" 23: disable auto-crop\n\040 24: enable auto-crop\n"
|
2012-04-15 22:59:52 +02:00
|
|
|
" 25: toggle auto-crop\n"
|
2012-05-21 15:34:33 +02:00
|
|
|
" 30: stretch 4:3 to 16:9\n\040 31: pillar box 4:3 in 16:9\n"
|
2012-04-11 18:20:08 +02:00
|
|
|
" 32: center cut-out 4:3 to 16:9\n"
|
2012-04-11 12:15:12 +02:00
|
|
|
" 39: rotate 4:3 to 16:9 zoom mode\n",
|
2012-05-21 15:34:33 +02:00
|
|
|
"STAT\n" "\040 Display SuspendMode of the plugin.\n\n"
|
2012-04-20 16:51:04 +02:00
|
|
|
" reply code is 910 + SuspendMode\n"
|
|
|
|
" SUSPEND_EXTERNAL == -1 (909)\n"
|
|
|
|
" NOT_SUSPENDED == 0 (910)\n"
|
|
|
|
" SUSPEND_NORMAL == 1 (911)\n"
|
|
|
|
" SUSPEND_DETACHED == 2 (912)\n",
|
2012-10-30 16:50:31 +01:00
|
|
|
"3DOF\n" "\040 3D OSD off.\n",
|
|
|
|
"3DTB\n" "\040 3D OSD Top and Bottom.\n",
|
|
|
|
"3DSB\n" "\040 3D OSD Side by Side.\n",
|
2012-03-14 15:07:08 +01:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2012-01-12 15:20:01 +01:00
|
|
|
/**
|
|
|
|
** Return SVDRP commands help pages.
|
|
|
|
**
|
|
|
|
** return a pointer to a list of help strings for all of the plugin's
|
|
|
|
** SVDRP commands.
|
|
|
|
*/
|
|
|
|
const char **cPluginSoftHdDevice::SVDRPHelpPages(void)
|
|
|
|
{
|
2012-03-14 15:07:08 +01:00
|
|
|
return SVDRPHelpText;
|
2012-01-12 15:20:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** Handle SVDRP commands.
|
2012-02-25 13:02:15 +01:00
|
|
|
**
|
|
|
|
** @param command SVDRP command
|
|
|
|
** @param option all command arguments
|
|
|
|
** @param reply_code reply code
|
2012-01-12 15:20:01 +01:00
|
|
|
*/
|
|
|
|
cString cPluginSoftHdDevice::SVDRPCommand(const char *command,
|
2012-03-14 15:07:08 +01:00
|
|
|
const char *option, __attribute__ ((unused)) int &reply_code)
|
2012-01-12 15:20:01 +01:00
|
|
|
{
|
2012-04-20 16:51:04 +02:00
|
|
|
if (!strcasecmp(command, "STAT")) {
|
|
|
|
reply_code = 910 + SuspendMode;
|
|
|
|
switch (SuspendMode) {
|
|
|
|
case SUSPEND_EXTERNAL:
|
|
|
|
return "SuspendMode is SUSPEND_EXTERNAL";
|
|
|
|
case NOT_SUSPENDED:
|
|
|
|
return "SuspendMode is NOT_SUSPENDED";
|
|
|
|
case SUSPEND_NORMAL:
|
|
|
|
return "SuspendMode is SUSPEND_NORMAL";
|
|
|
|
case SUSPEND_DETACHED:
|
|
|
|
return "SuspendMode is SUSPEND_DETACHED";
|
|
|
|
}
|
|
|
|
}
|
2012-01-12 15:20:01 +01:00
|
|
|
if (!strcasecmp(command, "SUSP")) {
|
2012-02-08 23:26:49 +01:00
|
|
|
if (cSoftHdControl::Player) { // already suspended
|
|
|
|
return "SoftHdDevice already suspended";
|
|
|
|
}
|
2012-03-11 14:12:49 +01:00
|
|
|
if (SuspendMode != NOT_SUSPENDED) {
|
|
|
|
return "SoftHdDevice already detached";
|
|
|
|
}
|
2012-01-22 11:12:57 +01:00
|
|
|
cControl::Launch(new cSoftHdControl);
|
|
|
|
cControl::Attach();
|
2012-03-11 14:12:49 +01:00
|
|
|
Suspend(ConfigSuspendClose, ConfigSuspendClose, ConfigSuspendX11);
|
|
|
|
SuspendMode = SUSPEND_NORMAL;
|
2012-01-12 15:20:01 +01:00
|
|
|
return "SoftHdDevice is suspended";
|
|
|
|
}
|
2012-01-22 11:12:57 +01:00
|
|
|
if (!strcasecmp(command, "RESU")) {
|
2012-03-11 14:12:49 +01:00
|
|
|
if (SuspendMode == NOT_SUSPENDED) {
|
|
|
|
return "SoftHdDevice already resumed";
|
|
|
|
}
|
2012-03-01 22:12:22 +01:00
|
|
|
if (SuspendMode != SUSPEND_NORMAL) {
|
|
|
|
return "can't resume SoftHdDevice";
|
|
|
|
}
|
2012-01-22 20:49:43 +01:00
|
|
|
if (ShutdownHandler.GetUserInactiveTime()) {
|
|
|
|
ShutdownHandler.SetUserInactiveTimeout();
|
|
|
|
}
|
2012-02-08 23:26:49 +01:00
|
|
|
if (cSoftHdControl::Player) { // suspended
|
|
|
|
cControl::Shutdown(); // not need, if not suspended
|
|
|
|
}
|
2012-01-22 11:12:57 +01:00
|
|
|
Resume();
|
2012-03-11 14:12:49 +01:00
|
|
|
SuspendMode = NOT_SUSPENDED;
|
2012-01-22 11:12:57 +01:00
|
|
|
return "SoftHdDevice is resumed";
|
|
|
|
}
|
2012-03-01 22:12:22 +01:00
|
|
|
if (!strcasecmp(command, "DETA")) {
|
2012-03-11 14:12:49 +01:00
|
|
|
if (SuspendMode == SUSPEND_DETACHED) {
|
|
|
|
return "SoftHdDevice already detached";
|
|
|
|
}
|
2012-03-01 22:12:22 +01:00
|
|
|
if (cSoftHdControl::Player) { // already suspended
|
|
|
|
return "can't suspend SoftHdDevice already suspended";
|
|
|
|
}
|
|
|
|
cControl::Launch(new cSoftHdControl);
|
|
|
|
cControl::Attach();
|
2012-03-11 14:12:49 +01:00
|
|
|
Suspend(1, 1, 0);
|
|
|
|
SuspendMode = SUSPEND_DETACHED;
|
2012-03-01 22:12:22 +01:00
|
|
|
return "SoftHdDevice is detached";
|
|
|
|
}
|
|
|
|
if (!strcasecmp(command, "ATTA")) {
|
2012-10-29 16:00:45 +01:00
|
|
|
char *tmp;
|
|
|
|
char *t;
|
|
|
|
char *s;
|
|
|
|
char *o;
|
|
|
|
|
2012-03-02 00:38:52 +01:00
|
|
|
if (SuspendMode != SUSPEND_DETACHED) {
|
2012-03-01 22:12:22 +01:00
|
|
|
return "can't attach SoftHdDevice not detached";
|
|
|
|
}
|
2012-10-29 16:00:45 +01:00
|
|
|
if (!(tmp = strdup(option))) {
|
|
|
|
return "out of memory";
|
|
|
|
}
|
|
|
|
t = tmp;
|
|
|
|
while ((s = strsep(&t, " \t\n\r"))) {
|
|
|
|
if (!strcmp(s, "-d")) {
|
|
|
|
if (!(o = strsep(&t, " \t\n\r"))) {
|
|
|
|
free(tmp);
|
|
|
|
return "missing option argument";
|
|
|
|
}
|
|
|
|
free(ConfigX11Display);
|
|
|
|
ConfigX11Display = strdup(o);
|
|
|
|
X11DisplayName = ConfigX11Display;
|
|
|
|
} else if (!strncmp(s, "-d", 2)) {
|
|
|
|
free(ConfigX11Display);
|
|
|
|
ConfigX11Display = strdup(s + 2);
|
|
|
|
X11DisplayName = ConfigX11Display;
|
|
|
|
|
|
|
|
} else if (!strcmp(s, "-a")) {
|
|
|
|
if (!(o = strsep(&t, " \t\n\r"))) {
|
|
|
|
free(tmp);
|
|
|
|
return "missing option argument";
|
|
|
|
}
|
|
|
|
free(ConfigAudioDevice);
|
|
|
|
ConfigAudioDevice = strdup(o);
|
|
|
|
AudioSetDevice(ConfigAudioDevice);
|
|
|
|
} else if (!strncmp(s, "-a", 2)) {
|
|
|
|
free(ConfigAudioDevice);
|
|
|
|
ConfigAudioDevice = strdup(s + 2);
|
|
|
|
AudioSetDevice(ConfigAudioDevice);
|
|
|
|
|
|
|
|
} else if (!strcmp(s, "-p")) {
|
|
|
|
if (!(o = strsep(&t, " \t\n\r"))) {
|
|
|
|
free(tmp);
|
|
|
|
return "missing option argument";
|
|
|
|
}
|
|
|
|
free(ConfigAC3Device);
|
|
|
|
ConfigAC3Device = strdup(o);
|
|
|
|
AudioSetDeviceAC3(ConfigAC3Device);
|
|
|
|
} else if (!strncmp(s, "-p", 2)) {
|
|
|
|
free(ConfigAC3Device);
|
|
|
|
ConfigAC3Device = strdup(s + 2);
|
|
|
|
AudioSetDeviceAC3(ConfigAC3Device);
|
|
|
|
|
2013-01-01 12:40:12 +01:00
|
|
|
} else if (*s) {
|
2012-10-29 16:00:45 +01:00
|
|
|
free(tmp);
|
|
|
|
return "unsupported option";
|
|
|
|
}
|
2012-03-15 15:42:51 +01:00
|
|
|
}
|
2012-10-29 16:00:45 +01:00
|
|
|
free(tmp);
|
2012-03-01 22:12:22 +01:00
|
|
|
if (ShutdownHandler.GetUserInactiveTime()) {
|
|
|
|
ShutdownHandler.SetUserInactiveTimeout();
|
|
|
|
}
|
|
|
|
if (cSoftHdControl::Player) { // suspended
|
|
|
|
cControl::Shutdown(); // not need, if not suspended
|
|
|
|
}
|
|
|
|
Resume();
|
2012-03-11 14:12:49 +01:00
|
|
|
SuspendMode = NOT_SUSPENDED;
|
2012-03-01 22:12:22 +01:00
|
|
|
return "SoftHdDevice is attached";
|
|
|
|
}
|
2012-02-25 13:02:15 +01:00
|
|
|
if (!strcasecmp(command, "HOTK")) {
|
|
|
|
int hotk;
|
|
|
|
|
|
|
|
hotk = strtol(option, NULL, 0);
|
|
|
|
HandleHotkey(hotk);
|
|
|
|
return "hot-key executed";
|
|
|
|
}
|
2012-03-08 15:28:10 +01:00
|
|
|
if (!strcasecmp(command, "PRIM")) {
|
|
|
|
int primary;
|
|
|
|
|
|
|
|
primary = strtol(option, NULL, 0);
|
|
|
|
if (!primary && MyDevice) {
|
|
|
|
primary = MyDevice->DeviceNumber() + 1;
|
|
|
|
}
|
|
|
|
dsyslog("[softhddev] switching primary device to %d\n", primary);
|
|
|
|
DoMakePrimary = primary;
|
|
|
|
return "switching primary device requested";
|
|
|
|
}
|
2012-10-30 16:50:31 +01:00
|
|
|
if (!strcasecmp(command, "3DOF")) {
|
|
|
|
VideoSetOsd3DMode(0);
|
|
|
|
return "3d off";
|
|
|
|
}
|
|
|
|
if (!strcasecmp(command, "3DSB")) {
|
|
|
|
VideoSetOsd3DMode(1);
|
|
|
|
return "3d sbs";
|
|
|
|
}
|
|
|
|
if (!strcasecmp(command, "3DTB")) {
|
|
|
|
VideoSetOsd3DMode(2);
|
|
|
|
return "3d tb";
|
|
|
|
}
|
|
|
|
|
2012-01-12 15:20:01 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-12-07 14:37:51 +01:00
|
|
|
VDRPLUGINCREATOR(cPluginSoftHdDevice); // Don't touch this!
|