changeset 6262:ae3cfbfc8e3f

-updates vo_directfb (+configure&makefile) according to planned changes in dfb interface v. 0.9.11 (by Sven Neumann) -misstyped VEQ_CAP_HUE comparism fix (by Antonio Daplas) -videomode change support working (me) patch by Jiri.Svoboda@seznam.cz
author arpi
date Sat, 01 Jun 2002 22:20:19 +0000
parents 5b76ba46fc72
children f58be367acba
files configure libvo/Makefile libvo/vo_directfb.c
diffstat 3 files changed, 125 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sat Jun 01 20:57:26 2002 +0000
+++ b/configure	Sat Jun 01 22:20:19 2002 +0000
@@ -1845,6 +1845,31 @@
 echores "$_tdfxfb"
 
 
+echocheck "DirectFB headers presence"
+if test -z "$_inc_directfb" ; then
+  for I in /usr/include /usr/local/include; do
+    if test -d "$I/directfb" && test -f "$I/directfb/directfb.h" ; then
+      _inc_directfb="-I$I/directfb"
+      echores "yes (using $_inc_directfb)"
+      break
+    fi
+    if test -d "$I" && test -f "$I/directfb.h" ; then
+      _inc_directfb="-I$I"
+      echores "yes (using $_inc_directfb)"
+      break
+    fi
+  done
+  if test -z "$_inc_directfb" ; then
+    _directfb=no
+    echores "not found"
+  fi
+else
+  echores "yes (using $_inc_directfb)"
+fi
+if test "$_inc_directfb" = "-I/usr/include" ; then
+  _inc_directfb=""
+fi
+
 echocheck "DirectFB"
 if test "$_directfb" = auto ; then
   _directfb=no
@@ -1852,7 +1877,7 @@
 #include <directfb.h>
 int main(void) { IDirectFB *foo; return 0; }
 EOF
-  linux && test -c /dev/fb0 && cc_check -ldirectfb && _directfb=yes
+  linux && test -c /dev/fb0 && cc_check $_inc_directfb -ldirectfb && _directfb=yes
 fi
 if test "$_directfb" = yes ; then
   _def_directfb='#define HAVE_DIRECTFB 1'
@@ -1862,6 +1887,7 @@
 else
   _def_directfb='#undef HAVE_DIRECTFB'
   _novomodules="directfb $_novomodules"
+  _inc_directfb=""
 fi
 echores "$_directfb"
 
@@ -1872,7 +1898,7 @@
 #include <directfb.h>
 int main(void) { IDirectFBEventBuffer *foo; return 0; }
 EOF
-  cc_check -ldirectfb && _directfb099=yes
+  cc_check $_inc_directfb -ldirectfb && _directfb099=yes
 if test "$_directfb099" = yes ; then
   _def_directfb099='#define HAVE_DIRECTFB099 1'
 else
@@ -1887,7 +1913,7 @@
 #include <directfb.h>
 int main(void) { DFBDisplayLayerCapabilities  caps=DLCAPS_DST_COLORKEY; return 0; }
 EOF
-  cc_check -ldirectfb && _directfb0910=yes
+  cc_check $_inc_directfb -ldirectfb && _directfb0910=yes
 if test "$_directfb0910" = yes ; then
   _def_directfb0910='#define HAVE_DIRECTFB0910 1'
 else
@@ -1895,6 +1921,21 @@
 fi
 echores "$_directfb0910"
 fi
+if test "$_directfb" = yes; then
+echocheck "DirectFB >= 0.9.11"
+  _directfb0911=no
+  cat > $TMPC <<EOF
+#include <directfb.h>
+int main(void) { DFBInputEvent *foo; return foo->key_symbol; }
+EOF
+  cc_check $_inc_directfb -ldirectfb && _directfb0911=yes
+if test "$_directfb0911" = yes ; then
+  _def_directfb0911='#define HAVE_DIRECTFB0911 1'
+else
+  _def_directfb0911='#undef HAVE_DIRECTFB0911'
+fi
+echores "$_directfb0911"
+fi
 
 
 echocheck "X11 headers presence"
