changeset 2971:56faed773768

Added preinit of lvo stuff
author nick
date Sun, 18 Nov 2001 15:06:32 +0000
parents 4ecb26be6657
children 71272beb9000
files libvo/vesa_lvo.c libvo/vesa_lvo.h libvo/vo_vesa.c
diffstat 3 files changed, 36 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vesa_lvo.c	Sun Nov 18 15:05:25 2001 +0000
+++ b/libvo/vesa_lvo.c	Sun Nov 18 15:06:32 2001 +0000
@@ -40,17 +40,22 @@
 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
 #define IMAGE_LINE_SIZE(pixel_size) (image_width*(pixel_size))
 
-int      vlvo_init(const char *drvname,unsigned src_width,unsigned src_height,
+int vlvo_preinit(const char *drvname)
+{
+	lvo_handler = open(drvname,O_RDWR);
+	if(lvo_handler == -1)
+	{
+		printf("vesa_lvo: Couldn't open '%s'\n",drvname);
+		return -1;
+	}
+	return 0;
+}
+
+int      vlvo_init(unsigned src_width,unsigned src_height,
 		   unsigned x_org,unsigned y_org,unsigned dst_width,
 		   unsigned dst_height,unsigned format,unsigned dest_bpp)
 {
   size_t i,awidth;
-	lvo_handler = open(drvname,O_RDWR);
-	if(lvo_handler == -1)
-	{
-		printf("Couldn't open %s\n",drvname);
-		return -1;
-	}
 	image_width = src_width;
 	image_height = src_height;
 	mga_vid_config.version=MGA_VID_VERSION;
@@ -99,8 +104,8 @@
 	mga_vid_config.num_frames=NUM_FRAMES;
 	if (ioctl(lvo_handler,MGA_VID_CONFIG,&mga_vid_config))
 	{
-		perror("Error in mga_vid_config ioctl()");
-                printf("Your mga_vid driver version is incompatible with this MPlayer version!\n");
+		perror("vesa_lvo: Error in mga_vid_config ioctl()");
+                printf("vesa_lvo: Your fb_vid driver version is incompatible with this MPlayer version!\n");
 		return -1;
 	}
 	ioctl(lvo_handler,MGA_VID_ON,0);
--- a/libvo/vesa_lvo.h	Sun Nov 18 15:05:25 2001 +0000
+++ b/libvo/vesa_lvo.h	Sun Nov 18 15:06:32 2001 +0000
@@ -12,7 +12,9 @@
 #ifndef __VESA_LVO_INCLUDED
 #define __VESA_LVO_INCLUDED
 
-int      vlvo_init(const char *drvname,unsigned src_width,unsigned src_height,
+int	 vlvo_preinit(
+const char *drvname);
+int      vlvo_init(unsigned src_width,unsigned src_height,
 		   unsigned x_org,unsigned y_org,unsigned dst_width,
 		   unsigned dst_height,unsigned format,unsigned dest_bpp);
 void     vlvo_term( void );
--- a/libvo/vo_vesa.c	Sun Nov 18 15:05:25 2001 +0000
+++ b/libvo/vo_vesa.c	Sun Nov 18 15:06:32 2001 +0000
@@ -98,6 +98,7 @@
 
 /* Linux Video Overlay */
 static const char *lvo_name = NULL;
+static int pre_init_err = 0;
 
 #define HAS_DGA()  (win.idx == -1)
 #define MOVIE_MODE (MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS)
@@ -412,14 +413,23 @@
    return flags;
 }
 
-
 static uint32_t query_format(uint32_t format)
 {
+  static int first = 1;
   uint32_t retval;
     if(verbose > 2)
         printf("vo_vesa: query_format was called: %x (%s)\n",format,vo_format_name(format));
-    if(vo_subdevice) parseSubDevice(vo_subdevice);
-    if(lvo_name) return 1;
+    if(first)
+    {
+      if(verbose > 2)
+        printf("vo_vesa: subdevice %s have been initialized\n",vo_subdevice);
+      if(vo_subdevice) parseSubDevice(vo_subdevice);
+      if(lvo_name) pre_init_err = vlvo_preinit(lvo_name);
+      if(verbose > 2)
+        printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
+      first = 0;
+    }
+    if(!pre_init_err && lvo_name) return vlvo_query_info(format);
 	switch(format)
 	{
 		case IMGFMT_YV12:
@@ -543,6 +553,11 @@
 	fs_mode = 0;
 	rgb2rgb_fnc = NULL;
         sd_flags = 0;
+	if(pre_init_err)
+	{
+	  printf("vo_vesa: initialization have been terminated due wrong preinitialization\n");
+	  return -1;
+	}  
         if(vo_subdevice) sd_flags = parseSubDevice(vo_subdevice);
 	if(sd_flags == -1) return -1;
 	if(flags & 0x8)
@@ -850,7 +865,7 @@
 		}
 		if(lvo_name)
 		{
-		  if(vlvo_init(lvo_name,width,height,x_offset,y_offset,image_width,image_height,format,video_mode_info.BitsPerPixel) != 0)
+		  if(vlvo_init(width,height,x_offset,y_offset,image_width,image_height,format,video_mode_info.BitsPerPixel) != 0)
 		  {
 		    printf("vo_vesa: Can't initialize Linux Video Overlay\n");
 		    lvo_name = NULL;