[MPlayer-dev-eng] [PATCH] vo_*->control

David Holm david at realityrift.com
Thu Feb 7 22:42:35 CET 2002


Here it is. The patch that adds a control interface to every vo_* device
and removes vo_*->query_format and ->query_vaa.
It compiles on my machine but it is still likely there are bugs in some
of the modules which are automatically disabled here. The patch is too
big to be bug free out of the box, trial and error ppl.
It seemingly works perfectly with vo_xv and vo_dxr3, if it doesn't work
with vo_XX please fix this instead of telling me that it does not work.
It was pain enough to implement this into every device...

//David


-------------- next part --------------
? control.patch
? dxr3.patch
? fibmap_mplayer
? gmon.out
? vo.patch
? libdha/kernelhelper/test
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.386
diff -u -r1.386 mplayer.c
--- mplayer.c	6 Feb 2002 20:26:19 -0000	1.386
+++ mplayer.c	7 Feb 2002 21:50:45 -0000
@@ -1221,7 +1221,7 @@
 #ifdef USE_LIBVO2
     vo_flags=vo2_query_format(video_out);
 #else
-    vo_flags=video_out->query_format(out_fmt);
+    vo_flags=video_out->control(VOCTRL_QUERY_FORMAT, &out_fmt);
 #endif
     mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),vo_flags);
     if(vo_flags) break;
@@ -1359,7 +1359,8 @@
    }
    inited_flags|=INITED_VO;
    mp_msg(MSGT_CPLAYER,MSGL_V,"INFO: Video OUT driver init OK!\n");
-   video_out->query_vaa(&vo_vaa);
+   if(video_out->control(VOCTRL_QUERY_VAA, &vo_vaa)==VO_NOTIMPL)
+     memset(&vo_vaa,0,sizeof(vo_vaa_t));
    /*
 	get_hw_eq
    */
@@ -2545,6 +2546,9 @@
         audio_out->reset(); // stop audio, throwing away buffered data
       }
 
+      if(sh_video){
+         video_out->control(VOCTRL_RESET,NULL);
+      }
 #ifdef USE_OSD
         // Set OSD:
       if(osd_level){
Index: libvo/vesa_lvo.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vesa_lvo.c,v
retrieving revision 1.15
diff -u -r1.15 vesa_lvo.c
--- libvo/vesa_lvo.c	3 Feb 2002 09:12:32 -0000	1.15
+++ libvo/vesa_lvo.c	7 Feb 2002 21:50:45 -0000
@@ -40,6 +40,7 @@
 static mga_vid_config_t mga_vid_config;
 static unsigned image_bpp,image_height,image_width,src_format;
 extern int verbose;
+uint32_t vlvo_control(uint32_t request, void *data, ...);
 
 #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
@@ -47,11 +48,6 @@
 
 extern vo_functions_t video_out_vesa;
 
-static void vlvo_query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
-}
-
 int vlvo_preinit(const char *drvname)
 {
   printf("vesa_lvo: This branch is no longer supported.\n"
@@ -69,8 +65,7 @@
 	video_out_vesa.draw_frame=vlvo_draw_frame;
 	video_out_vesa.flip_page=vlvo_flip_page;
 	video_out_vesa.draw_osd=vlvo_draw_osd;
-	video_out_vesa.query_format=vlvo_query_info;
-	video_out_vesa.query_vaa=vlvo_query_vaa;
+	video_out_vesa.control=vlvo_control;
 	return 0;
 }
 
@@ -291,8 +286,14 @@
 #endif
 }
 
-uint32_t vlvo_query_info(uint32_t format)
+uint32_t
+vlvo_control(uint32_t request, void *data, ...)
 {
-  if(verbose > 1) printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format));
-  return 1;
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		if(verbose > 1) printf("vesa_lvo: query_format was called: %x (%s)\n",*((uint32_t*)data),vo_format_name(*((uint32_t*)data)));
+		return 1;
+		break;
+	}
+	return VO_NOTIMPL;
 }
Index: libvo/video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.15
diff -u -r1.15 video_out.h
--- libvo/video_out.h	31 Jan 2002 09:52:45 -0000	1.15
+++ libvo/video_out.h	7 Feb 2002 21:50:45 -0000
@@ -7,6 +7,7 @@
  */
 
 #include <inttypes.h>
+#include <stdarg.h>
 
 #include "font_load.h"
 #include "img_format.h"
@@ -16,6 +17,19 @@
 #define VO_EVENT_RESIZE 2
 #define VO_EVENT_KEYPRESS 4
 
+/* takes a pointer to a vo_vaa_s struct */
+#define VOCTRL_QUERY_VAA 1
+/* takes a pointer to uint32_t fourcc */
+#define VOCTRL_QUERY_FORMAT 2
+/* signal a device reset (seek/paus) */
+#define VOCTRL_RESET 3
+
+#define VO_TRUE		1
+#define VO_FALSE	0
+#define VO_ERROR	-1
+#define VO_NOTAVAIL	-2
+#define VO_NOTIMPL	-3
+
 typedef struct vo_info_s
 {
         /* driver name ("Matrox Millennium G200/G400" */
@@ -93,13 +107,10 @@
 			 uint32_t d_height, uint32_t fullscreen, char *title,
 			 uint32_t format,const vo_tune_info_t *);
 
-        /*
-         * Query that given pixel format is supported or not.
-	 * params:
-	 *   format: fourcc of pixel format
-         * returns : 1 if supported, 0 if unsupported
-         */
-        uint32_t (*query_format)(uint32_t format);
+	/*
+	 * Control interface
+	 */
+	uint32_t (*control)(uint32_t request, void *data, ...);
 
         /*
          * Return driver information.
@@ -144,14 +155,6 @@
          * Closes driver. Should restore the original state of the system.
          */
         void (*uninit)(void);
-
-	/*
-	 * Query Video Accelerated Architecture information.
-	 * params:
-	 *   vaa: address of struct to be filled.
-	 *  (Note: driver should memset it to ZERO if it doesn't support vaa.)
-	 */
-	void (*query_vaa)(vo_vaa_t *vaa);
 
 } vo_functions_t;
 
Index: libvo/video_out_internal.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out_internal.h,v
retrieving revision 1.8
diff -u -r1.8 video_out_internal.h
--- libvo/video_out_internal.h	31 Jan 2002 09:52:45 -0000	1.8
+++ libvo/video_out_internal.h	7 Feb 2002 21:50:45 -0000
@@ -21,6 +21,7 @@
  *
  */
 
+static uint32_t control(uint32_t request, void *data, ...);
 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
 		     uint32_t d_height, uint32_t fullscreen, char *title,
 		     uint32_t format,const vo_tune_info_t *);