@@ -3872,6 +3913,7 @@
 DECORE_LIB = $_ld_decore
 MENCODER = $_mencoder
 ENCORE_LIB =  $_ld_encore $_ld_mp3lame $_ld_libdv
+DIRECTFB_INC = $_inc_directfb
 DIRECTFB_LIB = $_ld_directfb
 NEW_INPUT_LIB = $_ld_new_input
 
@@ -4235,6 +4277,7 @@
 $_def_directfb
 $_def_directfb099
 $_def_directfb0910
+$_def_directfb0911
 $_def_zr
 $_def_mga
 $_def_xmga
--- a/libvo/Makefile	Sat Jun 01 20:57:26 2002 +0000
+++ b/libvo/Makefile	Sat Jun 01 22:20:19 2002 +0000
@@ -10,7 +10,7 @@
 SRCS += vosub_vidix.c
 endif
 
-CFLAGS  = $(OPTFLAGS) -I. -I.. $(SDL_INC) $(X11_INC) $(EXTRA_INC) $(DXR2_INC) $(DVB_INC) -DMPG12PLAY #-Wall
+CFLAGS  = $(OPTFLAGS) -I. -I.. $(SDL_INC) $(X11_INC) $(EXTRA_INC) $(DXR2_INC) $(DVB_INC) $(DIRECTFB_INC) -DMPG12PLAY #-Wall
 ifeq ($(VIDIX),yes)
 CFLAGS += -DVIDIX_PATH='"$(prefix)/lib/mplayer/vidix/"'
 endif
--- a/libvo/vo_directfb.c	Sat Jun 01 20:57:26 2002 +0000
+++ b/libvo/vo_directfb.c	Sat Jun 01 22:20:19 2002 +0000
@@ -179,9 +179,9 @@
 
 DFBEnumerationResult enum_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data)
 {
-int overx=0,overy=0;
+int overx=0,overy=0,closer=0,over=0;
 unsigned int index=bpp/8-1;
-int allow_under=0;
+int we_are_under=0;
 
 if (verbose) printf("DirectFB: Validator entered %i %i %i\n",width,height,bpp);
 
@@ -194,9 +194,10 @@
         modes[index].overx=overx;
         modes[index].overy=overy;
         }
-if ((modes[index].overy<0)||(modes[index].overx<0)) allow_under=1;
-if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) {
-        if (((overx>=0)&&(overy>=0)) || allow_under) {
+if ((modes[index].overy<0)||(modes[index].overx<0)) we_are_under=1; // stored mode is smaller than req mode
+if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) closer=1; // current mode is closer to desired res
+if ((overx>=0)&&(overy>=0)) over=1; // current mode is bigger or equaul to desired res
+if ((closer && (over || we_are_under)) || (we_are_under && over)) {
                 modes[index].valid=1;
                 modes[index].width=width;
                 modes[index].height=height;
@@ -204,7 +205,6 @@
                 modes[index].overy=overy;
 		if (verbose) printf("DirectFB:Better mode added %i %i %i\n",width,height,bpp);
                 };
-        };
 
 return DFENUM_OK;
 }
@@ -297,10 +297,10 @@
     	    DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name));
 	}
 
-	// disable YV12 for dfb until 0.9.10 - there is a bug in dfb! should be revised with every dfb version until bug is fixed in dfb.
+	// disable YV12 for dfb until 0.9.11 - there is a bug in dfb! should be revised with every dfb version until bug is fixed in dfb.
 	if ((directfb_major_version <= 0) &&
 	    (directfb_minor_version <= 9) &&
-	    (directfb_micro_version <= 10)) {
+	    (directfb_micro_version <= 11)) {
 	    buggyYV12BitBlt=1;
 	    if (verbose) printf("DirectFB: Buggy YV12BitBlt!\n");
 	}
@@ -492,10 +492,53 @@
         modes[3].valid=0;
         DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
 
