On Samstag 09 September 2006 16:59, Laz wrote:
> On Saturday 09 September 2006 13:05, Stefan Lucke wrote:
> > On Samstag 09 September 2006 13:29, Laz wrote:
> > > Is any one working on implementing vidCaps for the DirectFB output of
> > > softdevice (I see it has just been added to the vidix driver). If no one
> > > is, I'll have a go at implementing it.
> >
> > The reasons I did not go further in this directtion were:
> > - At the time I tried, DFB++ had a bug and need a patch to call
> > SetColorAdjustment() - When working with TV-out and touching color
> > registers, it was not possible for me to get the original values back.
> > Maybe that's due to our 0 .. 100% logic. Value range of DirectFB is
> > unsigned short.
> >
> > Attached is my old diff (2005-11-10) , untested with current cvs.
>
> I was originally thinking of using this on my main vdr system which uses
> viatv
> output but I've since found out that the primary layer supports this but the
> video overlay layer doesn't! I could have adjusted my OSD but not the video!
> Still, I've now had a go on my Matox system.
Funny, with nearly original version on my radeon, I only could adjust
the values of the videoLayer. Attached version is for current cvs and
does adjust settings for both: video and osd layer.
>
> The actual settings bit seems to work on my Matrox system but it still needs
> a
> bit of tweaking because I think things have been reordered since the patch
> was written: your patch calls CheckVideoParmChange() before SetParam() is
> called and so videoParmLayer is unset when CheckVideoParmChange() is called
> so it returns straight away.
CheckVideoParmChange() is now called at end of SetParams(),
and it is done allways.
--
Stefan Lucke
PS: Mail volume is really high in the past few days.
Index: video-dfb.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.c,v
retrieving revision 1.70
diff -U3 -r1.70 video-dfb.c
--- video-dfb.c 5 Aug 2006 17:51:25 -0000 1.70
+++ video-dfb.c 9 Sep 2006 21:34:39 -0000
@@ -263,6 +263,13 @@
/* ---------------------------------------------------------------------------
*/
+static __u16 Rel2AbsAdjustment(int val)
+{
+ return (__u16) (((double) 0xffff * (double) val) / 100.0);
+}
+
+/* ---------------------------------------------------------------------------
+ */
cDFBVideoOut::cDFBVideoOut(cSetupStore *setupStore)
: cVideoOut(setupStore)
{
@@ -288,6 +295,7 @@
videoLayerLevel = 1;
OSDpresent = false;
fieldParity = 0; // 0 - top field first, 1 - bottom field first
+ currentBrightness = currentContrast = currentHue = currentSaturation = -2;
if(setupStore->viaTv)
setupStore->tripleBuffering = 1;
@@ -613,6 +621,98 @@
/* ---------------------------------------------------------------------------
*/
+void cDFBVideoOut::CheckVideoParmChange()
+{
+ int newVidCaps = 0;
+ DFBColorAdjustment colorAdjustment;
+ IDirectFBDisplayLayer *videoParmLayer;
+
+ videoParmLayer = (useStretchBlit) ? osdLayer : videoLayer;
+
+ try {
+ videoParmLayer->GetColorAdjustment(&colorAdjustment);
+ } catch (DFBException *ex) {
+ fprintf(stderr,
+ "[dfb] CheckVideoParmChange() get: action=%s, result=%s\n",
+ ex->GetAction(), ex->GetResult());
+ delete ex;
+ setupStore->vidCaps = 0;
+ return;
+ }
+
+ if (currentBrightness == setupStore->vidBrightness &&
+ currentContrast == setupStore->vidContrast &&
+ currentHue == setupStore->vidHue &&
+ currentSaturation == setupStore->vidSaturation) {
+ return;
+ }
+
+ currentBrightness = setupStore->vidBrightness;
+ currentContrast = setupStore->vidContrast;
+ currentHue = setupStore->vidHue;
+ currentSaturation = setupStore->vidSaturation;
+
+ if (colorAdjustment. flags == DCAF_NONE) {
+// fprintf(stderr, "-- no adjustments available\n");
+ setupStore->vidCaps = 0;
+ return;
+ }
+
+ if (colorAdjustment. flags & DCAF_BRIGHTNESS) {
+//fprintf(stderr, "-- BRIGHTNESS = %04x\n", colorAdjustment.brightness);
+ newVidCaps |= CAP_BRIGHTNESS;
+ colorAdjustment.brightness = Rel2AbsAdjustment (currentBrightness);
+//fprintf(stderr, "-- BRIGHTNESS = %04x\n", colorAdjustment.brightness);
+ }
+
+ if (colorAdjustment. flags & DCAF_CONTRAST) {
+//fprintf(stderr, "-- CONTRAST = %d\n", colorAdjustment.contrast);
+ newVidCaps |= CAP_CONTRAST;
+ colorAdjustment.contrast = Rel2AbsAdjustment (currentContrast);
+ }
+
+ if (colorAdjustment. flags & DCAF_HUE) {
+//fprintf(stderr, "-- HUE = %d\n", colorAdjustment.hue);
+ newVidCaps |= CAP_HUE;
+ colorAdjustment.hue = Rel2AbsAdjustment (currentHue);
+ }
+
+ if (colorAdjustment. flags & DCAF_SATURATION) {
+//fprintf(stderr, "-- SATURATION = %d\n", colorAdjustment.saturation);
+ newVidCaps |= CAP_SATURATION;
+ colorAdjustment.saturation = Rel2AbsAdjustment (currentSaturation);
+ }
+
+ setupStore->vidCaps = newVidCaps;
+ try {
+ videoParmLayer->SetColorAdjustment(colorAdjustment);
+ if (!useStretchBlit) {
+ DFBColorAdjustment colorAdjustment1;
+
+ try {
+ osdLayer->GetColorAdjustment(&colorAdjustment1);
+ colorAdjustment. flags = colorAdjustment1. flags;
+ osdLayer->SetColorAdjustment(colorAdjustment);
+ } catch (DFBException *ex) {
+ fprintf(stderr,
+ "[dfb] CheckVideoParmChange() set S: "
+ "action=%s, result=%s\n",
+ ex->GetAction(), ex->GetResult());
+ delete ex;
+ }
+ }
+ } catch (DFBException *ex) {
+ fprintf(stderr,
+ "[dfb] CheckVideoParmChange() set P: action=%s, result=%s\n",
+ ex->GetAction(), ex->GetResult());
+ delete ex;
+ setupStore->vidCaps = 0;
+ return;
+ }
+}
+
+/* ---------------------------------------------------------------------------
+ */
bool cDFBVideoOut::Initialize (void)
{
/* -------------------------------------------------------------------------
@@ -1000,6 +1100,7 @@
fprintf(stderr,"No Videolayer available. Exiting...\n");
exit(EXIT_FAILURE);
}
+ CheckVideoParmChange();
}
/* ---------------------------------------------------------------------------
Index: video-dfb.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.h,v
retrieving revision 1.22
diff -U3 -r1.22 video-dfb.h
--- video-dfb.h 17 Jun 2006 16:27:35 -0000 1.22
+++ video-dfb.h 9 Sep 2006 21:34:39 -0000
@@ -45,10 +45,15 @@
clearBackground,
fieldParity;
int prevOsdMode;
- int videoLayerLevel;
+ int videoLayerLevel,
+ currentBrightness,
+ currentContrast,
+ currentHue,
+ currentSaturation;
void SetParams();
- void EnableFieldParity(IDirectFBDisplayLayer *layer);
+ void EnableFieldParity(IDirectFBDisplayLayer *layer),
+ CheckVideoParmChange();
#ifdef HAVE_CLE266_MPEG_DECODER
IDirectFBSurface* mpegfb[LAST_PICBUF];
_______________________________________________
Softdevice-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/softdevice-devel