@@ -39,7 +40,7 @@
 {\
 	preinit,\
 	config,\
-        query_format,\
+	control,\
 	get_info,\
 	draw_frame,\
 	draw_slice,\
@@ -47,7 +48,6 @@
 	flip_page,\
 	check_events,\
 	uninit,\
-	query_vaa\
 };
 
 #include "osd.h"
Index: libvo/vo_3dfx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_3dfx.c,v
retrieving revision 1.10
diff -u -r1.10 vo_3dfx.c
--- libvo/vo_3dfx.c	31 Jan 2002 09:52:45 -0000	1.10
+++ libvo/vo_3dfx.c	7 Feb 2002 21:50:45 -0000
@@ -311,6 +311,24 @@
 		targetoffset = vidpage0offset + (dispy*screenwidth + dispx)*screendepth;
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+//			case IMGFMT_YUY2:
+//			case IMGFMT_RGB|24:
+//			case IMGFMT_BGR|24:
+			return VO_TRUE;
+		}
+		return VO_FALSE;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t 
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info) 
 {
@@ -465,19 +483,6 @@
 	screen_to_screen_stretch_blt(targetoffset, vidpage2offset, dispwidth, dispheight);
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-//    case IMGFMT_YUY2:
-//    case IMGFMT_RGB|24:
-//    case IMGFMT_BGR|24:
-        return 1;
-    }
-    return 0;
-}
-
 static void
 uninit(void)
 {
@@ -492,9 +497,3 @@
 {
   return 0;
 }
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
-}
-
Index: libvo/vo_aa.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_aa.c,v
retrieving revision 1.19
diff -u -r1.19 vo_aa.c
--- libvo/vo_aa.c	31 Jan 2002 09:52:45 -0000	1.19
+++ libvo/vo_aa.c	7 Feb 2002 21:50:45 -0000
@@ -356,19 +356,25 @@
     return 0;
 }
 
-static uint32_t 
-query_format(uint32_t format) {
-    /*
-     * ...are we able to... ?
-     * called by mplayer
-     */
-    switch(format){
-	case IMGFMT_YV12:
-	case IMGFMT_RGB|24:
-	case IMGFMT_BGR|24:
-	    return 1;
-    }
-    return 0;
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		/*
+		 * ...are we able to... ?
+		 * called by mplayer
+		 */
+		case IMGFMT_YV12:
+		case IMGFMT_RGB|24:
+		case IMGFMT_BGR|24:
+			return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
 }
 
 static const vo_info_t* 