-
   if (vm) {
         // need better algorithm just hack
-        if (modes[source_pixel_size-1].valid) dfb->SetVideoMode(dfb,modes[source_pixel_size-1].width,modes[source_pixel_size-1].height,source_pixel_size);
+	    switch (format) {
+		    case IMGFMT_RGB32: 
+    		    case IMGFMT_BGR32: 
+				if (modes[3].valid) {
+				    dfb->SetVideoMode(dfb,modes[3].width,modes[3].height,32);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 32 bpp]\n",modes[3].width,modes[3].height);
+				};
+				break;
+        	    case IMGFMT_RGB24: 
+		    case IMGFMT_BGR24: 
+				if (modes[2].valid) {
+				    dfb->SetVideoMode(dfb,modes[2].width,modes[2].height,24);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 24 bpp]\n",modes[2].width,modes[2].height);
+				};
+				break;
+		    case IMGFMT_RGB16:
+    		    case IMGFMT_BGR16:
+            	    case IMGFMT_RGB15:
+	    	    case IMGFMT_BGR15:
+				if (modes[1].valid) {
+				    dfb->SetVideoMode(dfb,modes[1].width,modes[1].height,16);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 16 bpp]\n",modes[1].width,modes[1].height);
+				};
+				break;
+		
+        	    default: // try all of them in order 16bit 24bit 32bit 8bit
+				if (modes[1].valid) {
+				    dfb->SetVideoMode(dfb,modes[1].width,modes[1].height,16);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 16 bpp]\n",modes[1].width,modes[1].height);
+				    }
+				else if (modes[2].valid) {
+				    dfb->SetVideoMode(dfb,modes[2].width,modes[2].height,24);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 24 bpp]\n",modes[2].width,modes[2].height);
+				    }
+				else if (modes[3].valid) {
+				    dfb->SetVideoMode(dfb,modes[3].width,modes[3].height,32);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 32 bpp]\n",modes[3].width,modes[3].height);
+				    }
+				else if (modes[0].valid) {
+				    dfb->SetVideoMode(dfb,modes[0].width,modes[0].height,8);
+				    if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 8 bpp]\n",modes[0].width,modes[0].height);
+				    }
+				break;
+            };
+
         }
 
   // release primary if it is already allocated
@@ -1167,12 +1210,33 @@
 
       DFBInputEvent event;
 //if (verbose) printf ("DirectFB: Check events entered\n");
+#ifdef HAVE_DIRECTFB0910
+if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) {
+#else
 if (buffer->GetEvent(buffer, &event) == DFB_OK) {
+#endif
      if (event.type == DIET_KEYPRESS) { 
-    		switch (event.keycode) {
-                                case DIKC_ESCAPE:
+#ifdef HAVE_DIRECTFB0911
+    		switch (event.key_symbol) {
+                                case DIKS_ESCAPE:
 					mplayer_put_key('q');
 				break;
+				case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break;
+				case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
+                                case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break;
+                                case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break;
+                                case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break;
+                                case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break;
+				case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break;
+				case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break;
+				case DIKS_HOME: mplayer_put_key(KEY_HOME);break;
+				case DIKS_END: mplayer_put_key(KEY_END);break;
+
+                default:mplayer_put_key(event.key_symbol);
+                };
+#else  /* DirectFB < 0.9.11 */
+    		switch (event.keycode) {
+                                case DIKC_ESCAPE: mplayer_put_key('q');break;
                                 case DIKC_KP_PLUS: mplayer_put_key('+');break;
                                 case DIKC_KP_MINUS: mplayer_put_key('-');break;
 				case DIKC_TAB: mplayer_put_key('\t');break;
@@ -1192,6 +1256,7 @@
 
                 default:mplayer_put_key(event.key_ascii);
                 };
+#endif
 	};
     };
 // empty buffer, because of repeating (keyboard repeat is faster than key handling
@@ -1340,7 +1405,7 @@
 	    if (verbose) printf("DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,info->hue);
 	}
 
-	if ((videolayercaps.saturation)&&(info->cap&VEQ_CAP_HUE)) {
+	if ((videolayercaps.saturation)&&(info->cap&VEQ_CAP_SATURATION)) {
 	    ca.saturation = info->saturation * factor + 0x8000;
 	    ca.flags |= DCAF_SATURATION;
 	    if (verbose) printf("DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,info->saturation);