summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2006-09-19 10:04:00 +0000
committerphintuka <phintuka>2006-09-19 10:04:00 +0000
commit0e6ed0aed07e80c64023bb6c2660e3495fdad8a2 (patch)
tree8cc0555c71e54398ebb1eca1b4ad12e701e0d51d
parent9ba6856b630d9f27d2d4f9ca1c78ce2bf66ed97a (diff)
downloadxineliboutput-0e6ed0aed07e80c64023bb6c2660e3495fdad8a2.tar.gz
xineliboutput-0e6ed0aed07e80c64023bb6c2660e3495fdad8a2.tar.bz2
Menu re-ordered, better separation of local and global settings.
deinterlacer configuration string splitted to easy-to-use items added ffmpeg post processing
-rw-r--r--setup_menu.c584
1 files changed, 482 insertions, 102 deletions
diff --git a/setup_menu.c b/setup_menu.c
index 00303e90..6c920be4 100644
--- a/setup_menu.c
+++ b/setup_menu.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: setup_menu.c,v 1.9 2006-09-18 02:52:56 phintuka Exp $
+ * $Id: setup_menu.c,v 1.10 2006-09-19 10:04:00 phintuka Exp $
*
*/
@@ -95,17 +95,14 @@ class cMenuSetupAudio : public cMenuSetupPage
{
private:
config_t newconfig;
- int audio_driver;
int visualization;
- cOsdItem *audio_driver_item;
cOsdItem *audio_ctrl_speakers;
cOsdItem *audio_ctrl_delay;
cOsdItem *audio_ctrl_compression;
cOsdItem *audio_ctrl_upmix;
cOsdItem *audio_ctrl_surround;
cOsdItem *audio_ctrl_headphone;
- cMenuEditItem *audio_port_item;
protected:
virtual void Store(void);
@@ -121,9 +118,6 @@ class cMenuSetupAudio : public cMenuSetupPage
cMenuSetupAudio::cMenuSetupAudio(void)
{
memcpy(&newconfig, &xc, sizeof(config_t));
- audio_driver = strstra(xc.audio_driver,
- xc.s_audioDrivers,
- 0);
visualization = strstra(xc.audio_visualization,
xc.s_audioVisualizations,
0);
@@ -150,15 +144,6 @@ void cMenuSetupAudio::Set(void)
Clear();
Add(NewTitle("Audio"));
- Add(audio_driver_item =
- new cMenuEditStraI18nItem(tr("Driver"), &audio_driver,
- AUDIO_DRIVER_count, xc.s_audioDriverNames));
- if(audio_driver != AUDIO_DRIVER_AUTO && audio_driver != AUDIO_DRIVER_NONE)
- Add(audio_port_item =
- new cMenuEditStrItem(tr("Port"), newconfig.audio_port, 31,
- DriverNameChars));
- else
- audio_port_item = NULL;
Add(audio_ctrl_speakers =
new cMenuEditStraI18nItem(tr("Speakers"), &newconfig.speaker_type,
@@ -169,7 +154,7 @@ void cMenuSetupAudio::Set(void)
Add(audio_ctrl_compression =
new cMenuEditTypedIntItem(tr("Audio Compression"), "%",
&newconfig.audio_compression,
- 100, 500, tr("Off")));
+ 100, 500, NULL, tr("Off")));
Add(audio_ctrl_upmix =
new cMenuEditBoolItem(tr("Upmix stereo to 5.1"),
&newconfig.audio_upmix));
@@ -195,7 +180,6 @@ void cMenuSetupAudio::Set(void)
eOSState cMenuSetupAudio::ProcessKey(eKeys Key)
{
cOsdItem *item = Get(Current());
- int val = audio_driver;
eOSState state = cMenuSetupPage::ProcessKey(Key);
@@ -204,29 +188,7 @@ eOSState cMenuSetupAudio::ProcessKey(eKeys Key)
if(Key!=kLeft && Key!=kRight)
return state;
- if(item == audio_driver_item) {
- if(val != audio_driver) {
- if(audio_driver == AUDIO_DRIVER_ALSA) {
- strcpy(newconfig.audio_port, "default");
- Set();
- } else if(audio_driver == AUDIO_DRIVER_OSS) {
- strcpy(newconfig.audio_port, "/dev/dsp0");
- Set();
- } else {
- strcpy(newconfig.audio_port, "");
- Set();
- }
- }
- else if((audio_driver != AUDIO_DRIVER_AUTO &&
- audio_driver != AUDIO_DRIVER_NONE) &&
- !audio_port_item)
- Set();
- else if((audio_driver == AUDIO_DRIVER_AUTO ||
- audio_driver == AUDIO_DRIVER_NONE) &&
- audio_port_item)
- Set();
- }
- else if(item == audio_ctrl_delay || item == audio_ctrl_compression) {
+ if(item == audio_ctrl_delay || item == audio_ctrl_compression) {
cXinelibDevice::Instance().ConfigurePostprocessing(
xc.deinterlace_method, newconfig.audio_delay,
newconfig.audio_compression, newconfig.audio_equalizer,
@@ -275,11 +237,8 @@ eOSState cMenuSetupAudio::ProcessKey(eKeys Key)
void cMenuSetupAudio::Store(void)
{
memcpy(&xc, &newconfig, sizeof(config_t));
- strcpy(xc.audio_driver, xc.s_audioDrivers[audio_driver]);
strcpy(xc.audio_visualization, xc.s_audioVisualizations[visualization]);
- SetupStore("Audio.Driver", xc.audio_driver);
- SetupStore("Audio.Port", xc.audio_port);
SetupStore("Audio.Speakers", xc.s_speakerArrangements[xc.speaker_type]);
SetupStore("Audio.Delay", xc.audio_delay);
SetupStore("Audio.Compression", xc.audio_compression);
@@ -368,6 +327,103 @@ void cMenuSetupAudioEq::Store(void)
//--- cMenuSetupVideo --------------------------------------------------------
+static const char *tvtime_method[] =
+ { "use_vo_driver",
+ "Linear",
+ "LinearBlend",
+ "Greedy",
+ "Greedy2Frame",
+ "Weave",
+ "LineDoubler",
+ "Vertical",
+ "ScalerBob",
+ "GreedyH",
+ "TomsMoComp",
+ NULL};
+
+static const int tvtime_methods_count = (sizeof(tvtime_method)-1)/sizeof(char*);
+
+static const char *tvtime_method_name[] =
+ {"Use Video-Out Driver", // "use_vo_driver"
+ "Linear Interpolation", // "Linear",
+ "Linear Blend (mplayer)", // "LinearBlend",
+ "Greedy - Low motion (DScaler)", // "Greedy",
+ "Greedy 2-frame (DScaler)", // "Greedy2Frame",
+ "Weave Last Field", // "Weave",
+ "Line Doubler", // "LineDoubler",
+ "Vertical Blend (ffmpeg)", // "Vertical",
+ "Scaler Bob", // "ScalerBob",
+ "Greedy - High Motion (DScaler)", // "GreedyH",
+ "Tom's Motion Compensated (DScaler)", // "TomsMoComp",
+ NULL};
+
+static const char *tvtime_pulldown[] =
+ { "none",
+ "vector",
+ NULL};
+
+static const char *tvtime_pulldown_name[] =
+ { "None",
+ "Vector",
+ NULL};
+
+static const char *tvtime_framerate[] =
+ { "full",
+ "half_top",
+ "half_bottom",
+ NULL};
+
+static const char *tvtime_framerate_name[] =
+ { "Full",
+ "Half (top)",
+ "Half (bottom)",
+ NULL};
+
+struct tvtime_s {
+ int method;
+ int cheap_mode; // on/off
+ int pulldown; // none, vector
+ int framerate; // full, half_top, half_bottom
+ int judder_correction; // on/off
+ int use_progressive_frame_flag; // on/off
+ int chroma_filter; // on/off
+
+ void Parse(const char *str)
+ {
+ cheap_mode = strstr(str, "cheap_mode=1") ? 1 : 0;
+ pulldown = strstr(str, "pulldown=none") ? 0 :
+ strstr(str, "pulldown=0") ? 0 : 1;
+ framerate = strstr(str, "framerate_mode=half_top") ? 1 :
+ strstr(str, "framerate_mode=1") ? 1 :
+ strstr(str, "framerate_mode=half_bottom") ? 2 :
+ strstr(str, "framerate_mode=2") ? 2 : 0;
+ chroma_filter = strstr(str, "chroma_filter=1") ? 1 : 0;
+ judder_correction = strstr(str, "judder_correction=0") ? 0 : 1;
+ use_progressive_frame_flag = strstr(str, "use_progressive_frame_flag=0") ? 0 : 1;
+ method=1;
+ char *m = strstr(str, "method=");
+ if(m) {
+ char *tmp = strdup(m + 7);
+ if(strchr(tmp, ','))
+ *strchr(tmp, ',') = 0;
+ method = strstra(tmp, tvtime_method, 1);
+ free(tmp);
+ }
+ }
+
+ const char *ToString(void)
+ {
+ static char buf[256];
+ sprintf(buf, "method=%s,cheap_mode=%d,pulldown=%s,framerate=%s,"
+ "judder_correction=%d,use_progressive_frame_flag=%d,"
+ "chroma_filter=%d",
+ tvtime_method[method], cheap_mode, tvtime_pulldown[pulldown],
+ tvtime_framerate[framerate], judder_correction,
+ use_progressive_frame_flag, chroma_filter);
+ return buf;
+ }
+};
+
class cMenuSetupVideo : public cMenuSetupPage
{
private:
@@ -379,6 +435,12 @@ class cMenuSetupVideo : public cMenuSetupPage
cOsdItem *ctrl_contrast;
cOsdItem *ctrl_brightness;
cOsdItem *ctrl_overscan;
+ cOsdItem *ctrl_pp;
+ cOsdItem *ctrl_deinterlace;
+ cOsdItem *ctrl_deinterlace_opts;
+
+ int deinterlace;
+ struct tvtime_s tvtime;
protected:
virtual void Store(void);
@@ -400,6 +462,10 @@ cMenuSetupVideo::cMenuSetupVideo(void)
newconfig.contrast = CONTROL_TO_INDEX(newconfig.contrast);
newconfig.brightness = CONTROL_TO_INDEX(newconfig.brightness);
+ deinterlace = strstra(xc.deinterlace_method, xc.s_deinterlaceMethods, 0);
+
+ tvtime.Parse(newconfig.deinterlace_opts);
+
Set();
}
@@ -410,6 +476,8 @@ cMenuSetupVideo::~cMenuSetupVideo(void)
xc.overscan);
cXinelibDevice::Instance().ConfigurePostprocessing(
"autocrop", xc.autocrop ? true : false, xc.AutocropOptions());
+ cXinelibDevice::Instance().ConfigurePostprocessing(
+ "pp", xc.ffmpeg_pp ? true : false, xc.FfmpegPpOptions());
}
void cMenuSetupVideo::Set(void)
@@ -440,6 +508,40 @@ void cMenuSetupVideo::Set(void)
&newconfig.overscan, 0, 10,
tr("Off")));
+ Add(ctrl_pp = new cMenuEditBoolItem(tr("Post processing (ffmpeg)"),
+ &newconfig.ffmpeg_pp));
+ if(newconfig.ffmpeg_pp) {
+ Add(new cMenuEditIntItem( tr(" Quality"),
+ &newconfig.ffmpeg_pp_quality, 0, 6));
+ Add(new cMenuEditStrItem( tr(" Mode"), newconfig.ffmpeg_pp_mode,
+ 255, OptionsChars));
+ }
+
+ Add(ctrl_deinterlace =
+ new cMenuEditStraI18nItem(tr("Deinterlacing"), &deinterlace,
+ DEINTERLACE_count,
+ xc.s_deinterlaceMethodNames));
+
+ ctrl_deinterlace_opts = NULL;
+ if(deinterlace == DEINTERLACE_TVTIME) {
+ Add(ctrl_deinterlace_opts = new cMenuEditStrItem(tr(" Options"),
+ newconfig.deinterlace_opts,
+ 254, OptionsChars));
+
+ Add(new cMenuEditStraI18nItem(tr(" Method"), &tvtime.method,
+ tvtime_methods_count, tvtime_method_name));
+ Add(new cMenuEditBoolItem(tr(" Cheap mode"), &tvtime.cheap_mode));
+ Add(new cMenuEditStraI18nItem(tr(" Pulldown"), &tvtime.pulldown,
+ 2, tvtime_pulldown_name));
+ Add(new cMenuEditStraI18nItem(tr(" Frame rate"), &tvtime.framerate,
+ 3, tvtime_framerate_name));
+ Add(new cMenuEditBoolItem(tr(" Judder Correction"), &tvtime.judder_correction));
+ Add(new cMenuEditBoolItem(tr(" Use progressive frame flag"),
+ &tvtime.use_progressive_frame_flag));
+ Add(new cMenuEditBoolItem(tr(" Chroma Filter"),
+ &tvtime.chroma_filter));
+ }
+
#ifdef INTEGER_CONFIG_VIDEO_CONTROLS
Add(new cMenuEditIntItem(tr("HUE"), &newconfig.hue, -1, 0xffff));
Add(new cMenuEditIntItem(tr("Saturation"), &newconfig.saturation,-1,0xffff));
@@ -499,6 +601,19 @@ eOSState cMenuSetupVideo::ProcessKey(eKeys Key)
newconfig.AutocropOptions());
Set();
}
+ else if(item == ctrl_pp) {
+ cXinelibDevice::Instance().ConfigurePostprocessing(
+ "pp", newconfig.ffmpeg_pp ? true : false,
+ newconfig.FfmpegPpOptions());
+ Set();
+ } else if(item == ctrl_deinterlace) {
+ if(deinterlace == DEINTERLACE_TVTIME && !ctrl_deinterlace_opts) {
+ Set();
+ } else if(deinterlace != DEINTERLACE_TVTIME && ctrl_deinterlace_opts) {
+ Set();
+ }
+ }
+
return state;
}
@@ -514,6 +629,11 @@ void cMenuSetupVideo::Store(void)
xc.brightness = INDEX_TO_CONTROL(xc.brightness);
#endif
+ //strcpy(xc.deinterlace_method, xc.s_deinterlaceMethods[deinterlace]);
+ strcpy(xc.deinterlace_method, tvtime.ToString());
+ SetupStore("Video.Deinterlace", xc.deinterlace_method);
+ SetupStore("Video.DeinterlaceOptions", xc.deinterlace_opts);
+
SetupStore("Video.AutoCrop", xc.autocrop);
SetupStore("Video.AutoCrop.AutoDetect", xc.autocrop_autodetect);
SetupStore("Video.AutoCrop.SoftStart", xc.autocrop_soft);
@@ -524,6 +644,9 @@ void cMenuSetupVideo::Store(void)
SetupStore("Video.Contrast", xc.contrast);
SetupStore("Video.Brightness", xc.brightness);
SetupStore("Video.Overscan", xc.overscan);
+ SetupStore("Post.pp.Enable", xc.ffmpeg_pp);
+ SetupStore("Post.pp.Quality", xc.ffmpeg_pp_quality);
+ SetupStore("Post.pp.Mode", xc.ffmpeg_pp_mode);
}
@@ -777,9 +900,9 @@ class cMenuSetupLocal : public cMenuSetupPage
private:
config_t newconfig;
- int deinterlace;
- int video_driver;
int local_frontend;
+ int audio_driver;
+ int video_driver;
cOsdItem *ctrl_scale;
cOsdItem *ctrl_local_fe;
@@ -787,10 +910,10 @@ class cMenuSetupLocal : public cMenuSetupPage
cOsdItem *ctrl_fullscreen;
cOsdItem *ctrl_window_width;
cOsdItem *ctrl_window_height;
- cOsdItem *ctrl_deinterlace;
- cOsdItem *ctrl_deinterlace_opts;
cOsdItem *ctrl_interlace_order;
cOsdItem *ctrl_aspect;
+ cOsdItem *ctrl_audio_driver;
+ cOsdItem *ctrl_audio_port;
protected:
virtual void Store(void);
@@ -810,6 +933,7 @@ cMenuSetupLocal::cMenuSetupLocal(void)
memcpy(&newconfig, &xc, sizeof(config_t));
local_frontend = strstra(xc.local_frontend, xc.s_frontends, 0);
+ audio_driver = strstra(xc.audio_driver, xc.s_audioDrivers, 0);
video_driver = 0;
if(local_frontend == FRONTEND_X11)
@@ -817,8 +941,6 @@ cMenuSetupLocal::cMenuSetupLocal(void)
if(local_frontend == FRONTEND_FB)
video_driver = strstra(xc.video_driver, xc.s_videoDriversFB, 0);
- deinterlace = strstra(xc.deinterlace_method, xc.s_deinterlaceMethods, 0);
-
Set();
}
@@ -844,14 +966,25 @@ void cMenuSetupLocal::Set(void)
ctrl_driver = NULL;
ctrl_aspect = NULL;
ctrl_scale = NULL;
- ctrl_deinterlace_opts = NULL;
+ ctrl_audio_driver = NULL;
+ ctrl_audio_port = NULL;
Add(NewTitle("Local Frontend"));
+
Add(ctrl_local_fe =
new cMenuEditStraI18nItem(tr("Local Display Frontend"), &local_frontend,
FRONTEND_count, xc.s_frontendNames));
if(local_frontend == FRONTEND_X11) {
+ Add(new cMenuEditBoolItem(tr("Use keyboard"),
+ &newconfig.use_x_keyboard));
+ }
+
+ if(local_frontend != FRONTEND_NONE) {
+ Add(NewTitle("Video"));
+ }
+
+ if(local_frontend == FRONTEND_X11) {
Add(ctrl_driver =
new cMenuEditStraI18nItem(tr("Driver"), &video_driver,
X11_DRIVER_count,
@@ -859,8 +992,6 @@ void cMenuSetupLocal::Set(void)
strcpy(newconfig.video_port, "127.0.0.1:0.0");
Add(new cMenuEditStrItem(tr("Display address"), newconfig.video_port,
31, DriverNameChars));
- Add(new cMenuEditBoolItem(tr("Use keyboard"),
- &newconfig.use_x_keyboard));
} else if(local_frontend == FRONTEND_FB) {
Add(ctrl_driver =
@@ -899,24 +1030,23 @@ void cMenuSetupLocal::Set(void)
Add(ctrl_scale =
new cMenuEditBoolItem(tr("Scale to window size"), &newconfig.scale_video));
- Add(ctrl_deinterlace =
- new cMenuEditStraI18nItem(tr("Deinterlacing"), &deinterlace,
- DEINTERLACE_count,
- xc.s_deinterlaceMethodNames));
-
- if(deinterlace == DEINTERLACE_TVTIME) {
- Add(ctrl_deinterlace_opts = new cMenuEditStrItem(tr(" Options:"),
- newconfig.deinterlace_opts,
- 254, OptionsChars));
- }
-
#ifdef HAVE_XV_FIELD_ORDER
- if(!deinterlace)
- Add(ctrl_interlace_order =
- new cMenuEditStraI18nItem(tr("Interlaced Field Order"),
- &newconfig.field_order, FIELD_ORDER_count,
- xc.s_fieldOrder));
+ Add(ctrl_interlace_order =
+ new cMenuEditStraI18nItem(tr("Interlaced Field Order"),
+ &newconfig.field_order, FIELD_ORDER_count,
+ xc.s_fieldOrder));
#endif
+
+ Add(NewTitle("Audio"));
+
+ Add(ctrl_audio_driver =
+ new cMenuEditStraI18nItem(tr("Driver"), &audio_driver,
+ AUDIO_DRIVER_count, xc.s_audioDriverNames));
+ if(audio_driver != AUDIO_DRIVER_AUTO && audio_driver != AUDIO_DRIVER_NONE)
+ Add(ctrl_audio_port =
+ new cMenuEditStrItem(tr("Port"), newconfig.audio_port, 31,
+ DriverNameChars));
+
}
if(current<1) current=1; /* first item is not selectable */
@@ -927,6 +1057,7 @@ void cMenuSetupLocal::Set(void)
eOSState cMenuSetupLocal::ProcessKey(eKeys Key)
{
int prev_frontend = local_frontend;
+ int prev_audio_driver = audio_driver;
cOsdItem *item = Get(Current());
@@ -937,7 +1068,29 @@ eOSState cMenuSetupLocal::ProcessKey(eKeys Key)
if((Key!=kLeft && Key!=kRight) || !item)
return state;
- if(item == ctrl_aspect || item == ctrl_scale || item == ctrl_interlace_order)
+ if(item == ctrl_audio_driver) {
+ if(prev_audio_driver != audio_driver) {
+ if(audio_driver == AUDIO_DRIVER_ALSA) {
+ strcpy(newconfig.audio_port, "default");
+ Set();
+ } else if(audio_driver == AUDIO_DRIVER_OSS) {
+ strcpy(newconfig.audio_port, "/dev/dsp0");
+ Set();
+ } else {
+ strcpy(newconfig.audio_port, "");
+ Set();
+ }
+ }
+ else if((audio_driver != AUDIO_DRIVER_AUTO &&
+ audio_driver != AUDIO_DRIVER_NONE) &&
+ !ctrl_audio_port)
+ Set();
+ else if((audio_driver == AUDIO_DRIVER_AUTO ||
+ audio_driver == AUDIO_DRIVER_NONE) &&
+ ctrl_audio_port)
+ Set();
+ }
+ else if(item == ctrl_aspect || item == ctrl_scale || item == ctrl_interlace_order)
cXinelibDevice::Instance().ConfigureWindow(
xc.fullscreen, xc.width, xc.height, xc.modeswitch, xc.modeline,
newconfig.display_aspect, newconfig.scale_video,
@@ -950,24 +1103,8 @@ eOSState cMenuSetupLocal::ProcessKey(eKeys Key)
} else if(newconfig.fullscreen && ctrl_window_width) {
Set();
}
- } else if(item == ctrl_deinterlace) {
- if(deinterlace == DEINTERLACE_TVTIME && !ctrl_deinterlace_opts) {
- Set();
- } else if(deinterlace != DEINTERLACE_TVTIME && ctrl_deinterlace_opts) {
- Set();
- }
}
-#ifdef HAVE_XV_FIELD_ORDER
- else if(item == ctrl_deinterlace) {
- if(!deinterlace && !ctrl_interlace_order) {
- Set();
- } else if(deinterlace && ctrl_interlace_order) {
- Set();
- }
- }
-#endif
-
return state;
}
@@ -975,31 +1112,27 @@ void cMenuSetupLocal::Store(void)
{
memcpy(&xc, &newconfig, sizeof(config_t));
+ strcpy(xc.audio_driver, xc.s_audioDrivers[audio_driver]);
strcpy(xc.local_frontend, xc.s_frontends[local_frontend]);
if(local_frontend == FRONTEND_X11)
strcpy(xc.video_driver, xc.s_videoDriversX11[video_driver]);
if(local_frontend == FRONTEND_FB)
strcpy(xc.video_driver, xc.s_videoDriversFB[video_driver]);
- strcpy(xc.deinterlace_method, xc.s_deinterlaceMethods[deinterlace]);
-
- SetupStore("Frontend", xc.local_frontend);
- SetupStore("Modeline", xc.modeline);
+ SetupStore("Frontend", xc.local_frontend);
+ SetupStore("Audio.Driver", xc.audio_driver);
+ SetupStore("Audio.Port", xc.audio_port);
+ SetupStore("Video.Driver", xc.video_driver);
+ SetupStore("Video.Port", xc.video_port);
+ SetupStore("Video.Scale", xc.scale_video);
+ SetupStore("Video.FieldOrder", xc.field_order);
+ SetupStore("Modeline", xc.modeline);
SetupStore("VideoModeSwitching", xc.modeswitch);
- SetupStore("Fullscreen", xc.fullscreen);
+ SetupStore("Fullscreen", xc.fullscreen);
SetupStore("DisplayAspect", xc.s_aspects[xc.display_aspect]);
-
- SetupStore("X11.WindowWidth", xc.width);
+ SetupStore("X11.WindowWidth", xc.width);
SetupStore("X11.WindowHeight", xc.height);
- SetupStore("X11.UseKeyboard", xc.use_x_keyboard);
-
- SetupStore("Video.Driver", xc.video_driver);
- SetupStore("Video.Port", xc.video_port);
- SetupStore("Video.Scale", xc.scale_video);
- SetupStore("Video.Deinterlace", xc.deinterlace_method);
- SetupStore("Video.DeinterlaceOptions", xc.deinterlace_opts);
-
- SetupStore("Video.FieldOrder", xc.field_order);
+ SetupStore("X11.UseKeyboard", xc.use_x_keyboard);
}
//--- cMenuSetupRemote -------------------------------------------------------
@@ -1129,6 +1262,250 @@ void cMenuSetupRemote::Store(void)
} // namespace
+
+//--- cMenuTestImages ------------------------------------------------------
+
+#include <vdr/osdbase.h>
+
+#define OSD_W (720-2)
+#define OSD_H (576-2)
+#define OSD_X (1)
+#define OSD_Y (1)
+
+//
+// cTestGrayscale
+//
+
+class cTestGrayscale : public cOsdObject
+{
+ private:
+ cOsd *m_Osd;
+
+ public:
+ cTestGrayscale() { m_Osd = NULL; }
+ virtual ~cTestGrayscale() { delete m_Osd; }
+
+ virtual void Show();
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+void cTestGrayscale::Show()
+{
+ tArea areas [] = { { 0, 0, OSD_W/2 - 1, OSD_H - 1, 8},
+ {OSD_W/2, 0, OSD_W - 1, OSD_H - 1, 8}};
+ int i;
+
+ if(!m_Osd)
+ m_Osd = cOsdProvider::NewOsd(OSD_X, OSD_Y);
+
+ if(m_Osd) {
+ if (m_Osd->CanHandleAreas(areas, sizeof(areas) / sizeof(tArea) ) == oeOk) {
+ m_Osd->SetAreas(areas, sizeof(areas) / sizeof(tArea));
+ m_Osd->Flush();
+
+ // border
+ m_Osd->DrawRectangle(0, 0, OSD_W - 1, OSD_H - 1, 0xff000000);
+ m_Osd->DrawRectangle(1, 1, OSD_W - 2, OSD_H - 2, 0xff000000);
+
+ // background
+ m_Osd->DrawRectangle(2, 2, 2+103, OSD_H - 3, 0xffffffff);
+ m_Osd->DrawRectangle(OSD_W-2-103, 2, OSD_W-2, OSD_H - 3, 0xff000000);
+
+ for(i=0; i<0xff; i++)
+ m_Osd->DrawRectangle(2+103+2*i, 2, 2+103+2*(i+1), OSD_H - 3,
+ 0xff000000|(i*0x00010101)/*=(i<<16)|(i<<8)|(i)*/);
+ // line
+ m_Osd->DrawRectangle(1, OSD_H/2-20, OSD_W - 2, OSD_H/2, 0xffffffff);
+ m_Osd->DrawRectangle(1, OSD_H/2+1, OSD_W - 2, OSD_H/2+21, 0xff000000);
+
+ // Cross
+ for(int x=0; x<OSD_W;x++) {
+ m_Osd->DrawPixel(x, x*OSD_H/OSD_W, 0x00000000);
+ m_Osd->DrawPixel(x, OSD_H - 1 - x*OSD_H/OSD_W, 0x00000000);
+ }
+
+ // commit
+ m_Osd->Flush();
+ }
+
+ }
+}
+
+eOSState cTestGrayscale::ProcessKey(eKeys key)
+{
+ char s[32];
+ static int br = xc.brightness;
+ static int co = xc.contrast;
+ eOSState state = cOsdObject::ProcessKey(key);
+ if (state == osUnknown) {
+ switch (key & ~k_Repeat) {
+ case kOk:
+ case kBack:
+ return osEnd;
+ case kRight:
+ br += 0xffff/1024*2;
+ case kLeft:
+ br -= 0xffff/1024;
+ sprintf(s, "b %d", br);
+ m_Osd->DrawText(400, 100, s, 0xff000000, 0xffffffff, cFont::GetFont(fontSml));
+ cXinelibDevice::Instance().ConfigureVideo(xc.hue, xc.saturation, br, co, xc.overscan);
+ m_Osd->Flush();
+ return osContinue;
+ case kUp:
+ co += 0xffff/1024*2;
+ case kDown:
+ co -= 0xffff/1024;
+ sprintf(s, "c %d", co);
+ m_Osd->DrawText(400, 130, s, 0xff000000, 0xffffffff, cFont::GetFont(fontSml));
+ cXinelibDevice::Instance().ConfigureVideo(xc.hue, xc.saturation, br, co, xc.overscan);
+ m_Osd->Flush();
+ return osContinue;
+ }
+ }
+ return state;
+}
+
+
+//
+// cTestBitmap
+//
+
+class cTestBitmap : public cOsdObject
+{
+ private:
+ cOsd *m_Osd;
+ int bpp;
+
+ public:
+ cTestBitmap(int _bpp = 1) {
+ m_Osd = NULL;
+ if(_bpp<1) _bpp = 1;
+ if(_bpp>6) _bpp = 6;
+ bpp = 1<<_bpp;
+ }
+ virtual ~cTestBitmap() { delete m_Osd; }
+
+ virtual void Show();
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+void cTestBitmap::Show()
+{
+ tArea areas [] = {{ 0, 0, OSD_W - 1, OSD_H - 1, 8}};
+ int x, y, bit = 0;
+
+ if(!m_Osd) {
+ m_Osd = cOsdProvider::NewOsd(OSD_X, OSD_Y);
+
+ if(m_Osd) {
+ if (m_Osd->CanHandleAreas(areas, sizeof(areas) / sizeof(tArea) ) == oeOk) {
+ m_Osd->SetAreas(areas, sizeof(areas) / sizeof(tArea));
+ m_Osd->Flush();
+ }
+ }
+ }
+
+ if(m_Osd) {
+ for(x=0; x<OSD_W; x+=bpp) {
+ bit = (x/bpp) & 1;
+ for(y=0; y<OSD_H; y+=bpp) {
+ m_Osd->DrawRectangle(x, y, x+bpp, y+bpp, bit?0xffffffff:0xff000000);
+ bit = !bit;
+ }
+ }
+ // commit
+ m_Osd->Flush();
+ }
+}
+
+eOSState cTestBitmap::ProcessKey(eKeys key)
+{
+ eOSState state = cOsdObject::ProcessKey(key);
+
+ if (state == osUnknown) {
+ switch (key & ~k_Repeat) {
+ case kOk:
+ case kBack:
+ return osEnd;
+ case kRight:
+ bpp = (bpp<64) ? (bpp<<1) : 1;
+ Show();
+ return osContinue;
+ case kLeft:
+ bpp = (bpp>1) ? (bpp>>1) : 64;
+ Show();
+ return osContinue;
+ default:
+ break;
+ }
+ }
+ return state;
+}
+
+//
+// cMenuTestImages
+//
+
+#include <vdr/remote.h> // CallPlugin
+
+extern cOsdObject *g_PendingMenuAction;
+
+class cMenuTestImages : public cMenuSetupPage {
+
+ protected:
+ void Set(void);
+ virtual void Store(void) {};
+
+ public:
+ cMenuTestImages();
+
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+cMenuTestImages::cMenuTestImages()
+{
+ Set();
+}
+
+void cMenuTestImages::Set(void)
+{
+ char buf[128];
+ Clear();
+
+ SetHasHotkeys();
+ Add(new cOsdItem(tr("Grayscale"), osUser1));
+ sprintf(buf, "%s 1bit", tr("Bitmap"));
+ Add(new cOsdItem(buf, osUser2));
+ sprintf(buf, "%s 4bit", tr("Bitmap"));
+ Add(new cOsdItem(buf, osUser3));
+
+ Display();
+}
+
+eOSState cMenuTestImages::ProcessKey(eKeys Key)
+{
+ eOSState state = cMenuSetupPage::ProcessKey(Key);
+
+ switch (state) {
+ case osUser1:
+ g_PendingMenuAction = new cTestGrayscale();
+ cRemote::CallPlugin("xineliboutput");
+ return osEnd;
+ case osUser2:
+ g_PendingMenuAction = new cTestBitmap(1);
+ cRemote::CallPlugin("xineliboutput");
+ return osEnd;
+ case osUser3:
+ g_PendingMenuAction = new cTestBitmap(4);
+ cRemote::CallPlugin("xineliboutput");
+ return osEnd;
+ default: ;
+ }
+
+ return state;
+}
+
+
//--- cMenuSetupXinelib ------------------------------------------------------
cMenuSetupXinelib::cMenuSetupXinelib(void)
@@ -1149,6 +1526,7 @@ void cMenuSetupXinelib::Set(void)
Add(new cOsdItem(hk(tr("Decoder")), osUser5));
Add(new cOsdItem(hk(tr("Local Frontend")), osUser6));
Add(new cOsdItem(hk(tr("Remote Clients")), osUser7));
+ Add(new cOsdItem(hk(tr("Test Images")), osUser8));
Display();
}
@@ -1172,6 +1550,8 @@ eOSState cMenuSetupXinelib::ProcessKey(eKeys Key)
return AddSubMenu(new XinelibOutputSetupMenu::cMenuSetupLocal);
case osUser7:
return AddSubMenu(new XinelibOutputSetupMenu::cMenuSetupRemote);
+ case osUser8:
+ return AddSubMenu(new cMenuTestImages);
default: ;
}