@@ -755,9 +761,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_dga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dga.c,v
retrieving revision 1.39
diff -u -r1.39 vo_dga.c
--- libvo/vo_dga.c	31 Jan 2002 11:45:25 -0000	1.39
+++ libvo/vo_dga.c	7 Feb 2002 21:50:45 -0000
@@ -383,6 +383,102 @@
 
 //---------------------------------------------------------
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+ uint32_t format;
+#ifdef HAVE_DGA2	
+ XDGAMode *modelines;
+ int       modecount;
+#endif
+ Display  *qdisp;
+
+ int i;
+ static int dga_depths_init = 0;
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		format = *((uint32_t*)data);
+
+ if(dga_depths_init == 0){
+
+   if((qdisp = XOpenDisplay(0))==NULL){
+     vd_printf(VD_ERR, "vo_dga: Can't open display!\n");
+     return 0;
+   }
+   if( !vo_init() ){
+    vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n");
+    return 1; 
+   }
+   vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen);
+ 
+   if(vo_dga_XServer_mode ==0){
+#ifndef HAVE_DGA2
+     vd_printf(VD_ERR, "vo_dga: Your X-Server is not running in a ");
+     vd_printf(VD_ERR, "resolution supported by DGA driver!\n");
+#endif     
+   }//else{
+   //  vd_printf(VD_INFO, "vo_dga: X running at: %s\n", 
+   //            vd_GetModeString(vo_dga_XServer_mode));
+   //}                                
+ 
+#ifdef HAVE_DGA2
+   modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount);
+   if(modelines){
+     for(i=0; i< modecount; i++){
+        vd_printf(VD_DBG, "vo_dga: (%03d) depth=%d, bpp=%d, r=%08x, g=%08x, b=%08x, %d x %d\n",
+	  	i,
+		modelines[i].depth,
+		modelines[i].bitsPerPixel,
+		modelines[i].redMask,
+		modelines[i].greenMask,
+	        modelines[i].blueMask,
+	 	modelines[i].viewportWidth,
+		modelines[i].viewportHeight);			  
+        vd_EnableMode(
+		modelines[i].depth,
+		modelines[i].bitsPerPixel,
+		modelines[i].redMask,
+		modelines[i].greenMask,
+	        modelines[i].blueMask);
+     }
+     XFree(modelines);
+
+   }
+#endif
+   dga_depths_init = 1;
+   XCloseDisplay(qdisp);
+
+  if( !vo_dga_modes[1].vdm_supported && vo_dga_modes[2].vdm_supported ){
+    vo_dga_modes[1].vdm_supported = 1;
+  }
+
+  if( !vo_dga_modes[3].vdm_supported && vo_dga_modes[4].vdm_supported ){
+    vo_dga_modes[3].vdm_supported = 1;
+  }
+
+   for(i=1; i<vo_dga_mode_num; i++){
+     vd_printf(VD_INFO, "vo_dga: Mode: %s", vd_GetModeString(i));
+     if(vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth){
+       vo_dga_modes[i].vdm_supported = 0;
+       vd_printf(VD_INFO, " ...disabled by -bpp %d", vo_dbpp );
+     }
+     vd_printf(VD_INFO, "\n");
+   }
+ }
+
+ // TODO: respect bit for native/not native
+ if( format==IMGFMT_YV12 ) return 7;
+ 
+ if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && 
+     vd_ModeValid(format&0xff)) return 7;
+ 
+ return 0;
+ break;
+	}
+	return VO_NOTIMPL;
+}
+
+
 static void draw_alpha( int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride ){
 
   char *d;
@@ -591,96 +687,6 @@
 
 //---------------------------------------------------------
 
-static uint32_t query_format( uint32_t format )
-{
-
-#ifdef HAVE_DGA2	
- XDGAMode *modelines;
- int       modecount;
-#endif
- Display  *qdisp;
-
- int i;
- static int dga_depths_init = 0;
-
- if(dga_depths_init == 0){
-
-   if((qdisp = XOpenDisplay(0))==NULL){
-     vd_printf(VD_ERR, "vo_dga: Can't open display!\n");
-     return 0;
-   }
-   if( !vo_init() ){
-    vd_printf(VD_ERR, "vo_dga: vo_init() failed!\n");
-    return 1; 
-   }
-   vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen);
- 
-   if(vo_dga_XServer_mode ==0){
-#ifndef HAVE_DGA2
-     vd_printf(VD_ERR, "vo_dga: Your X-Server is not running in a ");
-     vd_printf(VD_ERR, "resolution supported by DGA driver!\n");
-#endif     
-   }//else{
-   //  vd_printf(VD_INFO, "vo_dga: X running at: %s\n", 
-   //            vd_GetModeString(vo_dga_XServer_mode));
-   //}                                
- 
-#ifdef HAVE_DGA2
-   modelines=XDGAQueryModes(qdisp, XDefaultScreen(qdisp),&modecount);
-   if(modelines){
-     for(i=0; i< modecount; i++){
-        vd_printf(VD_DBG, "vo_dga: (%03d) depth=%d, bpp=%d, r=%08x, g=%08x, b=%08x, %d x %d\n",
-	  	i,
-		modelines[i].depth,
-		modelines[i].bitsPerPixel,
-		modelines[i].redMask,
-		modelines[i].greenMask,
-	        modelines[i].blueMask,
-	 	modelines[i].viewportWidth,
-		modelines[i].viewportHeight);			  
-        vd_EnableMode(
-		modelines[i].depth,
-		modelines[i].bitsPerPixel,
-		modelines[i].redMask,
-		modelines[i].greenMask,
-	        modelines[i].blueMask);
-     }
-     XFree(modelines);
-
-   }
-#endif
-   dga_depths_init = 1;
-   XCloseDisplay(qdisp);
-
-  if( !vo_dga_modes[1].vdm_supported && vo_dga_modes[2].vdm_supported ){
-    vo_dga_modes[1].vdm_supported = 1;
-  }
-
-  if( !vo_dga_modes[3].vdm_supported && vo_dga_modes[4].vdm_supported ){
-    vo_dga_modes[3].vdm_supported = 1;
-  }
-
-   for(i=1; i<vo_dga_mode_num; i++){
-     vd_printf(VD_INFO, "vo_dga: Mode: %s", vd_GetModeString(i));
-     if(vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth){
-       vo_dga_modes[i].vdm_supported = 0;
-       vd_printf(VD_INFO, " ...disabled by -bpp %d", vo_dbpp );
-     }
-     vd_printf(VD_INFO, "\n");
-   }
- }
-
- // TODO: respect bit for native/not native
- if( format==IMGFMT_YV12 ) return 7;
- 
- if( (format&IMGFMT_BGR_MASK) == IMGFMT_BGR && 
-     vd_ModeValid(format&0xff)) return 7;
- 
- return 0;
-}
-
-//---------------------------------------------------------
-
 static void
 uninit(void)
 {
@@ -1174,11 +1180,6 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
 
 //---------------------------------------------------------
Index: libvo/vo_directfb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_directfb.c,v
retrieving revision 1.9
diff -u -r1.9 vo_directfb.c
--- libvo/vo_directfb.c	31 Jan 2002 09:52:45 -0000	1.9
+++ libvo/vo_directfb.c	7 Feb 2002 21:50:46 -0000
@@ -235,6 +235,46 @@
      return DFENUM_OK;
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		int ret = 0x4; /* osd/sub is supported on every bpp */
+		switch(*((uint32_t*)data)){
+
+//        	preinit(NULL);
+
+//        	printf("Format query: %s\n",vo_format_name(format));
+
+// RGB mode works only if color depth is same as on screen and this driver doesn't know before init
+// so we couldn't report supported formats well
+
+// Just support those detected by preinit
+                case IMGFMT_RGB32:
+                case IMGFMT_BGR32: if (modes[3].valid) return ret|0x2;
+                                   break;
+                case IMGFMT_RGB24:
+                case IMGFMT_BGR24: if (modes[2].valid) return ret|0x2;
+                                   break;
+                case IMGFMT_RGB16:
+                case IMGFMT_BGR16:
+                case IMGFMT_RGB15:
+                case IMGFMT_BGR15: if (modes[1].valid) return ret|0x2;
+                                   break;
+                case IMGFMT_YUY2: if (!no_yuy2) return ret|0x2;
+                                   break;
+        	case IMGFMT_YV12: if (!no_yuy2) return ret|0x2; else return ret|0x1;
+                                   break;
+  // YV12 should work in all cases
+		
+		return 0;
+		}
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t preinit(const char *arg)
 {
      DFBSurfaceDescription dsc;
@@ -594,40 +634,6 @@
 return 0;
 }
 
-static uint32_t query_format(uint32_t format)
-{
-	int ret = 0x4; /* osd/sub is supported on every bpp */
-
-//        preinit(NULL);
-
-//        printf("Format query: %s\n",vo_format_name(format));
-	switch (format) {
-
-// RGB mode works only if color depth is same as on screen and this driver doesn't know before init
-// so we couldn't report supported formats well
-
-// Just support those detected by preinit
-                case IMGFMT_RGB32:
-                case IMGFMT_BGR32: if (modes[3].valid) return ret|0x2;
-                                   break;
-                case IMGFMT_RGB24:
-                case IMGFMT_BGR24: if (modes[2].valid) return ret|0x2;
-                                   break;
-                case IMGFMT_RGB16:
-                case IMGFMT_BGR16:
-                case IMGFMT_RGB15:
-                case IMGFMT_BGR15: if (modes[1].valid) return ret|0x2;
-                                   break;
-                case IMGFMT_YUY2: if (!no_yuy2) return ret|0x2;
-                                   break;
-        	case IMGFMT_YV12: if (!no_yuy2) return ret|0x2; else return ret|0x1;
-                                   break;
-  // YV12 should work in all cases
- 	}
-
-	return 0;
-}
-
 static const vo_info_t *get_info(void)
 {
 	return &vo_info;
@@ -886,9 +892,4 @@
 //  dfb->Release (dfb);
 //  preinit_done=0;
 
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr3.c,v
retrieving revision 1.44
diff -u -r1.44 vo_dxr3.c
--- libvo/vo_dxr3.c	3 Feb 2002 23:13:56 -0000	1.44
+++ libvo/vo_dxr3.c	7 Feb 2002 21:50:46 -0000
@@ -92,6 +92,41 @@
 	""
 };
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	uint32_t flag = 0;
+	switch (request) {
+	case VOCTRL_RESET:
+		fsync(fd_video);
+		break;
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_MPEGPES:
+			/* Hardware accelerated | Hardware supports subpics */
+			flag = 0x2 | 0x8;
+			break;
+#ifdef USE_LIBAVCODEC
+		case IMGFMT_YV12:
+		case IMGFMT_YUY2:
+		case IMGFMT_RGB24:
+		case IMGFMT_BGR24:
+			/* Conversion needed | OSD Supported */
+			flag = 0x1 | 0x4;
+			break;
+		default:
+			printf("VO: [dxr3] Format unsupported, mail dholm at iname.com\n");
+#else
+		default:
+			printf("VO: [dxr3] You have enable libavcodec support (Read DOCS/codecs.html)!\n");
+#endif
+		}
+		return (flag | 0x100);
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t config(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
 	int tmp1, tmp2;
@@ -293,8 +328,12 @@
 		/*ioval = EM8300_SUBDEVICE_VIDEO;
 		ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
 		*/
+		ioval = (90000.0 / vo_fps) / 2;
+		ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval);
 		fsync(fd_video);
 	}
