[MPlayer-cvslog] r32253 - in trunk: DOCS/xml/en/install.xml configure libvo/vo_dfbmga.c libvo/vo_directfb2.c

diego subversion at mplayerhq.hu
Wed Sep 15 20:34:15 CEST 2010


Author: diego
Date: Wed Sep 15 20:34:15 2010
New Revision: 32253

Log:
Require DirectFB version 0.9.22.
This allows getting rid of a lot of library version check #ifdeffery.
Release 0.9.22 is from February 2005, so the requirement is reasonable.

Modified:
   trunk/configure
   trunk/libvo/vo_dfbmga.c
   trunk/libvo/vo_directfb2.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/xml/en/install.xml

Modified: trunk/configure
==============================================================================
--- trunk/configure	Wed Sep 15 19:22:04 2010	(r32252)
+++ trunk/configure	Wed Sep 15 20:34:15 2010	(r32253)
@@ -4261,7 +4261,7 @@ if test "$_directfb" = auto ; then
   cat > $TMPC << EOF
 #include <directfb.h>
 #include <directfb_version.h>
-#if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 15)
+#if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 22)
 #error "DirectFB version too old."
 #endif
 int main(void) { DirectFBInit(0, 0); return 0; }

Modified: trunk/libvo/vo_dfbmga.c
==============================================================================
--- trunk/libvo/vo_dfbmga.c	Wed Sep 15 19:22:04 2010	(r32252)
+++ trunk/libvo/vo_dfbmga.c	Wed Sep 15 20:34:15 2010	(r32253)
@@ -21,14 +21,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-/* directfb includes */
 #include <directfb.h>
 #include <directfb_version.h>
-
-#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
-#define DIRECTFBVERSION DFB_VERSION(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
-
-/* other things */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -105,16 +99,6 @@ static int osd_max;
 
 static int is_g200;
 
-#if DIRECTFBVERSION < DFB_VERSION(0,9,18)
- #define DSPF_ALUT44 DSPF_LUT8
- #define DLBM_TRIPLE ~0
- #define DSFLIP_ONSYNC 0
-#endif
-
-#if DIRECTFBVERSION < DFB_VERSION(0,9,16)
- #define DSPF_ARGB1555 DSPF_RGB15
-#endif
-
 static uint32_t in_width;
 static uint32_t in_height;
 static uint32_t buf_height;
@@ -145,12 +129,10 @@ pixelformat_name( DFBSurfacePixelFormat 
           return "I420";
      case DSPF_ALUT44:
           return "ALUT44";
-#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
      case DSPF_NV12:
           return "NV12";
      case DSPF_NV21:
           return "NV21";
-#endif
      default:
           return "Unknown pixel format";
      }
@@ -175,12 +157,10 @@ imgfmt_to_pixelformat( uint32_t format )
      case IMGFMT_I420:
      case IMGFMT_IYUV:
           return DSPF_I420;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
      case IMGFMT_NV12:
           return DSPF_NV12;
      case IMGFMT_NV21:
           return DSPF_NV21;
-#endif
      default:
           return DSPF_UNKNOWN;
      }
@@ -200,20 +180,9 @@ get_layer_by_name( DFBDisplayLayerID id,
 {
      struct layer_enum *l = (struct layer_enum *) data;
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
-     /* We have desc.name so use it */
      if (!strcmp( l->name, desc.name ))
           if ((l->res = dfb->GetDisplayLayer( dfb, id, l->layer )) == DFB_OK)
                return DFENUM_CANCEL;
-#else
-     /* Fake it according to id */
-     if ((id == 0 && !strcmp( l->name, "FBDev Primary Layer" )) ||
-         (id == 1 && !strcmp( l->name, "Matrox Backend Scaler" )) ||
-         (id == 2 && !strcmp( l->name, "Matrox CRTC2" )) ||
-         (id == 3 && !strcmp( l->name, "Matrox CRTC2 Sub-Picture" )))
-          if ((l->res = dfb->GetDisplayLayer( dfb, id, l->layer )) == DFB_OK)
-               return DFENUM_CANCEL;
-#endif
 
      return DFENUM_OK;
 }
@@ -230,13 +199,8 @@ preinit( const char *arg )
      use_crtc2 = 1;
      use_spic = 1;
      field_parity = -1;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,17)
      buffermode = DLBM_TRIPLE;
      osd_max = 4;
-#else
-     buffermode = DLBM_BACKVIDEO;
-     osd_max = 2;
-#endif
      flipping = 1;
      tvnorm = -1;
 
@@ -481,11 +445,7 @@ preinit( const char *arg )
 
      if (use_crtc2) {
           struct layer_enum l = {
-#if DIRECTFBVERSION > DFB_VERSION(0,9,20)
                "Matrox CRTC2 Layer",
-#else
-               "Matrox CRTC2",
-#endif
                &crtc2,
                DFB_UNSUPPORTED
           };
@@ -753,11 +713,9 @@ config( uint32_t width, uint32_t height,
           dlc.buffermode = buffermode;
           dlc.options    = DLOP_NONE;
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
           if (field_parity != -1) {
                dlc.options |= DLOP_FIELD_PARITY;
           }
-#endif
           mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Field parity set to: ");
           switch (field_parity) {
           case -1:
@@ -801,10 +759,8 @@ config( uint32_t width, uint32_t height,
                return -1;
           }
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
           if (field_parity != -1)
                crtc2->SetFieldParity( crtc2, field_parity );
-#endif
 
           crtc2->GetSurface( crtc2, &c2frame );
           c2frame->SetBlittingFlags( c2frame, DSBLIT_NOFX );
@@ -880,11 +836,9 @@ config( uint32_t width, uint32_t height,
           dlc.flags       = DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
           dlc.pixelformat = DSPF_ALUT44;
           dlc.buffermode  = buffermode;
-
-#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
           dlc.flags      |= DLCONF_OPTIONS;
           dlc.options     = DLOP_ALPHACHANNEL;
-#endif
+
           if ((res = spic->TestConfiguration( spic, &dlc, &failed )) != DFB_OK) {
                mp_msg( MSGT_VO, MSGL_ERR,
                        "vo_dfbmga: Invalid sub-picture configuration - %s!\n",
@@ -973,13 +927,11 @@ query_format( uint32_t format )
           break;
      case IMGFMT_YUY2:
           break;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
      case IMGFMT_NV12:
      case IMGFMT_NV21:
           if (use_crtc1 || use_crtc2)
                return 0;
           break;
-#endif
      default:
           return 0;
      }
@@ -1079,10 +1031,8 @@ draw_alpha( int x0, int y0,
                               dst + pitch * y0 + 2 * x0 + 1,
                               pitch );
           break;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
      case DSPF_NV12:
      case DSPF_NV21:
-#endif
      case DSPF_I420:
      case DSPF_YV12:
           vo_draw_alpha_yv12( w, h, src, srca, stride,
@@ -1119,13 +1069,10 @@ draw_slice( uint8_t * src[], int stride[
      y /= 2;
      h /= 2;
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
      if (frame_format == DSPF_NV12 || frame_format == DSPF_NV21) {
           memcpy_pic( dst + pitch * y + x, src[1],
                       w, h, pitch, stride[1] );
-     } else
-#endif
-     {
+     } else {
           x /= 2;
           w /= 2;
           pitch /= 2;
@@ -1159,10 +1106,8 @@ blit_to_screen( void )
      DFBRectangle *srect = NULL;
 
      if (use_bes) {
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
           if (vo_vsync && !flipping)
                bes->WaitForSync( bes );
-#endif
 
           besframe->Blit( besframe, blitsrc, NULL, besrect.x, besrect.y );
           blitsrc = besframe;
@@ -1170,10 +1115,8 @@ blit_to_screen( void )
      }
 
      if (use_crtc1) {
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
           if (vo_vsync && !flipping)
                crtc1->WaitForSync( crtc1 );
-#endif
 
           if (c1stretch)
                c1frame->StretchBlit( c1frame, blitsrc, srect, &c1rect );
@@ -1182,10 +1125,8 @@ blit_to_screen( void )
      }
 
      if (use_crtc2) {
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
           if (vo_vsync && !flipping)
                crtc2->WaitForSync( crtc2 );
-#endif
 
           if (c2stretch)
                c2frame->StretchBlit( c2frame, blitsrc, srect, &c2rect );

Modified: trunk/libvo/vo_directfb2.c
==============================================================================
--- trunk/libvo/vo_directfb2.c	Wed Sep 15 19:22:04 2010	(r32252)
+++ trunk/libvo/vo_directfb2.c	Wed Sep 15 20:34:15 2010	(r32253)
@@ -22,16 +22,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-// directfb includes
-
 #include <directfb.h>
 #include <directfb_version.h>
-
-#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
-#define DIRECTFBVERSION DFB_VERSION(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
-
-// other things
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -50,16 +42,14 @@
 #define min(x,y) (((x)<(y))?(x):(y))
 #endif
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,17)
 // triple buffering
 #define TRIPLE 1
-#endif
 
 static const vo_info_t info = {
 	"Direct Framebuffer Device",
 	"directfb",
 	"Jiri Svoboda Jiri.Svoboda at seznam.cz",
-	"v 2.0 (for DirectFB version >=0.9.15)"
+	"v 2.0 (for DirectFB version >=0.9.22)"
 };
 
 const LIBVO_EXTERN(directfb)
@@ -272,12 +262,6 @@ static int preinit(const char *arg)
 
         DFBCHECK (DirectFBCreate (&dfb));
 
-#if DIRECTFBVERSION < DFB_VERSION(0,9,17)
-        if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
-            mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot switch to fullscreen mode");
-        };
-#endif
-
   /*
    * (Get keyboard)
    */
@@ -317,17 +301,10 @@ static DFBSurfacePixelFormat convformat(
 	    case IMGFMT_BGR24: return  DSPF_RGB24; break;
             case IMGFMT_RGB16: return  DSPF_RGB16; break;
             case IMGFMT_BGR16: return  DSPF_RGB16; break;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
             case IMGFMT_RGB15: return  DSPF_ARGB1555; break;
             case IMGFMT_BGR15: return  DSPF_ARGB1555; break;
             case IMGFMT_RGB12: return  DSPF_ARGB4444; break;
             case IMGFMT_BGR12: return  DSPF_ARGB4444; break;
-#else
-            case IMGFMT_RGB15: return  DSPF_RGB15; break;
-            case IMGFMT_BGR15: return  DSPF_RGB15; break;
-            case IMGFMT_RGB12: return  DSPF_RGB12; break;
-            case IMGFMT_BGR12: return  DSPF_RGB12; break;
-#endif
             case IMGFMT_YUY2:  return  DSPF_YUY2; break;
             case IMGFMT_UYVY:  return  DSPF_UYVY; break;
     	    case IMGFMT_YV12:  return  DSPF_YV12; break;
@@ -611,7 +588,6 @@ static int config(uint32_t s_width, uint
 
         DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer));
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
         mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - switching layer to exclusive mode\n");
 	ret = layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE);
 
@@ -619,7 +595,6 @@ static int config(uint32_t s_width, uint
 	    mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot switch layer to exclusive mode. This could cause\nproblems. You may need to select correct pixel format manually!\n");
 	    DirectFBError("MPlayer - Switch layer to exlusive mode.",ret);
 	};
-#endif
 	if (params.scale) {
             mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - changing layer configuration (size)\n");
             dlc.flags       = DLCONF_WIDTH | DLCONF_HEIGHT;
@@ -669,13 +644,8 @@ static int config(uint32_t s_width, uint
 		    case DSPF_RGB32: bpp=32;break;
     		    case DSPF_RGB24: bpp=24;break;
 	            case DSPF_RGB16: bpp=16;break;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
     		    case DSPF_ARGB1555: bpp=15;break;
                     case DSPF_ARGB4444: bpp=12; break;
-#else
-        	    case DSPF_RGB15: bpp=15;break;
-                    case DSPF_RGB12: bpp=12; break;
-#endif
 		    case DSPF_RGB332 : bpp=8;break;
 		}
 
@@ -684,13 +654,8 @@ static int config(uint32_t s_width, uint
 		    case DSPF_RGB32:
     		    case DSPF_RGB24:
 	            case DSPF_RGB16:
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
     		    case DSPF_ARGB1555:
                     case DSPF_ARGB4444:
-#else
-        	    case DSPF_RGB15:
-                    case DSPF_RGB12:
-#endif
 		    case DSPF_RGB332:
 				    mp_msg(MSGT_VO, MSGL_V,"DirectFB: Trying to recover via videomode change (VM).\n");
 				    // get size
@@ -757,7 +722,6 @@ static int config(uint32_t s_width, uint
 	}
 #endif
 
-#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
         if (field_parity != -1) {
 	    dlc.flags = DLCONF_OPTIONS;
 	    ret = layer->GetConfiguration( layer, &dlc );
@@ -782,9 +746,6 @@ static int config(uint32_t s_width, uint
                 break;
           }
 
-#endif
-
-
 // get layer surface
 
 	ret = layer->GetSurface(layer,&primary);
@@ -1486,18 +1447,10 @@ static void draw_alpha(int x0, int y0, i
                 case DSPF_RGB16:
                         vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch);
                         break;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
                 case DSPF_ARGB1555:
-#else
-                case DSPF_RGB15:
-#endif
                         vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch);
                         break;
-#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
                 case DSPF_ARGB4444:
-#else
-                case DSPF_RGB12:
-#endif
                     vo_draw_alpha_rgb12(w, h, src, srca, stride,
                                         ((uint8_t *) dst) + pitch * y0 + 2 * x0,
                                         pitch);


More information about the MPlayer-cvslog mailing list