changeset 4270:178c84b1090e

clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
author alex
date Sat, 19 Jan 2002 22:42:08 +0000
parents 68c78efeea2b
children 2c7e6c87fb6f
files libvo/vosub_vidix.c
diffstat 1 files changed, 35 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vosub_vidix.c	Sat Jan 19 22:24:30 2002 +0000
+++ b/libvo/vosub_vidix.c	Sat Jan 19 22:42:08 2002 +0000
@@ -41,10 +41,6 @@
 static vidix_playback_t   vidix_play;
 static vidix_fourcc_t	  vidix_fourcc;
 
-#define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
-#define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
-#define IMAGE_LINE_SIZE(pixel_size) (image_width*(pixel_size))
-
 int vidix_preinit(const char *drvname,void *server)
 {
   int err;
@@ -130,6 +126,8 @@
 	vidix_play.fourcc = format;
 	vidix_play.capability = vidix_cap.flags; /* every ;) */
 	vidix_play.blend_factor = 0; /* for now */
+	/* display the full picture.
+	   Nick: we could implement here zooming to a specified area -- alex */
 	vidix_play.src.x = vidix_play.src.y = 0;
 	vidix_play.src.w = src_width;
 	vidix_play.src.h = src_height;
@@ -144,14 +142,17 @@
 		return -1;
 	}
 
+	vidix_mem = vidix_play.dga_addr;
+
+	/* select first frame */
 	next_frame = 0;
-	if(vo_doublebuffering)
-	    vdlPlaybackFrameSelect(vidix_handler,next_frame);
-	vidix_mem =vidix_play.dga_addr;
+//        vdlPlaybackFrameSelect(vidix_handler,next_frame);
 
-	/*clear the buffer*/
-	memset(vidix_mem + vidix_play.offsets[0],0x80,vidix_play.frame_size*vidix_play.num_frames);
-	return 0;  
+	/* clear every frame with correct address and frame_size */
+	for (i = 0; i < vidix_play.num_frames; i++)
+	    memset(vidix_mem + vidix_play.offsets[i], 0x80,
+		vidix_play.frame_size);
+	return 0;
 }
 
 extern int vo_gamma_brightness;
@@ -167,10 +168,17 @@
 int vidix_start(void)
 {
     int err;
+    if((err=vdlPlaybackOn(vidix_handler))!=0)
+    {
+	printf("vosub_vidix: Can't start playback: %s\n",strerror(err));
+	return -1;
+    }
 
-    if(verbose > 1)
+    if (vidix_cap.flags & FLAG_EQUALIZER)
     {
-	printf("vosub_vidix: vo_gamma_brightness=%i\n"
+	if(verbose > 1)
+	{
+	    printf("vosub_vidix: vo_gamma_brightness=%i\n"
 	       "vosub_vidix: vo_gamma_saturation=%i\n"
 	       "vosub_vidix: vo_gamma_contrast=%i\n"
 	       "vosub_vidix: vo_gamma_hue=%i\n"
@@ -184,22 +192,17 @@
 	       ,vo_gamma_red_intense
 	       ,vo_gamma_green_intense
 	       ,vo_gamma_blue_intense);
-    }
-    if((err=vdlPlaybackOn(vidix_handler))!=0)
-    {
-	printf("vosub_vidix: Can't start playback: %s\n",strerror(err));
-	return -1;
+	}
+	vid_eq.brightness = vo_gamma_brightness;
+	vid_eq.saturation = vo_gamma_saturation;
+	vid_eq.contrast = vo_gamma_contrast;
+	vid_eq.hue = vo_gamma_hue;
+	vid_eq.red_intense = vo_gamma_red_intense;
+	vid_eq.green_intense = vo_gamma_green_intense;
+	vid_eq.blue_intense = vo_gamma_blue_intense;
+	vid_eq.flags = VEQ_FLG_ITU_R_BT_601;
+	vdlPlaybackSetEq(vidix_handler,&vid_eq);
     }
-    
-    vid_eq.brightness = vo_gamma_brightness;
-    vid_eq.saturation = vo_gamma_saturation;
-    vid_eq.contrast = vo_gamma_contrast;
-    vid_eq.hue = vo_gamma_hue;
-    vid_eq.red_intense = vo_gamma_red_intense;
-    vid_eq.green_intense = vo_gamma_green_intense;
-    vid_eq.blue_intense = vo_gamma_blue_intense;
-    vid_eq.flags = VEQ_FLG_ITU_R_BT_601;
-    vdlPlaybackSetEq(vidix_handler,&vid_eq);
     return 0;
 }
 
@@ -229,7 +232,7 @@
     int i;
     apitch = vidix_play.dest.pitch.y-1;
     bespitch = (w + apitch) & ~apitch;
-
+    
     dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
     dest += bespitch*y + x;
     src = image[0];
@@ -371,12 +374,14 @@
   if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format));
   vidix_fourcc.fourcc = format;
   vdlQueryFourcc(vidix_handler,&vidix_fourcc);
-  return vidix_fourcc.depth != VID_DEPTH_NONE;
+  if (vidix_fourcc.depth == VID_DEPTH_NONE)
+    return(0);
+  return(0x2); /* hw support without conversion */
 }
 
 int vidix_grkey_support(void)
 {
-    return (vidix_fourcc.flags & VID_CAP_COLORKEY);
+    return(vidix_fourcc.flags & VID_CAP_COLORKEY);
 }
 
 int vidix_grkey_get(vidix_grkey_t *gr_key)