+	ioval = vo_pts / 2;
+	ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &ioval);
 #ifdef USE_LIBAVCODEC
 	if (img_format == IMGFMT_YV12) {
 		int out_size = avcodec_encode_video(avc_context, avc_outbuf, avc_outbuf_size, &avc_picture);
@@ -352,36 +391,6 @@
 	return -1;
 }
 
-static uint32_t query_format(uint32_t format)
-{
-	uint32_t flag = 0;
-	
-	if (format == IMGFMT_MPEGPES) {
-		/* Hardware accelerated | Hardware supports subpics */
-		flag = 0x2 | 0x8;
-#ifdef USE_LIBAVCODEC
-	} else if (format == IMGFMT_YV12) {
-		/* Conversion needed | OSD Supported */
-		flag = 0x1 | 0x4;
-	} else if (format == IMGFMT_YUY2) {
-		/* Conversion needed | OSD Supported */
-		flag = 0x1 | 0x4;
-	} else if (format == IMGFMT_RGB24) {
-		/* Conversion needed | OSD Supported */
-		flag = 0x1 | 0x4;
-	} else if (format == IMGFMT_BGR24) {
-		/* Conversion needed | OSD Supported */
-		flag = 0x1 | 0x4;
-	} else {
-		printf("VO: [dxr3] Format unsupported, mail dholm at iname.com\n");
-#else
-	} else {
-		printf("VO: [dxr3] You have enable libavcodec support (Read DOCS/codecs.html)!\n");
-#endif
-	}
-	return flag;
-}
-
 static void uninit(void)
 {
 	printf("VO: [dxr3] Uninitializing\n");
@@ -483,9 +492,4 @@
 #endif
 	
 	return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-	memset(vaa, 0, sizeof(vo_vaa_t));
 }
Index: libvo/vo_fbdev.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v
retrieving revision 1.59
diff -u -r1.59 vo_fbdev.c
--- libvo/vo_fbdev.c	31 Jan 2002 10:23:39 -0000	1.59
+++ libvo/vo_fbdev.c	7 Feb 2002 21:50:46 -0000
@@ -896,6 +896,34 @@
 	fflush(vt_fp);
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		uint32_t format = *((uint32_t*)data);
+		int ret = 0x4; /* osd/sub is supported on every bpp */
+
+		if (!fb_preinit())
+			return 0;
+		if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) {
+			int bpp = format & 0xff;
+
+			if (bpp == fb_bpp)
+				return ret|0x2;
+			else if (bpp == 15 && fb_bpp == 16)
+				return ret|0x1;
+			else if (bpp == 24 && fb_bpp == 32)
+				return ret|0x1;
+		}
+		if (format == IMGFMT_YV12)
+			return ret|0x1;
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
 		uint32_t d_height, uint32_t fullscreen, char *title,
 		uint32_t format,const vo_tune_info_t *info)
@@ -1156,27 +1184,6 @@
 	return 0;
 }
 
-static uint32_t query_format(uint32_t format)
-{
-	int ret = 0x4; /* osd/sub is supported on every bpp */
-
-	if (!fb_preinit())
-		return 0;
-	if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) {
-		int bpp = format & 0xff;
-
-		if (bpp == fb_bpp)
-			return ret|0x2;
-		else if (bpp == 15 && fb_bpp == 16)
-			return ret|0x1;
-		else if (bpp == 24 && fb_bpp == 32)
-			return ret|0x1;
-	}
-	if (format == IMGFMT_YV12)
-		return ret|0x1;
-	return 0;
-}
-
 static const vo_info_t *get_info(void)
 {
 	return &vo_info;
@@ -1337,9 +1344,4 @@
 	printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
 #endif
     if(!pre_init_err) return (pre_init_err=(fb_preinit()?0:-1));
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_fsdga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_fsdga.c,v
retrieving revision 1.8
diff -u -r1.8 vo_fsdga.c
--- libvo/vo_fsdga.c	31 Jan 2002 11:45:25 -0000	1.8
+++ libvo/vo_fsdga.c	7 Feb 2002 21:50:46 -0000
@@ -148,6 +148,25 @@
      // dst <= edx
      // num <= ecx  
  
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		uint32_t format = *((uint32_t*)data);
+		printf("vo_dga: query_format\n");
+
+		if( !vo_init() ) return 0; // Can't open X11
+		printf("Format: %lx\n", (unsigned long) format);
+
+		if( format==IMGFMT_YV12 ) return 1;
+		if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR && 
+		( format&0xFF )==vo_depthonscreen ) return 1;
+		return 0;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t draw_frame( uint8_t *src[] ){
 
   int vp_skip = vo_dga_vp_skip;
@@ -273,20 +292,6 @@
 static const vo_info_t* get_info( void )
 { return &vo_info; }
 
-static uint32_t query_format( uint32_t format )
-{
- printf("vo_dga: query_format\n");
-
- if( !vo_init() ) return 0; // Can't open X11
- printf("Format: %lx\n", (unsigned long) format);
-
- if( format==IMGFMT_YV12 ) return 1;
- if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR && 
-     ( format&0xFF )==vo_depthonscreen ) return 1;
- return 0;
-}
-
-
 static void
 uninit(void)
 {
@@ -459,9 +464,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_ggi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_ggi.c,v
retrieving revision 1.13
diff -u -r1.13 vo_ggi.c
--- libvo/vo_ggi.c	31 Jan 2002 09:52:45 -0000	1.13
+++ libvo/vo_ggi.c	7 Feb 2002 21:50:47 -0000
@@ -421,6 +421,37 @@
     return &vo_info;
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+		case IMGFMT_I420:
+		case IMGFMT_IYUV:
+/*		case IMGFMT_YUY2:
+		case IMGFMT_YVYU:
+		case IMGFMT_UYVY:*/
+			return(0x6);
+		case IMGFMT_RGB8:
+		case IMGFMT_RGB15:
+		case IMGFMT_RGB16:
+		case IMGFMT_RGB24:
+		case IMGFMT_RGB32:
+		case IMGFMT_BGR8:
+		case IMGFMT_BGR15:
+		case IMGFMT_BGR16:
+		case IMGFMT_BGR24:
+		case IMGFMT_BGR32:
+			return(0x5);
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t draw_frame(uint8_t *src[])
 {
     if (ggi_conf.need_acquire)
@@ -574,32 +605,6 @@
     return(0);
 }
 
-static uint32_t query_format(uint32_t format)
-{
-    switch(format)
-    {
-	case IMGFMT_YV12:
-	case IMGFMT_I420:
-	case IMGFMT_IYUV:
-/*	case IMGFMT_YUY2:
-	case IMGFMT_YVYU:
-	case IMGFMT_UYVY:*/
-	    return(0x6);
-	case IMGFMT_RGB8:
-	case IMGFMT_RGB15:
-	case IMGFMT_RGB16:
-        case IMGFMT_RGB24:
-	case IMGFMT_RGB32:
-	case IMGFMT_BGR8:
-	case IMGFMT_BGR15:
-	case IMGFMT_BGR16:
-	case IMGFMT_BGR24:
-	case IMGFMT_BGR32:
-	    return(0x5);
-    }
-    return(0);
-}
-
 static void uninit(void)
 {
     ggiResourceRelease(ggi_conf.buffer->resource);
@@ -769,9 +774,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.20
diff -u -r1.20 vo_gl.c
--- libvo/vo_gl.c	1 Feb 2002 02:49:04 -0000	1.20
+++ libvo/vo_gl.c	7 Feb 2002 21:50:47 -0000
@@ -92,6 +92,23 @@
   glLoadIdentity();
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+		case IMGFMT_RGB|24:
+		case IMGFMT_BGR|24:
+		return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 /* connect to server, create and map window,
  * allocate colors and (shared) memory
  */
@@ -448,19 +465,6 @@
 	return draw_frame_x11_bgr(src);
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-    case IMGFMT_RGB|24:
-    case IMGFMT_BGR|24:
-        return 1;
-    }
-    return 0;
-}
-
-
 static void
 uninit(void)
 {
@@ -472,9 +476,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.13
diff -u -r1.13 vo_gl2.c
--- libvo/vo_gl2.c	31 Jan 2002 11:46:46 -0000	1.13
+++ libvo/vo_gl2.c	7 Feb 2002 21:50:47 -0000
@@ -1075,19 +1075,6 @@
     return res;
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-    case IMGFMT_RGB|24:
-    case IMGFMT_BGR|24:
-        return 1;
-    }
-    return 0;
-}
-
-
 static void
 uninit(void)
 {
@@ -1101,7 +1088,19 @@
   return 0;
 }
 
-static void query_vaa(vo_vaa_t *vaa)
+uint32_t
+control(uint32_t request, void *data, ...)
 {
-  memset(vaa,0,sizeof(vo_vaa_t));
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+		case IMGFMT_RGB|24:
+		case IMGFMT_BGR|24:
+			return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
 }
Index: libvo/vo_md5.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_md5.c,v
retrieving revision 1.9
diff -u -r1.9 vo_md5.c
--- libvo/vo_md5.c	1 Feb 2002 02:49:04 -0000	1.9
+++ libvo/vo_md5.c	7 Feb 2002 21:50:47 -0000
@@ -84,13 +84,6 @@
     return 0;
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    return video_out_pgm.query_format(format);
-}
-
-
 static void
 uninit(void)
 {
@@ -108,7 +101,12 @@
   return 0;
 }
 
-static void query_vaa(vo_vaa_t *vaa)
+uint32_t
+control(uint32_t request, void *data, ...)
 {
-  memset(vaa,0,sizeof(vo_vaa_t));
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		return video_out_pgm.control(VOCTRL_QUERY_FORMAT, data);
+	}
+	return VO_NOTIMPL;
 }
Index: libvo/vo_mga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_mga.c,v
retrieving revision 1.22
diff -u -r1.22 vo_mga.c
--- libvo/vo_mga.c	1 Feb 2002 02:43:01 -0000	1.22
+++ libvo/vo_mga.c	7 Feb 2002 21:50:47 -0000
@@ -54,6 +54,14 @@
 
 #include "mga_common.c"
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
@@ -149,9 +157,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_mpegpes.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_mpegpes.c,v
retrieving revision 1.18
diff -u -r1.18 vo_mpegpes.c
--- libvo/vo_mpegpes.c	31 Jan 2002 09:52:45 -0000	1.18
+++ libvo/vo_mpegpes.c	7 Feb 2002 21:50:47 -0000
@@ -84,6 +84,23 @@
 	""
 };
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_MPEGPES: return 1|256;
+#ifdef USE_LIBAVCODEC
+		case IMGFMT_YV12: return 1|256;
+#endif
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t
 config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
@@ -483,16 +500,6 @@
 }
 
 
-static uint32_t
-query_format(uint32_t format)
-{
-    if(format==IMGFMT_MPEGPES) return 1|256;
-#ifdef USE_LIBAVCODEC
-    if(format==IMGFMT_YV12) return 1|256;
-#endif
-    return 0;
-}
-
 static void
 uninit(void)
 {
@@ -514,9 +521,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_null.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_null.c,v
retrieving revision 1.5
diff -u -r1.5 vo_null.c
--- libvo/vo_null.c	31 Jan 2002 09:52:45 -0000	1.5
+++ libvo/vo_null.c	7 Feb 2002 21:50:47 -0000
@@ -38,6 +38,17 @@
 
 static uint32_t image_width, image_height;
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		return 1;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 //static uint32_t
 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
 //draw_slice(uint8_t *src[], uint32_t slice_num)
@@ -61,12 +72,6 @@
 }
 
 static uint32_t
-query_format(uint32_t format)
-{
-    return 1;
-}
-
-static uint32_t
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
 	image_width = width;
@@ -93,9 +98,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_odivx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_odivx.c,v
retrieving revision 1.9
diff -u -r1.9 vo_odivx.c
--- libvo/vo_odivx.c	31 Jan 2002 09:52:45 -0000	1.9
+++ libvo/vo_odivx.c	7 Feb 2002 21:50:47 -0000
@@ -39,6 +39,28 @@
 extern char* encode_name;
 extern char* encode_index_name;
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_VAA:
+		vo_vaa_t *vaa = (vo_vaa_t*)data;
+		memset(vaa,0,sizeof(vo_vaa_t));
+		return VO_NOTIMPL;
+		break;
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+		case IMGFMT_YUY2:
+//		case IMGFMT_BGR|24:
+		return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num)
 static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
 {
@@ -184,18 +206,6 @@
 
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-    case IMGFMT_YUY2:
-//    case IMGFMT_BGR|24:
-        return 1;
-    }
-    return 0;
-}
-
 extern int encode_bitrate;
 
 static uint32_t
@@ -268,9 +278,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_pgm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_pgm.c,v
retrieving revision 1.9
diff -u -r1.9 vo_pgm.c
--- libvo/vo_pgm.c	31 Jan 2002 09:52:45 -0000	1.9
+++ libvo/vo_pgm.c	7 Feb 2002 21:50:47 -0000
@@ -40,6 +40,24 @@
 
 char vo_pgm_filename[24];
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12: return 1;
+//		case IMGFMT_YV12:
+//		case IMGFMT_RGB|24:
+//		case IMGFMT_BGR|24:
+//			return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
@@ -111,19 +129,6 @@
     return 0;
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    if(format==IMGFMT_YV12) return 1;
-//    switch(format){
-//    case IMGFMT_YV12:
-//    case IMGFMT_RGB|24:
-//    case IMGFMT_BGR|24:
-//        return 1;
-//    }
-    return 0;
-}
-
 static void
 uninit(void)
 {
@@ -138,9 +143,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_png.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_png.c,v
retrieving revision 1.11
diff -u -r1.11 vo_png.c
--- libvo/vo_png.c	31 Jan 2002 09:52:45 -0000	1.11
+++ libvo/vo_png.c	7 Feb 2002 21:50:47 -0000
@@ -62,6 +62,25 @@
     vo_draw_alpha_rgb24(w, h, src, srca, stride, image_data + 3 * (y0 * image_width + x0), 3 * image_width);
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_IYUV:
+		case IMGFMT_I420:
+		case IMGFMT_YV12:
+		case IMGFMT_RGB|24:
+		case IMGFMT_BGR|24:
+			return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
@@ -300,20 +319,6 @@
   return 0;
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_IYUV:
-    case IMGFMT_I420:
-    case IMGFMT_YV12:
-    case IMGFMT_RGB|24:
-    case IMGFMT_BGR|24:
-        return 1;
-    }
-    return 0;
-}
-
 static void
 uninit(void)
 {
@@ -328,9 +333,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_sdl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_sdl.c,v
retrieving revision 1.64
diff -u -r1.64 vo_sdl.c
--- libvo/vo_sdl.c	4 Feb 2002 19:14:40 -0000	1.64
+++ libvo/vo_sdl.c	7 Feb 2002 21:50:48 -0000
@@ -608,6 +608,34 @@
  *   returns : non-zero on success, zero on error.
  **/
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+		case IMGFMT_I420:
+		case IMGFMT_IYUV:
+		case IMGFMT_YUY2:
+		case IMGFMT_UYVY:
+		case IMGFMT_YVYU:
+			return 0x6; // hw supported & osd
+		case IMGFMT_RGB15:
+		case IMGFMT_BGR15:
+		case IMGFMT_RGB16:
+		case IMGFMT_BGR16:
+		case IMGFMT_RGB24:
+		case IMGFMT_BGR24:
+		case IMGFMT_RGB32:
+		case IMGFMT_BGR32:
+			return 0x5; // hw supported w/conversion & osd
+		}
+		return 0;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format,const vo_tune_info_t *info)
 //static int sdl_setup (int width, int height)
@@ -1226,30 +1254,6 @@
 	}	
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-    case IMGFMT_I420:
-    case IMGFMT_IYUV:
-    case IMGFMT_YUY2:
-    case IMGFMT_UYVY:
-    case IMGFMT_YVYU:
-    	return 0x6; // hw supported & osd
-    case IMGFMT_RGB15:
-    case IMGFMT_BGR15:
-    case IMGFMT_RGB16:
-    case IMGFMT_BGR16:
-    case IMGFMT_RGB24:
-    case IMGFMT_BGR24:
-    case IMGFMT_RGB32:
-    case IMGFMT_BGR32:
-        return 0x5; // hw supported w/conversion & osd
-    }
-    return 0;
-}
-
 static const vo_info_t*
 get_info(void)
 {
@@ -1275,9 +1279,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_svga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_svga.c,v
retrieving revision 1.41
diff -u -r1.41 vo_svga.c
--- libvo/vo_svga.c	31 Jan 2002 09:52:45 -0000	1.41
+++ libvo/vo_svga.c	7 Feb 2002 21:50:48 -0000
@@ -401,55 +401,63 @@
   return (0);
 }
 
-static uint32_t query_format(uint32_t format) {
-  uint32_t res = 0;
-
-  if (!checked) {
-    if (checksupportedmodes()) // Looking for available video modes
-      return(0);
-  }
-
-  // if (vo_dbpp) => There is NO conversion!!!
-  if (vo_dbpp) {
-    if (format == IMGFMT_YV12) return (1);
-    switch (vo_dbpp) {
-      case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32))
-                 return ((bpp_avail & BPP_32) ? 1 : 0);
-	       break;
-      case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24))
-                 return ((bpp_avail & BPP_24) ? 1 : 0);
-	       break;
-      case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16))
-                 return ((bpp_avail & BPP_16) ? 1 : 0);
-	       break;
-      case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15))
-                 return ((bpp_avail & BPP_15) ? 1 : 0);
-	       break;
-    }
-  } else {
-      switch (format) {
-        case IMGFMT_RGB32: 
-        case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break;
-        case IMGFMT_RGB24: 
-        case IMGFMT_BGR24: {
-          res = (bpp_avail & BPP_24) ? 1 : 0;
-          if (!res)
-            res = (bpp_avail & BPP_32) ? 1 : 0;
-          return (res);
-        } break;
-        case IMGFMT_RGB16: 
-        case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break;
-        case IMGFMT_RGB15: 
-        case IMGFMT_BGR15: {
-          res = (bpp_avail & BPP_15) ? 1 : 0;
-          if (!res)
-            res = (bpp_avail & BPP_16) ? 1 : 0;
-          return (res);
-        } break;
-        case IMGFMT_YV12: return (1); break;
-      }
-    }
-  return (0);
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		uint32_t format = *((uint32_t*)data);
+		uint32_t res = 0;
+
+		if (!checked) {
+			if (checksupportedmodes()) // Looking for available video modes
+			return(0);
+		}
+
+//		if (vo_dbpp) => There is NO conversion!!!
+		if (vo_dbpp) {
+			if (format == IMGFMT_YV12) return (1);
+			switch (vo_dbpp) {
+			case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32))
+				return ((bpp_avail & BPP_32) ? 1 : 0);
+				break;
+			case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24))
+				return ((bpp_avail & BPP_24) ? 1 : 0);
+				break;
+			case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16))
+				return ((bpp_avail & BPP_16) ? 1 : 0);
+				break;
+			case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15))
+				return ((bpp_avail & BPP_15) ? 1 : 0);
+				break;
+			}
+		} else {
+			switch (format) {
+			case IMGFMT_RGB32: 
+			case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break;
+			case IMGFMT_RGB24: 
+			case IMGFMT_BGR24: {
+			res = (bpp_avail & BPP_24) ? 1 : 0;
+			if (!res)
+			res = (bpp_avail & BPP_32) ? 1 : 0;
+			return (res);
+			} break;
+			case IMGFMT_RGB16: 
+			case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break;
+			case IMGFMT_RGB15: 
+			case IMGFMT_BGR15: {
+			res = (bpp_avail & BPP_15) ? 1 : 0;
+			if (!res)
+			res = (bpp_avail & BPP_16) ? 1 : 0;
+			return (res);
+			} break;
+			case IMGFMT_YV12: return (1); break;
+			default:
+				return (0);
+			break;
+		}
+	}
+	return VO_NOTIMPL;
 }
 
 static const vo_info_t* get_info(void) {
@@ -573,9 +581,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_syncfb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_syncfb.c,v
retrieving revision 1.9
diff -u -r1.9 vo_syncfb.c
--- libvo/vo_syncfb.c	31 Jan 2002 09:52:45 -0000	1.9
+++ libvo/vo_syncfb.c	7 Feb 2002 21:50:48 -0000
@@ -247,6 +247,23 @@
 	}
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+//		case IMGFMT_RGB|24:
+//		case IMGFMT_BGR|24:
+			return 1;
+		}
+		return 0;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 //static uint32_t draw_slice(uint8_t *src[], uint32_t slice_num)
 static uint32_t
 draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
@@ -334,18 +351,6 @@
 	return 0;
 }
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-//    case IMGFMT_RGB|24:
-//    case IMGFMT_BGR|24:
-        return 1;
-    }
-    return 0;
-}
-
 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
 	uint_32 frame_size;
@@ -451,9 +456,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_tdfxfb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_tdfxfb.c,v
retrieving revision 1.5
diff -u -r1.5 vo_tdfxfb.c
--- libvo/vo_tdfxfb.c	31 Jan 2002 09:52:45 -0000	1.5
+++ libvo/vo_tdfxfb.c	7 Feb 2002 21:50:48 -0000
@@ -297,6 +297,27 @@
 extern void **our_out_buffer;
 #endif
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YV12:
+			return 4|2; // 4|2;
+		case IMGFMT_YUY2:
+			if (verbose) printf("query_format: IMGFMT_YUY2\n");
+			return 4|2; //4|2;
+		case IMGFMT_BGR|16:
+		if (verbose) printf("query_format: IMGFMT_BGR|16\n");
+		return 4|2; // 4|2;	/* osd + ????? */
+		}
+		return VO_FALSE;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t 
 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height,
 		uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info) 
@@ -740,22 +761,6 @@
 
 /*- ----------------------------------------------------------------- -*/
 
-static uint32_t
-query_format(uint32_t format)
-{
-    switch(format){
-    case IMGFMT_YV12:
-        return 4|2; // 4|2;
-    case IMGFMT_YUY2:
-		if (verbose) printf("query_format: IMGFMT_YUY2\n");
-		return 4|2; //4|2;
-	case IMGFMT_BGR|16:
-		if (verbose) printf("query_format: IMGFMT_BGR|16\n");
-		return 4|2; // 4|2;	/* osd + ????? */
-    }
-    return 0;
-}
-
 static void
 uninit(void)
 {
@@ -826,9 +831,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_vesa.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_vesa.c,v
retrieving revision 1.65
diff -u -r1.65 vo_vesa.c
--- libvo/vo_vesa.c	7 Feb 2002 19:37:09 -0000	1.65
+++ libvo/vo_vesa.c	7 Feb 2002 21:50:48 -0000
@@ -250,6 +250,19 @@
    }
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		if(verbose > 2)
+			printf("vo_vesa: query_format was called: %x (%s)\n",*((uint32_t*)data),vo_format_name(*((uint32_t*)data)));
+		return 1; /* due new SwScale code */
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 /* is called for yuv only */
 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
 {
@@ -434,13 +447,6 @@
    return flags;
 }
 
-static uint32_t query_format(uint32_t format)
-{
-    if(verbose > 2)
-        printf("vo_vesa: query_format was called: %x (%s)\n",format,vo_format_name(format));
-    return 1; /* due new SwScale code */
-}
-
 static void paintBkGnd( void )
 {
     int x_res = video_mode_info.XResolution;
@@ -942,9 +948,4 @@
   if(verbose > 2)
         printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
   return pre_init_err;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_x11.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_x11.c,v
retrieving revision 1.58
diff -u -r1.58 vo_x11.c
--- libvo/vo_x11.c	6 Feb 2002 20:52:14 -0000	1.58
+++ libvo/vo_x11.c	7 Feb 2002 21:50:48 -0000
@@ -240,6 +240,39 @@
   }
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	uint32_t format;
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		format = *((uint32_t*)data);
+		if( !vo_init() ) return 0; // Can't open X11
+
+		if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR ){
+			int bpp=format&0xFF;
+			if( bpp==vo_depthonscreen ) return 1;
+			if( bpp==15 && vo_depthonscreen==16) return 1; // built-in conversion
+			if( bpp==24 && vo_depthonscreen==32) return 1; // built-in conversion
+		}
+
+		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;
+		}
+		return VO_FALSE;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t config( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d_height,uint32_t flags,char *title,uint32_t format,const vo_tune_info_t *info)
 {
 // int screen;
@@ -580,32 +613,6 @@
   return 0;
 }
 
-static uint32_t query_format( uint32_t format )
-{
- if( !vo_init() ) return 0; // Can't open X11
-
- if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR ){
-   int bpp=format&0xFF;
-   if( bpp==vo_depthonscreen ) return 1;
-   if( bpp==15 && vo_depthonscreen==16) return 1; // built-in conversion
-   if( bpp==24 && vo_depthonscreen==32) return 1; // built-in conversion
- }
-
- 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;
-  }
- return 0;
-}
-
-
 static void
 uninit(void)
 {
@@ -623,9 +630,3 @@
 {
   return 0;
 }
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
-}
-
Index: libvo/vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.43
diff -u -r1.43 vo_xmga.c
--- libvo/vo_xmga.c	7 Feb 2002 16:15:08 -0000	1.43
+++ libvo/vo_xmga.c	7 Feb 2002 21:50:49 -0000
@@ -203,6 +203,14 @@
    vo_mga_flip_page();
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t* info)
 {
  char                 * frame_mem;
@@ -398,9 +406,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.51
diff -u -r1.51 vo_xv.c
--- libvo/vo_xv.c	31 Jan 2002 09:52:45 -0000	1.51
+++ libvo/vo_xv.c	7 Feb 2002 21:50:49 -0000
@@ -126,7 +126,7 @@
      {
 	for (i = 0; i < howmany && attributes; i++)
         {
-            if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS"
))
+            if (attributes[i].flags & XvSettable && !strcmp(attributes[i].name,"XV_SET_DEFAULTS"))
             {
 		was_reset = 1;
 		if(verbose > 1) printf("vo_xv: reset gamma correction\n");
@@ -304,6 +304,27 @@
   __xv_set_video_eq(&info,1);
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		// umm, this is a kludge, we need to ask the server.. (see init function above)
+		return 1;
+		/*
+		switch(format)
+		{
+		case IMGFMT_YV12:
+		case IMGFMT_YUY2: 
+			return VO_TRUE;
+		}
+		return VO_FALSE;
+		*/
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 /*
  * connect to server, create and map window,
  * allocate colors and (shared) memory
@@ -725,22 +746,6 @@
   return 0;
 }
 
-static uint32_t query_format(uint32_t format)
-{
-
-// umm, this is a kludge, we need to ask the server.. (see init function above)
-    return 1;
-/*
- switch(format)
-  {
-   case IMGFMT_YV12:
-   case IMGFMT_YUY2: 
-       return 1;
-  }
- return 0;
-*/
-}
-
 static void uninit(void) 
 {
  int i;
@@ -761,11 +766,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
-  vaa->get_video_eq = xv_get_video_eq;
-  vaa->set_video_eq = xv_set_video_eq;
 }
Index: libvo/vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.18
diff -u -r1.18 vo_xvidix.c
--- libvo/vo_xvidix.c	7 Feb 2002 17:42:37 -0000	1.18
+++ libvo/vo_xvidix.c	7 Feb 2002 21:50:49 -0000
@@ -184,6 +184,17 @@
     return;
 }
 
+uint32_t
+control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		return(vidix_query_fourcc(*((uint32_t*)data)));
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 /* connect to server, create and map window,
  * allocate colors and (shared) memory
  */
@@ -434,11 +445,6 @@
     return(0);
 }
 
-static uint32_t query_format(uint32_t format)
-{
-  return(vidix_query_fourcc(format));
-}
-
 static void uninit(void)
 {
     vidix_term();
@@ -461,9 +467,4 @@
 	return(1);
 
     return(0);
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vo_zr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_zr.c,v
retrieving revision 1.7
diff -u -r1.7 vo_zr.c
--- libvo/vo_zr.c	31 Jan 2002 09:52:45 -0000	1.7
+++ libvo/vo_zr.c	7 Feb 2002 21:50:49 -0000
@@ -194,6 +194,21 @@
 	close(vdes);
 }
 
+uint32_t control(uint32_t request, void *data, ...)
+{
+	switch (request) {
+	case VOCTRL_QUERY_FORMAT:
+		switch(*((uint32_t*)data)){
+		case IMGFMT_YUY2:
+		case IMGFMT_YV12:
+			return VO_TRUE;
+		}
+		return VO_FALSE;
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, 
 	uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
 {
@@ -428,12 +443,6 @@
 	return 0;
 }
 
-static uint32_t query_format(uint32_t format) {
-	if(format==IMGFMT_YV12) return 1;
-	if(format==IMGFMT_YUY2) return 1;
-	return 0;
-}
-
 static void uninit(void) {
 	uninit_zoran();
 }
@@ -632,9 +641,4 @@
 static uint32_t preinit(const char *arg)
 {
   return 0;
-}
-
-static void query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
 }
Index: libvo/vosub_vidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vosub_vidix.c,v
retrieving revision 1.26
diff -u -r1.26 vosub_vidix.c
--- libvo/vosub_vidix.c	5 Feb 2002 18:54:41 -0000	1.26
+++ libvo/vosub_vidix.c	7 Feb 2002 21:50:49 -0000
@@ -52,18 +52,6 @@
 static int  vidix_set_oem_fx(const vidix_oem_fx_t *info);
 static int  vidix_set_deint(const vidix_deinterlace_t *info);
 
-static void vidix_query_vaa(vo_vaa_t *vaa)
-{
-  memset(vaa,0,sizeof(vo_vaa_t));
-  vaa->query_bes_da=vidix_get_bes_da;
-  vaa->get_video_eq=vidix_get_video_eq;
-  vaa->set_video_eq=vidix_set_video_eq;
-  vaa->get_num_fx=vidix_get_num_fx;
-  vaa->get_oem_fx=vidix_get_oem_fx;
-  vaa->set_oem_fx=vidix_set_oem_fx;
-  vaa->set_deint=vidix_set_deint;
-}
-
 extern int vo_gamma_brightness;
 extern int vo_gamma_saturation;
 extern int vo_gamma_contrast;
@@ -627,6 +615,29 @@
 	return 0;
 }
 
+uint32_t
+vidix_control(uint32_t request, void *data, ...)
+{
+	vo_vaa_t *vaa;
+	switch (request) {
+	case VOCTRL_QUERY_VAA:
+		vaa = (vo_vaa_t*)data;
+		memset(vaa,0,sizeof(vo_vaa_t));
+		vaa->query_bes_da=vidix_get_bes_da;
+		vaa->get_video_eq=vidix_get_video_eq;
+		vaa->set_video_eq=vidix_set_video_eq;
+		vaa->get_num_fx=vidix_get_num_fx;
+		vaa->get_oem_fx=vidix_get_oem_fx;
+		vaa->set_oem_fx=vidix_set_oem_fx;
+		vaa->set_deint=vidix_set_deint;
+		break;
+	case VOCTRL_QUERY_FORMAT:
+		return vidix_query_fourcc(*((uint32_t*)data));
+		break;
+	}
+	return VO_NOTIMPL;
+}
+
 int vidix_preinit(const char *drvname,void *server)
 {
   int err;
@@ -656,8 +667,7 @@
 	((vo_functions_t *)server)->draw_frame=vidix_draw_frame;
 	((vo_functions_t *)server)->flip_page=vidix_flip_page;
 	((vo_functions_t *)server)->draw_osd=vidix_draw_osd;
-	((vo_functions_t *)server)->query_format=vidix_query_fourcc;
-	((vo_functions_t *)server)->query_vaa=vidix_query_vaa;
+	((vo_functions_t *)server)->control=vidix_control;
 	vo_server = server;
 	return 0;
 }
? libavcodec/.depend
? libavcodec/README


More information about the MPlayer-dev-eng mailing list