[Mplayer-cvslog] CVS: main/libvo vo_xv.c,1.17,1.18

GEREOFFY arpi_esp at users.sourceforge.net
Tue May 1 03:33:02 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv743

Modified Files:
	vo_xv.c 
Log Message:
multi buffering added (modify NUM_BUFFERS in the source)

Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** vo_xv.c	2001/04/24 11:42:04	1.17
--- vo_xv.c	2001/05/01 01:32:59	1.18
***************
*** 1,3 ****
--- 1,5 ----
  
+ #define NUM_BUFFERS 1
+ 
  /*
   * vo_xv.c, X11 Xv interface
***************
*** 62,66 ****
  static XvAdaptorInfo        *ai;
  static XvImageFormatValues  *fo;
! static XvImage *xvimage[1];
  
  #include <sys/ipc.h>
--- 64,70 ----
  static XvAdaptorInfo        *ai;
  static XvImageFormatValues  *fo;
! 
! static int current_buf=0;
! static XvImage* xvimage[NUM_BUFFERS];
  
  #include <sys/ipc.h>
***************
*** 70,74 ****
  static int Shmem_Flag;
  static int Quiet_Flag;
! static XShmSegmentInfo Shminfo[1];
  static int gXErrorFlag;
  static int CompletionType = -1;
--- 74,78 ----
  static int Shmem_Flag;
  static int Quiet_Flag;
! static XShmSegmentInfo Shminfo[NUM_BUFFERS];
  static int gXErrorFlag;
  static int CompletionType = -1;
***************
*** 185,190 ****
      {
       printf( "using Xvideo port %d for hw scaling\n",xv_port );
  
!      allocate_xvimage(0);
  
       XGetGeometry( mydisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
--- 189,197 ----
      {
       printf( "using Xvideo port %d for hw scaling\n",xv_port );
+ 
+      for(current_buf=0;current_buf<NUM_BUFFERS;++current_buf)
+        allocate_xvimage(current_buf);
  
!      current_buf=0;
  
       XGetGeometry( mydisplay,mywindow,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
***************
*** 268,279 ****
  	case IMGFMT_I420:
          case IMGFMT_IYUV:
!     		vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[0]->data+image_width*y0+x0,image_width);
  	break;
  	case IMGFMT_YUY2:
          case IMGFMT_YVYU:	
!     		vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[0]->data+2*(image_width*y0+x0),2*image_width);
  	break;
          case IMGFMT_UYVY:
!     		vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[0]->data+2*(image_width*y0+x0)+1,2*image_width);
  	break;
    }		
--- 275,286 ----
  	case IMGFMT_I420:
          case IMGFMT_IYUV:
!     		vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[current_buf]->data+image_width*y0+x0,image_width);
  	break;
  	case IMGFMT_YUY2:
          case IMGFMT_YVYU:	
!     		vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[current_buf]->data+2*(image_width*y0+x0),2*image_width);
  	break;
          case IMGFMT_UYVY:
!     		vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[current_buf]->data+2*(image_width*y0+x0)+1,2*image_width);
  	break;
    }		
***************
*** 285,293 ****
   vo_draw_text(image_width,image_height,draw_alpha);
   check_events();
!  XvShmPutImage(mydisplay, xv_port, mywindow, mygc, xvimage[0],
           0, 0,  image_width, image_height,
           drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
           False);
   XFlush(mydisplay);
   return;
  }
--- 292,301 ----
   vo_draw_text(image_width,image_height,draw_alpha);
   check_events();
!  XvShmPutImage(mydisplay, xv_port, mywindow, mygc, xvimage[current_buf],
           0, 0,  image_width, image_height,
           drwX,drwY,drwWidth,(mFullscreen?drwHeight - 1:drwHeight),
           False);
   XFlush(mydisplay);
+  current_buf=(current_buf+1)%NUM_BUFFERS;
   return;
  }
***************
*** 301,305 ****
   int i;
  
!  dst = xvimage[0]->data + image_width * y + x;
   src = image[0];
   if(w==stride[0] && w==image_width) memcpy(dst,src,w*h);
--- 309,313 ----
   int i;
  
!  dst = xvimage[current_buf]->data + image_width * y + x;
   src = image[0];
   if(w==stride[0] && w==image_width) memcpy(dst,src,w*h);
***************
*** 314,318 ****
   x/=2;y/=2;w/=2;h/=2;
  
!  dst = xvimage[0]->data + image_width * image_height + image_width/2 * y + x;
   src = image[2];
   if(w==stride[2] && w==image_width/2) memcpy(dst,src,w*h);
--- 322,326 ----
   x/=2;y/=2;w/=2;h/=2;
  
!  dst = xvimage[current_buf]->data + image_width * image_height + image_width/2 * y + x;
   src = image[2];
   if(w==stride[2] && w==image_width/2) memcpy(dst,src,w*h);
***************
*** 324,328 ****
       dst+=image_width/2;
     }
!  dst = xvimage[0]->data + image_width * image_height * 5 / 4 + image_width/2 * y + x;
   src = image[1];
   if(w==stride[1] && w==image_width/2) memcpy(dst,src,w*h);
--- 332,336 ----
       dst+=image_width/2;
     }
!  dst = xvimage[current_buf]->data + image_width * image_height * 5 / 4 + image_width/2 * y + x;
   src = image[1];
   if(w==stride[1] && w==image_width/2) memcpy(dst,src,w*h);
***************
*** 350,354 ****
       int i;
       unsigned short *s=(unsigned short *)src[0];
!      unsigned short *d=(unsigned short *)xvimage[0]->data;
       s+=image_width*image_height;
       for(i=0;i<image_height;i++) {
--- 358,362 ----
       int i;
       unsigned short *s=(unsigned short *)src[0];
!      unsigned short *d=(unsigned short *)xvimage[current_buf]->data;
       s+=image_width*image_height;
       for(i=0;i<image_height;i++) {
***************
*** 358,362 ****
       }
  #else
!      memcpy(xvimage[0]->data,src[0],image_width*image_height*2);
  #endif
       break;
--- 366,370 ----
       }
  #else
!      memcpy(xvimage[current_buf]->data,src[0],image_width*image_height*2);
  #endif
       break;
***************
*** 367,373 ****
  
       // YV12 planar
!      memcpy(xvimage[0]->data,src[0],image_width*image_height);
!      memcpy(xvimage[0]->data+image_width*image_height,src[2],image_width*image_height/4);
!      memcpy(xvimage[0]->data+image_width*image_height*5/4,src[1],image_width*image_height/4);
       break;
   }
--- 375,381 ----
  
       // YV12 planar
!      memcpy(xvimage[current_buf]->data,src[0],image_width*image_height);
!      memcpy(xvimage[current_buf]->data+image_width*image_height,src[2],image_width*image_height/4);
!      memcpy(xvimage[current_buf]->data+image_width*image_height*5/4,src[1],image_width*image_height/4);
       break;
   }


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list