[Mplayer-cvslog] CVS: main/libvo2 draw.c,1.1,1.2 libvo2.h,1.1,1.2 vo_sample.c,1.1,NONE

Arpi of Ize arpi at mplayer.dev.hu
Mon Jul 30 04:00:56 CEST 2001


Update of /cvsroot/mplayer/main/libvo2
In directory mplayer:/var/tmp.root/cvs-serv24874/libvo2

Modified Files:
	draw.c libvo2.h 
Removed Files:
	vo_sample.c 
Log Message:
libvo2 support

Index: draw.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo2/draw.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- draw.c	28 Jun 2001 00:56:56 -0000	1.1
+++ draw.c	30 Jul 2001 02:00:54 -0000	1.2
@@ -3,30 +3,46 @@
 
 #include "libvo2.h"
 
-static vo2_surface_t* vo2_surface=NULL;
-
-
 // field:  0=frame  1=top_field  2=bottom_field
-void draw_slice_start(int field){
+void vo2_draw_slice_start(vo2_handle_t *vo,int field){
     // setup surface
-    surface=vo->get_surface(0);
+    vo->surface=vo->functions->get_surface(vo->priv,0);
 }
 
-void draw_slice(void* img[3],int stride[3],int w,int h,int x,int y){
+void vo2_draw_slice(vo2_handle_t *vo,unsigned char* img[3],int stride[3],int w,int h,int x,int y){
     
 
 
 }
 
-void draw_frame(void* img,int stride,int w,int h){
+void vo2_draw_frame(vo2_handle_t *vo,unsigned char* img,int stride,int w,int h){
 // do it:
-    surface=vo->get_surface(0);
-    if(stride==w && stride==surface->stride[0]){
-	memcpy(surface->img[0],img,w*h);
+    int i,bpp;
+    vo->surface=vo->functions->get_surface(vo->priv,0);
+    bpp=(vo->surface->bpp+7)/8;
+    
+    printf("w=%d  h=%d  bpp=%d  s_stride=%d  d_stride=%d\n",w,h,bpp,stride,
+	vo->surface->stride[0]);
+
+//    memset(vo->surface->img[0],0x20,w*h); return;
+    
+    if(stride==w && w*bpp==vo->surface->stride[0]){
+	memcpy(vo->surface->img[0],img,w*h*bpp);
 	return;
     }
     
+    for(i=0;i<h;i++){
+	memcpy(vo->surface->img[0]+vo->surface->stride[0]*i,img+stride*bpp*i,bpp*w);
+    }
+    return;
+    
 // fallback:
-    draw_slice_start();
-    draw_slice(&img,&stride,w,h,0,0);
+//    vo2_draw_slice(vo,&img,&stride,w,h,0,0);
+}
+
+void vo2_flip(vo2_handle_t *vo,int num){
+
+    vo->functions->flip_image(vo->priv,num);
+
 }
+

Index: libvo2.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo2/libvo2.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libvo2.h	28 Jun 2001 00:56:56 -0000	1.1
+++ libvo2.h	30 Jul 2001 02:00:54 -0000	1.2
@@ -1,13 +1,99 @@
 
+typedef struct vo2_info_s
+{
+        /* driver name ("Matrox Millennium G200/G400" */
+        const char *name;
+        /* short name (for config strings) ("mga") */
+        const char *short_name;
+        /* author ("Aaron Holtzman <aholtzma at ess.engr.uvic.ca>") */
+        const char *author;
+        /* any additional comments */
+        const char *comment;
+} vo2_info_t;
+
 typedef struct {
     int w,h;  // dimension of the surface
     int x,y;  // position of the image (for draw_frame/draw_slice)
-    void* img[3];  // pointer to frame/planes
+    unsigned char* img[3];  // pointer to frame/planes
     int stride[3]; // strides (bytes per line) for frame/planes
     int format; // RGB / BGR / YUV_PACKED / YUV_PLANAR
     int bpp;  // bits per pixel (15/16/24/32) or YUV fourcc
 } vo2_surface_t;
 
+typedef struct vo2_functions_s {
+
+// control (get/set/query) device parameters
+//  for example: query supported pixel formats, en/disable double buffering,
+//  query hw/sw scaling capabilities, switch window/fullscreen,
+//  get best matching resolution for a given image size etc...
+    int (*control)(void *p, int cmd, void* param);
+
+// start drawing (set video mode, allocate image buffers etc.)
+// w,h: requested surface size (actual size may be larger!!!)
+// format: IMGFMT_* requested surface pixel format
+// buffering: 0 - single temporary frame buffer (for draw_* stuff)
+//            1 - single static buffer  (for win32 direct rendering)
+//            2 - 2 static + 1 temp buffer (for mpeg direct rendering)
+// flags: various things, like fullscreen, sw/hw zoom and vidmode change
+// return: 1=success 0=fail (fail if pixel format or buffering not supported)
+    int (*start)(void *p, int w,int h,int format,int buffering,int flags);
+    
+// stop rendering, close device
+    int (*stop)(void *p);
+
+// get destination surface (for direct rendering or generic draw_ functions)
+// num: number of frame. 0 = temporary frame - can be dropped/modified
+//                       1-2 = static frames - should not be modified
+// Note:  mpeg will use 0,1,2 frames for B,Pf,Pb  (or fallback to 0-only)
+//        win32 will use only 0
+    vo2_surface_t* (*get_surface)(void *p, int num);
+
+// let's show surface[num]
+// we can assume that num is valid (get_surface(num) will return non-NULL)
+    void (*flip_image)(void *p, int num);
+
+} vo2_functions_t;
+
+typedef struct vo2_handle_s {
+    vo2_info_t* info;
+    vo2_functions_t* functions;
+    vo2_surface_t* surface;
+    void* priv;
+} vo2_handle_t;
+
+// Opens a new driver by name, returns the handle (vo2_handle_t)
+// returns NULL if failed (no such driver/device, etc)
+vo2_handle_t* vo2_new(char *drvname);
+int vo2_start(vo2_handle_t* vo, int w,int h,int format,int buffering,int flags);
+int vo2_query_format(vo2_handle_t* vo);
+int vo2_close(vo2_handle_t* vo);
+void vo2_draw_slice_start(vo2_handle_t *vo,int field);
+void vo2_draw_slice(vo2_handle_t *vo,unsigned char* img[3],int stride[3],int w,int h,int x,int y);
+void vo2_draw_frame(vo2_handle_t *vo,unsigned char* img,int stride,int w,int h);
+void vo2_flip(vo2_handle_t *vo,int num);
+
+// HACK
+typedef struct {
+    int dummy;
+} vo_functions_t;
+
+#include <inttypes.h>
+
+#include "../libvo/font_load.h"
+#include "../libvo/img_format.h"
+
+// currect resolution/bpp on screen:  (should be autodetected by vo_init())
+extern int vo_depthonscreen;
+extern int vo_screenwidth;
+extern int vo_screenheight;
+
+// requested resolution/bpp:  (-x -y -bpp options)
+extern int vo_dwidth;
+extern int vo_dheight;
+extern int vo_dbpp;
 
+extern int vo_doublebuffering;
+extern int vo_fsmode;
 
+extern char *vo_subdevice;
 

--- vo_sample.c DELETED ---




More information about the MPlayer-cvslog mailing list