changeset 4340:8a6f0b482acb

added support for i420 and iyuv
author alex
date Thu, 24 Jan 2002 18:13:54 +0000
parents 4b231f3778a6
children d407c8734ffe
files libvo/vo_x11.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_x11.c	Thu Jan 24 17:14:09 2002 +0000
+++ b/libvo/vo_x11.c	Thu Jan 24 18:13:54 2002 +0000
@@ -170,7 +170,7 @@
  if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
  XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
 
- if( flags&0x04 && format==IMGFMT_YV12 ) {
+ if( flags&0x04 && (format==IMGFMT_YV12 || format==IMGFMT_I420 || format==IMGFMT_IYUV)) {
      // software scale
      if(fullscreen){
          image_width=vo_screenwidth;
@@ -424,7 +424,8 @@
 //   return -1;
   }
 
- if( format==IMGFMT_YV12 ) yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );
+ if((format == IMGFMT_YV12) || (format == IMGFMT_I420) || (format == IMGFMT_IYUV))
+    yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );
   
 #ifdef HAVE_NEW_GUI  
  if ( vo_window == None ) 
@@ -486,10 +487,19 @@
 
 static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y )
 {
-
+ /* hack: swap planes for I420 ;) -- alex */
+ if ((image_format == IMGFMT_IYUV) || (image_format == IMGFMT_I420))
+ {
+    uint8_t *src_i420[3];
+    
+    src_i420[0] = src[0];
+    src_i420[1] = src[2];
+    src_i420[2] = src[1];
+    src = src_i420;
+ }
 if(scale_srcW){
  uint8_t *dst[3] = {ImageData, NULL, NULL};
- SwScale_YV12slice(src,stride,y,h,
+    SwScale_YV12slice(src,stride,y,h,
                          dst, image_width*((bpp+7)/8), ( depth == 24 ) ? bpp : depth,
 			 scale_srcW, scale_srcH, image_width, image_height);
 } else {
@@ -570,6 +580,8 @@
 
  switch( format )
   {
+   case IMGFMT_I420:
+   case IMGFMT_IYUV:
    case IMGFMT_YV12: return 1;
   }
  return 0;