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.
--
Stefan Lucke
? dfb-01.diff
? dfb-02.diff
Index: video-dfb.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.c,v
retrieving revision 1.41
diff -U3 -r1.41 video-dfb.c
--- video-dfb.c 6 Nov 2005 17:56:06 -0000 1.41
+++ video-dfb.c 10 Nov 2005 19:56:19 -0000
@@ -277,6 +277,13 @@
/* ---------------------------------------------------------------------------
*/
+static __u16 Rel2AbsAdjustment(int val)
+{
+ return (__u16) ((double) 0xffff * (double) val / 100.0);
+}
+
+/* ---------------------------------------------------------------------------
+ */
cDFBVideoOut::cDFBVideoOut(cSetupStore *setupStore)
: cVideoOut(setupStore)
{
@@ -299,6 +306,7 @@
clearBackCount = 2; // by default for double buffering;
OSDpresent = false;
fieldParity = 0; // 0 - top field first, 1 - bottom field first
+ videoParmLayer = NULL;
if(setupStore->viaTv)
setupStore->tripleBuffering = 1;
@@ -369,7 +377,6 @@
{
EnableFieldParity(videoLayer);
}
-
scrSurface = dfb->CreateSurface (scrDsc);
}
@@ -578,6 +585,71 @@
/* ---------------------------------------------------------------------------
*/
+void cDFBVideoOut::CheckVideoParmChange()
+{
+ int newVidCaps = 0;
+ DFBColorAdjustment colorAdjustment;
+
+ if (!videoParmLayer)
+ return;
+
+ try {
+ videoParmLayer->GetColorAdjustment(&colorAdjustment);
+ } catch (DFBException *ex) {
+ delete ex;
+ setupStore->vidCaps = 0;
+ return;
+ }
+
+ 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 (setupStore->vidBrightness);
+ 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 (setupStore->vidContrast);
+ }
+
+ if (colorAdjustment. flags & DCAF_HUE)
+ {
+ // fprintf(stderr, "-- HUE = %d\n", colorAdjustment.hue);
+ newVidCaps |= CAP_HUE;
+ colorAdjustment.hue = Rel2AbsAdjustment (setupStore->vidHue);
+ }
+
+ if (colorAdjustment. flags & DCAF_SATURATION)
+ {
+ //fprintf(stderr, "-- SATURATION = %d\n", colorAdjustment.saturation);
+ newVidCaps |= CAP_SATURATION;
+ colorAdjustment.saturation = Rel2AbsAdjustment (setupStore->vidSaturation);
+ }
+
+ setupStore->vidCaps = newVidCaps;
+ try {
+ videoParmLayer->SetColorAdjustment(colorAdjustment);
+ } catch (DFBException *ex) {
+ delete ex;
+fprintf(stderr, "autsch\n");
+ setupStore->vidCaps = 0;
+ return;
+ }
+}
+
+/* ---------------------------------------------------------------------------
+ */
void cDFBVideoOut::GetDisplayFrameTime (void)
{
if (videoLayer)
@@ -655,6 +727,7 @@
}
}
}
+ CheckVideoParmChange();
}
/* ---------------------------------------------------------------------------
@@ -920,6 +993,7 @@
delete ex;
exit(EXIT_FAILURE);
}
+ videoParmLayer = videoLayer;
}
else
{
@@ -965,6 +1039,7 @@
delete ex;
exit(EXIT_FAILURE);
}
+ videoParmLayer = osdLayer;
}
reportSurfaceCapabilities ("videoSurface", videoSurface);
Index: video-dfb.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.h,v
retrieving revision 1.12
diff -U3 -r1.12 video-dfb.h
--- video-dfb.h 6 Nov 2005 17:56:06 -0000 1.12
+++ video-dfb.h 10 Nov 2005 19:56:19 -0000
@@ -24,7 +24,7 @@
class cDFBVideoOut : public cVideoOut {
private:
- IDirectFBDisplayLayer *osdLayer, *videoLayer;
+ IDirectFBDisplayLayer *osdLayer, *videoLayer, *videoParmLayer;
DFBSurfaceDescription scrDsc, osdDsc, vidDsc;
IDirectFBSurface *osdSurface, *videoSurface, *scrSurface;
@@ -44,7 +44,8 @@
fieldParity;
void SetParams();
- void EnableFieldParity(IDirectFBDisplayLayer *layer);
+ void EnableFieldParity(IDirectFBDisplayLayer *layer),
+ CheckVideoParmChange();
public:
IDirectFB *dfb;
_______________________________________________
Softdevice-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/softdevice-devel