changeset 4512:f52e38e03bb7

YUY2 BGR32 BGR24 support for vo_x11 if swScaler is used
author michael
date Sun, 03 Feb 2002 14:41:31 +0000
parents bca05e9c0810
children 2e3800da1ceb
files libvo/vo_x11.c mplayer.c
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Sun Feb 03 13:39:35 2002 +0000
+++ b/libvo/vo_x11.c	Sun Feb 03 14:41:31 2002 +0000
@@ -132,6 +132,9 @@
 static SwsContext *swsContext=NULL;
 static int useSws=0; 
 extern int sws_flags;
+/*needed so we can output the correct supported formats in query_format()
+  should perhaps be passed as argument to query_format() */
+extern int softzoom; 
 
 static XVisualInfo vinfo;
 
@@ -274,7 +277,8 @@
  if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
  XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
 
- if( flags&0x04 && (format==IMGFMT_YV12 || format==IMGFMT_I420 || format==IMGFMT_IYUV)) {
+ if( flags&0x04 && (   format==IMGFMT_YV12 || format==IMGFMT_I420  || format==IMGFMT_IYUV 
+                    || format==IMGFMT_YUY2 || format==IMGFMT_BGR24 || format==IMGFMT_BGR32)) {
      // software scale
      if(fullscreen){
          image_width=vo_screenwidth;
@@ -508,6 +512,16 @@
     char *s=src[0];
     //printf( "sbpp=%d  dbpp=%d  depth=%d  bpp=%d\n",sbpp,dbpp,depth,bpp );
 
+    if(swsContext)
+    {
+      int stride[3]= {0,0,0};
+      if     (swsContext->srcFormat==IMGFMT_YUY2)  stride[0]=swsContext->srcW*2;
+      else if(swsContext->srcFormat==IMGFMT_BGR24) stride[0]=swsContext->srcW*3;
+      else if(swsContext->srcFormat==IMGFMT_BGR32) stride[0]=swsContext->srcW*4;
+      
+      return draw_slice(src, stride, swsContext->srcW, swsContext->srcH, 0, 0);
+    }
+    
   if( Flip_Flag ){
     // flipped BGR
     int i;
@@ -572,6 +586,11 @@
 
  switch( format )
   {
+   case IMGFMT_BGR24:
+   case IMGFMT_BGR32:
+   case IMGFMT_YUY2: 
+   	if(softzoom) return 1;
+	else	     return 0;
    case IMGFMT_I420:
    case IMGFMT_IYUV:
    case IMGFMT_YV12: return 1;
--- a/mplayer.c	Sun Feb 03 13:39:35 2002 +0000
+++ b/mplayer.c	Sun Feb 03 14:41:31 2002 +0000
@@ -254,7 +254,7 @@
 char* audio_driver=NULL;
 static int fullscreen=0;
 static int vidmode=0;
-static int softzoom=0;
+int softzoom=0;
 static int flip=-1;
 // We need this opt_* because the values are then calculated so the options use the opt_*
 // and before each file we reset the calculated value using this opt_* values