summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2014-12-24 11:00:33 +0100
committerchriszero <zerov83@gmail.com>2014-12-24 11:00:33 +0100
commit80d2476f00dfe67f28aa2c10e143c2aefcba3c32 (patch)
tree30853f4b9013277bcc95d5b51ccf440f6e1fca7b
parent06464fbaa856da447cb794d80e07f5abb96f4b1f (diff)
downloadvdr-plugin-boblight-80d2476f00dfe67f28aa2c10e143c2aefcba3c32.tar.gz
vdr-plugin-boblight-80d2476f00dfe67f28aa2c10e143c2aefcba3c32.tar.bz2
Added 3D Mode.
Softhddevice patch optional, for autodetection.
-rw-r--r--README.md4
-rw-r--r--ambiservice.c8
-rw-r--r--ambiservice.h10
-rw-r--r--ambithread.c78
-rw-r--r--ambithread.h6
-rw-r--r--config.c3
-rw-r--r--config.h1
-rw-r--r--main_menu.c3
-rw-r--r--patch/vdr-plugin-softhddevice-Get-activeOsd3DMode.patch99
-rw-r--r--setup_menu.c4
-rw-r--r--softhdservice.h11
-rw-r--r--vdrboblight.c28
12 files changed, 241 insertions, 14 deletions
diff --git a/README.md b/README.md
index c70d00a..10c0b50 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Needs libboblight.so and boblightd configured and running (https://code.google.c
Priority [128] Every boblight client has a priority, the higher the lower
-Updaterate [25] Updaterate in Hz, 25 => 25 Updates per second from softhddevice. Boblightd has it's own updaterate, so this could be lowered
+Updaterate [15] Updaterate in Hz, 15 => 15 Updates per second from softhddevice. Boblightd has it's own updaterate which "smoothenings" the output. Too high values have a massive impact on cpu load!
Detect cinema bars
Show mainmenu
Log level
@@ -21,4 +21,4 @@ Saturation [30] 0-200 Saturation and value are multipliers for HSV color space
Speed [60] 0-100 Speed is a factor for a first order lowpass filter, the higher you set it the faster the lights react.
Autospeed [0] 0-100 Autospeed adjusts the speed on top of that based on how fast the colors are changing.
Interpolation [true] Interpolation is a setting for a boblightd output device,
- when it's on it will interpolate between the last two writes of a client. (Off might reduce load) \ No newline at end of file
+ when it's on it will interpolate between the last two writes of a client. (Off might reduce load)
diff --git a/ambiservice.c b/ambiservice.c
index 95b40fe..976b662 100644
--- a/ambiservice.c
+++ b/ambiservice.c
@@ -38,3 +38,11 @@ const char* cAmbiService::cineBars[] =
"Vertical",
"Both"
};
+
+const char* cAmbiService::osd3dModes[] =
+{
+ "Auto",
+ "Off",
+ "H-SBS",
+ "H-OU"
+};
diff --git a/ambiservice.h b/ambiservice.h
index 793b782..7c5a1bb 100644
--- a/ambiservice.h
+++ b/ambiservice.h
@@ -41,10 +41,20 @@ class cAmbiService
vmDetached,
vmCount
};
+
+ enum Osd3dMode
+ {
+ osdAuto,
+ osdOff,
+ osdHSBS,
+ osdHOU,
+ osdCount
+ };
// static
static const char* viewModes[];
static const char* cineBars[];
+ static const char* osd3dModes[];
};
#endif // __AMBI_SERVICE_H
diff --git a/ambithread.c b/ambithread.c
index 91569f5..dbecf9b 100644
--- a/ambithread.c
+++ b/ambithread.c
@@ -42,12 +42,18 @@ cAmbiThread::cAmbiThread()
lastxBarHeight = 0;
lastyBarWidth = 0;
barsChanged = true;
+ osd3dChanged = true;
softHdPlugin = cPluginManager::GetPlugin("softhddevice");
int softHdGrabService = (softHdPlugin && softHdPlugin->Service(ATMO1_GRAB_SERVICE, 0));
if (!softHdGrabService)
error("Can't find softhddevice %s!", softHdPlugin ? "service" : "plugin");
+
+ int softHd3DOsdServive = (softHdPlugin && softHdPlugin->Service(OSD1_3DMODE_SERVICE, 0));
+
+ if (!softHd3DOsdServive)
+ tell(1, "Can't find softhddevice 3D OsdMode Service 1.1, 3D detection will not work!");
}
cAmbiThread::~cAmbiThread()
@@ -117,6 +123,7 @@ void cAmbiThread::Action()
if(start - lastBoarderDetect > 5000) {
lastBoarderDetect = start;
detectCineBars();
+ getOsd3DMode();
}
putData();
@@ -217,6 +224,53 @@ int cAmbiThread::grabImage()
return success;
}
+int cAmbiThread::getOsd3DMode()
+{
+ if(osd3dChanged) return osd3DMode;
+
+ switch(cfg.osd3DMode) {
+ case osdAuto:
+ SoftHDDevice_Osd3DModeService_v1_1_t req;
+ req.GetMode = true;
+ if (!softHdPlugin->Service(OSD1_3DMODE_SERVICE, &req)) {
+ tempOsd3DMode = osdOff;
+ cfg.osd3DMode = osdOff;
+ }
+
+ // (0=off, 1=SBS, 2=Top Bottom)
+ int tempOsd3DMode;
+ switch (req.Mode) {
+ case 0:
+ tempOsd3DMode = osdOff;
+ break;
+ case 1:
+ tempOsd3DMode = osdHSBS;
+ break;
+ case 2:
+ tempOsd3DMode = osdHOU;
+ break;
+ default:
+ tempOsd3DMode = osdOff;
+ }
+ if(tempOsd3DMode != osd3DMode) {
+ osd3dChanged = true;
+ osd3DMode = tempOsd3DMode;
+ }
+ break;
+ case osdOff:
+ case osdHSBS:
+ case osdHOU:
+ if(osd3DMode != cfg.osd3DMode) {
+ osd3dChanged = true;
+ osd3DMode = cfg.osd3DMode;
+ }
+ default:
+ break;
+ }
+
+ return osd3DMode;
+}
+
//***************************************************************************
// Detect Cine Bars
//***************************************************************************
@@ -233,7 +287,7 @@ int cAmbiThread::detectCineBars()
|0|x x|0|
*/
- if (cfg.detectCineBars == cbNone) {
+ if (cfg.detectCineBars == cbNone || barsChanged) {
return done;
}
@@ -325,12 +379,16 @@ int cAmbiThread::putData()
for (int y = 0; y < imageHeight; y++) {
// skip horizontal cinebars
if(y < xBarHeight || y > imageHeight - xBarHeight) continue;
+
+ if (osd3DMode == osdHOU && y > (imageHeight/2) ) continue; // (0=off, 1=SBS, 2=Top Bottom)
- int rgb[3];
+ int rgb[3];
row = imageWidth * y;
for (int x = 0; x < imageWidth; x++) {
// skip vertical cinebars
if(x < yBarWidth || x > imageWidth - yBarWidth) continue;
+
+ if (osd3DMode == osdHSBS && x > (imageWidth/2) ) continue; // (0=off, 1=SBS, 2=Top Bottom)
p = &image[row + x];
rgb[0] = p->r;
@@ -339,9 +397,19 @@ int cAmbiThread::putData()
bob.writeColor(rgb, x - yBarWidth, y - xBarHeight);
}
}
- if (barsChanged) {
- bob.setScanRange(imageWidth - (2*yBarWidth), imageHeight - (2*xBarHeight));
- barsChanged = false;
+ if (barsChanged || osd3dChanged) {
+ int width = imageWidth - (2*yBarWidth);
+ int height = imageHeight - (2*xBarHeight);
+ if(osd3DMode == 1) {
+ width = width/2;
+ }
+ else if(osd3DMode == 2) {
+ height = height/2;
+ }
+ bob.setScanRange(width, height);
+
+ if (barsChanged) barsChanged = false;
+ if (osd3dChanged) osd3dChanged = false;
}
}
diff --git a/ambithread.h b/ambithread.h
index abc1c58..3fa15bb 100644
--- a/ambithread.h
+++ b/ambithread.h
@@ -51,6 +51,7 @@ class cAmbiThread : public cThread, public cAmbiService
int grabImage();
int detectCineBars();
+ int getOsd3DMode();
int putData();
int softhddeviceNotDetached();
@@ -69,10 +70,13 @@ class cAmbiThread : public cThread, public cAmbiService
int lastxBarHeight;
int lastyBarWidth;
+
+ int osd3DMode;
bool barsChanged;
+ bool osd3dChanged;
int imageSize;
int imageWidth;
int imageHeight;
-}; \ No newline at end of file
+};
diff --git a/config.c b/config.c
index 6f197a6..b66fa70 100644
--- a/config.c
+++ b/config.c
@@ -36,7 +36,7 @@ cBobConfig cfg;
cBobConfig::cBobConfig()
{
// to be configured
- frequence = 25;
+ frequence = 15;
threshold = 20;
gamma = 10;
value = 80;
@@ -56,6 +56,7 @@ cBobConfig::cBobConfig()
fixedR = 111;
fixedG = 101;
fixedB = 0;
+ osd3DMode = osdAuto;
dirty = 0;
}
diff --git a/config.h b/config.h
index f9c2892..09646c1 100644
--- a/config.h
+++ b/config.h
@@ -57,6 +57,7 @@ class cBobConfig : public cAmbiService
int showMainmenu; //bool
int detectCineBars;
int cineBarsThreshold;
+ int osd3DMode;
int loglevel;
diff --git a/main_menu.c b/main_menu.c
index 97b8cb3..23658ee 100644
--- a/main_menu.c
+++ b/main_menu.c
@@ -17,6 +17,7 @@ void cBoblightPluginMenu::Create(void) {
SetMenuCategory(mcPluginSetup);
Clear();
+ Add(new cMenuEditStraItem(tr("3D Mode"), &cfg.osd3dMode, cAmbiService::osdCount, cAmbiService::osd3dModes));
Add(new cMenuEditStraItem(tr("View Mode"), &cfg.viewMode, cAmbiService::vmCount, cAmbiService::viewModes));
Add(new cMenuEditStraItem(tr("Startup View Mode"), &cfg.startupViewMode, cAmbiService::vmCount, cAmbiService::viewModes));
@@ -58,4 +59,4 @@ eOSState cBoblightPluginMenu::ProcessKey(eKeys key)
}
return state;
-} \ No newline at end of file
+}
diff --git a/patch/vdr-plugin-softhddevice-Get-activeOsd3DMode.patch b/patch/vdr-plugin-softhddevice-Get-activeOsd3DMode.patch
new file mode 100644
index 0000000..aaffb31
--- /dev/null
+++ b/patch/vdr-plugin-softhddevice-Get-activeOsd3DMode.patch
@@ -0,0 +1,99 @@
+From a4ba63b99d517d050c4d7b6fb963c9f7e2cd0f4b Mon Sep 17 00:00:00 2001
+From: chriszero <zerov83@gmail.com>
+Date: Tue, 23 Dec 2014 19:51:12 +0100
+Subject: [PATCH] Get active Osd3DMode.
+
+---
+ softhddevice.cpp | 13 +++++++++++++
+ softhddevice_service.h | 7 +++++++
+ video.c | 10 ++++++++++
+ video.h | 3 +++
+ 4 files changed, 33 insertions(+)
+
+diff --git a/softhddevice.cpp b/softhddevice.cpp
+index b3467a5..a9c319f 100644
+--- a/softhddevice.cpp
++++ b/softhddevice.cpp
+@@ -3153,6 +3153,19 @@ bool cPluginSoftHdDevice::Service(const char *id, void *data)
+ {
+ //dsyslog("[softhddev]%s: id %s\n", __FUNCTION__, id);
+
++ if (strcmp(id, OSD1_3DMODE_SERVICE) == 0) {
++ SoftHDDevice_Osd3DModeService_v1_1_t *r;
++
++ r = (SoftHDDevice_Osd3DModeService_v1_1_t *) data;
++ if (r->GetMode) {
++ r->Mode = VideoGetOsd3DMode();
++ }
++ else {
++ VideoSetOsd3DMode(r->Mode);
++ return true;
++ }
++ }
++
+ if (strcmp(id, OSD_3DMODE_SERVICE) == 0) {
+ SoftHDDevice_Osd3DModeService_v1_0_t *r;
+
+diff --git a/softhddevice_service.h b/softhddevice_service.h
+index c7c2d5e..0bc40ea 100644
+--- a/softhddevice_service.h
++++ b/softhddevice_service.h
+@@ -25,6 +25,7 @@
+ #define ATMO_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.0"
+ #define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
+ #define OSD_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.0"
++#define OSD1_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.1"
+
+ enum
+ { GRAB_IMG_RGBA_FORMAT_B8G8R8A8 };
+@@ -52,6 +53,12 @@ typedef struct
+
+ typedef struct
+ {
++ int Mode;
++ bool GetMode;
++} SoftHDDevice_Osd3DModeService_v1_1_t;
++
++typedef struct
++{
+ // request/reply data
+
+ int width;
+diff --git a/video.c b/video.c
+index 7f47f5e..5281492 100644
+--- a/video.c
++++ b/video.c
+@@ -9664,6 +9664,16 @@ void VideoSetOsdSize(int width, int height)
+ }
+
+ ///
++/// Set active 3d OSD mode.
++///
++/// @return mode OSD mode (0=off, 1=SBS, 2=Top Bottom)
++///
++int VideoGetOsd3DMode(void)
++{
++ return Osd3DMode;
++}
++
++///
+ /// Set the 3d OSD mode.
+ ///
+ /// @param mode OSD mode (0=off, 1=SBS, 2=Top Bottom)
+diff --git a/video.h b/video.h
+index fa3e44f..3822f8d 100644
+--- a/video.h
++++ b/video.h
+@@ -179,6 +179,9 @@ extern void VideoSetOsdSize(int, int);
+ /// Set Osd 3D Mode
+ extern void VideoSetOsd3DMode(int);
+
++ /// Get Osd 3D Mode
++extern int VideoGetOsd3DMode(void);
++
+ /// Set video clock.
+ extern void VideoSetClock(VideoHwDecoder *, int64_t);
+
+--
+1.9.1
+
diff --git a/setup_menu.c b/setup_menu.c
index 868eef8..5ed8328 100644
--- a/setup_menu.c
+++ b/setup_menu.c
@@ -28,7 +28,7 @@ void cAmbiSetup::Setup()
Add(new cMenuEditIntItem(tr("Log level"), &cfg.loglevel, 0, 3));
Add(new cMenuEditBoolItem(tr("Show mainmenu"), &cfg.showMainmenu));
- Add(new cMenuEditIntItem(tr("Updaterate [Hz]"), &cfg.frequence, 1, 100));
+ Add(new cMenuEditIntItem(tr("Updaterate [Hz]"), &cfg.frequence, 1, 15));
Add(new cMenuEditStraItem(tr("Detect black borders"), &cfg.detectCineBars, cAmbiService::cbCount, cAmbiService::cineBars));
@@ -54,4 +54,4 @@ eOSState cAmbiSetup::ProcessKey(eKeys key)
void cAmbiSetup::Store()
{
plugin->Save();
-} \ No newline at end of file
+}
diff --git a/softhdservice.h b/softhdservice.h
index 3e98c7e..74d28db 100644
--- a/softhdservice.h
+++ b/softhdservice.h
@@ -22,7 +22,8 @@
#pragma once
-#define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
+#define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
+#define OSD1_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.1"
struct SoftHDDevice_AtmoGrabService_v1_1_t
{
@@ -35,4 +36,10 @@ struct SoftHDDevice_AtmoGrabService_v1_1_t
int size;
void* img;
-}; \ No newline at end of file
+};
+
+struct SoftHDDevice_Osd3DModeService_v1_1_t
+{
+ int Mode;
+ bool GetMode;
+};
diff --git a/vdrboblight.c b/vdrboblight.c
index 24d18b3..7316606 100644
--- a/vdrboblight.c
+++ b/vdrboblight.c
@@ -198,6 +198,34 @@ cString cPluginBoblight::SVDRPCommand(const char* Command, const char* Option, i
ReplyCode = 550;
return "detach";
}
+ else if (Option && strcasecmp(Option, "3d-hsbs") == 0)
+ {
+ cfg.osd3DMode = cAmbiService::osdHSBS;
+
+ ReplyCode = 550;
+ return "3d-hsbs";
+ }
+ else if (Option && strcasecmp(Option, "3d-hou") == 0)
+ {
+ cfg.osd3DMode = cAmbiService::osdHOU;
+
+ ReplyCode = 550;
+ return "3d-hou";
+ }
+ else if (Option && strcasecmp(Option, "3d-off") == 0)
+ {
+ cfg.osd3DMode = cAmbiService::osdOff;
+
+ ReplyCode = 550;
+ return "3d-off";
+ }
+ else if (Option && strcasecmp(Option, "3d-auto") == 0)
+ {
+ cfg.osd3DMode = cAmbiService::osdAuto;
+
+ ReplyCode = 550;
+ return "3d-auto";
+ }
else if(!Option || !strlen(Option)) {
switch(cfg.viewMode) {
case cAmbiService::vmAtmo: