changeset 6550:991e03ca5ceb

added OSD support for yvu9/y800, corrected query_format \(added flag VFCAP_OSD\), fixed multifile support \(no more control infinite loop and destroying old window\) and some cosmetics
author alex
date Mon, 24 Jun 2002 11:51:55 +0000
parents e2e1d6e1cf0a
children c930dffac92c
files libvo/vo_xvidix.c libvo/vosub_vidix.c
diffstat 2 files changed, 38 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xvidix.c	Mon Jun 24 11:07:58 2002 +0000
+++ b/libvo/vo_xvidix.c	Mon Jun 24 11:51:55 2002 +0000
@@ -64,7 +64,6 @@
 static uint32_t image_width;
 static uint32_t image_height;
 static uint32_t image_format;
-static uint32_t image_depth;
 
 /* Window parameters */
 static uint32_t window_x, window_y;
@@ -174,7 +173,7 @@
 	vidix_start();
     }
     
-    mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
+    mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
 	vo_dx, vo_dy, window_width, window_height);
 
     /* mDrawColorKey: */
@@ -215,42 +214,6 @@
     image_format = format;
     vo_mouse_autohide=1;
 
-    if (IMGFMT_IS_RGB(format))
-    {
-	image_depth = IMGFMT_RGB_DEPTH(format);
-    }
-    else
-    if (IMGFMT_IS_BGR(format))
-    {
-	image_depth = IMGFMT_BGR_DEPTH(format);
-    }
-    else
-    switch(format)
-    {
-	case IMGFMT_IYUV:
-	case IMGFMT_I420:
-	case IMGFMT_YV12:
-	    image_depth = 12;
-	    break;
-	case IMGFMT_UYVY:
-	case IMGFMT_YUY2:
-	    image_depth = 16;
-	    break;
-	case IMGFMT_YVU9:
-	case IMGFMT_IF09:
-	    image_depth = 9;
-	    break;
-	case IMGFMT_Y800:
-	case IMGFMT_Y8:
-	    image_depth = 8;
-	    break;
-	default:
-	    image_depth = 16;
-	    mp_msg(MSGT_VO, MSGL_FATAL, "Unknown image format: %s\n",
-		vo_format_name(format));
-	    break;
-    }
-
     if (!vo_init())
         return(-1);
 
@@ -297,6 +260,9 @@
 {
 #endif
 
+    /* destroy window before creating one */
+    if (vo_window) XDestroyWindow(mDisplay, vo_window);
+
 #ifdef X11_FULLSCREEN
     if ( ( flags&1 )||(flags & 0x04) ) aspect(&d_width, &d_height, A_ZOOM);
 #endif
@@ -355,9 +321,6 @@
 }
 #endif
 
-    mp_msg(MSGT_VO, MSGL_INFO, "[xvidix] image properties: %dx%d depth: %d\n",
-	image_width, image_height, image_depth);
-	
     if ( ( !WinID )&&( flags&1 ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
 
     if (vidix_grkey_support())
@@ -425,14 +388,14 @@
     UNUSED(x);
     UNUSED(y);
     mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_slice!\n");
-    return(0);
+    return(-1);
 }
 
 static uint32_t draw_frame(uint8_t *src[])
 {
     UNUSED(src);
     mp_msg(MSGT_VO, MSGL_FATAL, "[xvidix] error: didn't used vidix draw_frame!\n");
-    return(0);
+    return(-1);
 }
 
 static uint32_t query_format(uint32_t format)
@@ -486,6 +449,6 @@
         }
       return VO_TRUE;
   }
-  vidix_control(request, data);
+  return vidix_control(request, data);
 //  return VO_NOTIMPL;
 }
--- a/libvo/vosub_vidix.c	Mon Jun 24 11:07:58 2002 +0000
+++ b/libvo/vosub_vidix.c	Mon Jun 24 11:51:55 2002 +0000
@@ -29,6 +29,7 @@
 #include "fastmemcpy.h"
 #include "osd.h"
 #include "video_out.h"
+#include "sub.h"
 
 #include "../libmpcodecs/vfcap.h"
 #include "../libmpcodecs/mp_image.h"
@@ -142,7 +143,7 @@
   if(verbose > 1) printf("vosub_vidix: vidix_term() was called\n");
 	vidix_stop();
 	vdlClose(vidix_handler);
-  ((vo_functions_t *)vo_server)->control=server_control;
+//  ((vo_functions_t *)vo_server)->control=server_control;
 }
 
 static uint32_t vidix_draw_slice_swYV12(uint8_t *image[], int stride[], int w,int h,int x,int y)
@@ -215,6 +216,7 @@
 		}
 		return 0;
     }
+    return -1;
 }
 
 static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
@@ -260,12 +262,14 @@
 		}
 		return 0;
     }
+    return -1;
 }
 
 static uint32_t vidix_draw_slice_410_fast(uint8_t *image[], int stride[], int w, int h, int x, int y)
 {
     uint8_t *src;
     uint8_t *dest;
+
     UNUSED(w);
     UNUSED(stride);
     dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
@@ -297,6 +301,7 @@
     uint8_t *src;
     uint8_t *dest;
     int i;
+
     dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
     dest += dstrides.y*y + x;
     src = image[0];
@@ -312,7 +317,9 @@
 {
     uint8_t *src;
     uint8_t *dest;
-    int i;
+
+    UNUSED(w);
+    UNUSED(stride);
     dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
     dest += dstrides.y*y + x;
     src = image[0];
@@ -322,6 +329,12 @@
 
 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
 {
+	UNUSED(image);
+	UNUSED(stride);
+	UNUSED(w);
+	UNUSED(h);
+	UNUSED(x);
+	UNUSED(y);
 	printf("vosub_vidix: Error unoptimized draw_slice was called\nExiting...");
 	vidix_term();
 	exit( EXIT_FAILURE );
@@ -379,6 +392,10 @@
     case IMGFMT_YV12:
     case IMGFMT_IYUV:
     case IMGFMT_I420:
+    case IMGFMT_YVU9:
+    case IMGFMT_IF09:
+    case IMGFMT_Y8:
+    case IMGFMT_Y800:
 	bespitch = (vidix_play.src.w + apitch) & (~apitch);
         vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch);
         break;
@@ -444,7 +461,7 @@
     }
     return 0;
   }
-  return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
+  return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD;
 }
 
 int vidix_grkey_support(void)
@@ -523,7 +540,7 @@
 		   unsigned dst_height,unsigned format,unsigned dest_bpp,
 		   unsigned vid_w,unsigned vid_h,const void *info)
 {
-  size_t i,awidth;
+  size_t i;
   int err;
   uint32_t sstride,apitch;
   if(verbose > 1)
@@ -642,7 +659,7 @@
 		printf("vosub_vidix: Can't configure playback: %s\n",strerror(err));
 		return -1;
 	}
-	printf("vosub_vidix: using %d buffers\n", vidix_play.num_frames);
+	if (verbose) printf("vosub_vidix: using %d buffer(s)\n", vidix_play.num_frames);
 
 	vidix_mem = vidix_play.dga_addr;
 
@@ -656,13 +673,13 @@
 		vidix_play.frame_size);
 	switch(format)
 	{
-	    case IMGFMT_Y800:
-	    case IMGFMT_Y8:
+	    case IMGFMT_YV12:
+	    case IMGFMT_I420:
+	    case IMGFMT_IYUV:
 	    case IMGFMT_YVU9:
 	    case IMGFMT_IF09:
-	    case IMGFMT_I420:
-	    case IMGFMT_IYUV:
-	    case IMGFMT_YV12:
+	    case IMGFMT_Y800:
+	    case IMGFMT_Y8:
 		apitch = vidix_play.dest.pitch.y-1;
 		dstrides.y = (image_width + apitch) & ~apitch;
 		apitch = vidix_play.dest.pitch.v-1;
@@ -714,8 +731,8 @@
 {
     if(mpi->type==MP_IMGTYPE_STATIC && vidix_play.num_frames>1) return VO_FALSE;
     if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; /* slow video ram */
-    if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) && 
-       !forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV)))
+    if((is_422_planes_eq || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))) && 
+       (!forced_fourcc && !(vidix_play.flags & VID_PLAY_INTERLEAVED_UV)))
     {
 	if(mpi->flags&MP_IMGFLAG_ACCEPT_WIDTH){
 	    // check if only width is enough to represent strides:
@@ -795,8 +812,8 @@
 	((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;
-	server_control = ((vo_functions_t *)server)->control;
-	((vo_functions_t *)server)->control=vidix_control;
+//	server_control = ((vo_functions_t *)server)->control;
+//	((vo_functions_t *)server)->control=vidix_control;
 	vo_server = server;
 	return 0;
 }