[MPlayer-dev-eng] [PATCH] zr doc update + minor bugfix

Rik Snel rsnel at cube.dyndns.org
Sat Jan 26 16:26:33 CET 2002


Hello,

These patches update/clarify the zr documentation, they fix a
decimation/scaling bug in vo_zr and some verbose messages have changed.

Please apply.

Greetings,

Rik.

--------
Nothing is ever a total loss; it can always serve as a bad example.
-------------- next part --------------
diff -Naur main/DOCS/video.html main.dev/DOCS/video.html
--- main/DOCS/video.html	Sat Jan 26 10:00:44 2002
+++ main.dev/DOCS/video.html	Sat Jan 26 14:58:22 2002
@@ -87,8 +87,8 @@
   framebuffer (works!)</TD><TR>
 <TD></TD><TD VALIGN=top><FONT face="Verdana, Arial, Helvetica, sans-serif"
   size=2><A HREF=#2.3.1.16>zr</A></TD><TD></TD><TD><FONT face="Verdana, Arial,
-  Helvetica, sans-serif" size=2>Displaying on some hardware MJPEG capture/playback
-  boards (DC10, DC10+, LML33)</TD><TR>
+  Helvetica, sans-serif" size=2>Displaying on ZR360[56]7 based 
+  MJPEG boards (DC10(+), LML33, Buz)</TD><TR>
 
 <TD COLSPAN=4><P><B><FONT face="Verdana, Arial, Helvetica, sans-serif"
   size=2>Special:</B></P></TD><TR>
@@ -1003,7 +1003,7 @@
 <P><B><A NAME=2.3.1.16>2.3.1.16. Zr</A></B></P>
 
 <P>This is a display-driver (<CODE>-vo zr</CODE>) for a number of MJPEG
-capture/playback cards (tested for DC10+ and buz, and it should work for the
+capture/playback cards (tested for DC10+ and Buz, and it should work for the
 LML33, the DC10). The driver works by encoding the frame to jpeg and then
 sending it to the card. For the jpeg encoding <B>libavcodec</B> is
 used, and required.</P>
@@ -1015,14 +1015,21 @@
 
 <P>Some remarks:
 <UL>
-  <LI>don't use xawtv on the same device <B>MPlayer</B> uses, it will crash
-    your computer.</LI>
+  <LI>don't start or stop XawTV on the playback device during playback, 
+    it will crash your computer. It is, however, fine to <B>FIRST</B> start 
+    XawTV, <B>THEN</B> start <B>MPlayer</B>, wait for <B>MPlayer</B> to finish 
+    and <B>THEN</B> stop XawTV.</LI>
   <LI>this driver adds <CODE>-zr*</CODE> commandline options. The explanation
     of these options can be viewed with <CODE>-zrhelp</CODE>. It is possible to
     crop the input frame (cut borders to make it fit or to enhance performace)
     and to do other things.</LI>
-  <LI>the driver only takes data in YV12 format (libmpeg2, libavcodec for
-    example).</LI>
+  <LI>the driver takes data in YV12 and YUY2 format, this means that some 
+    codecs won't work. Some old VfW (Video for Windows) codecs, for example,
+    are incompatible with this driver. The errormessage that you will see is: 
+    <CODE>Sorry, selected video_out device is incompatible with this codec.
+    </CODE></LI>
+  <LI>OSD is currently not supported, so you won't see
+    subtitles.</LI>
 </UL>
 </P>
 
-------------- next part --------------
diff -Naur main/libvo/vo_zr.c main.dev/libvo/vo_zr.c
--- main/libvo/vo_zr.c	Sat Jan 26 10:00:49 2002
+++ main.dev/libvo/vo_zr.c	Sat Jan 26 15:01:18 2002
@@ -125,7 +125,7 @@
 		mp_msg(MSGT_VO, MSGL_ERR, "error getting video capabilities from %s\n");
 		return 1;
 	}
-	mp_msg(MSGT_VO, MSGL_V, "zr36067 reports: maxwidth=%d, maxheight=%d\n", vc.maxwidth, vc.maxheight);
+	mp_msg(MSGT_VO, MSGL_V, "zr: MJPEG card reports maxwidth=%d, maxheight=%d\n", vc.maxwidth, vc.maxheight);
 	
 	return 0;
 }
@@ -133,8 +133,8 @@
 int init_zoran(int zrhdec, int zrvdec) {
 	/* center the image, and stretch it as far as possible (try to keep
 	 * aspect) and check if it fits */
-	if (image_width/hdec > vc.maxwidth) {
-		mp_msg(MSGT_VO, MSGL_ERR, "movie to be played is too wide, max width currenty %d\n", vc.maxwidth);
+	if (image_width > vc.maxwidth) {
+		mp_msg(MSGT_VO, MSGL_ERR, "zr: movie to be played is too wide, max width currenty %d\n", vc.maxwidth);
 		return 1;
 	}
 
@@ -230,6 +230,7 @@
 		g.height = height;
 		g.xoff = 0;
 		g.yoff = 0;
+		g.set = 1;
 	}
 	/* we must know the maximum resolution of the device
 	 * it differs for DC10+ and buz for example */
@@ -246,6 +247,7 @@
 		if (vdec == 2) {
 			fields = 1;
 		} else if (vdec == 4) {
+			fields = 1;
 			stretchy = 2;
 		}
 		stretchx = hdec;
@@ -286,6 +288,28 @@
 			hdec = 1;
 		}
 	}
+	/* It can be that the original frame was too big for display,
+	 * or that the width of the decimated image (for example) after
+	 * padding up to a multiple of 16 has become too big. (orig
+	 * width 720 (exactly right for the Buz) after decimation 360,
+	 * after padding up to a multiple of 16 368, display 736 -> too
+	 * large). In these situations we auto(re)crop. */
+	j = 16*((g.width - 1)/(hdec*16) + 1);
+	if (stretchx*j > vc.maxwidth) {
+		g.xoff += 2*((g.width - hdec*(j-16))/4);
+		/* g.off must be a multiple of 2 */
+		g.width = hdec*(j - 16);
+		g.set = 0; /* we abuse this field to report that g has changed*/
+	}
+	j = 8*fields*((g.height - 1)/(vdec*fields*8) + 1);
+	if (stretchy*j > vc.maxheight) {
+		g.yoff += 2*((g.height - vdec*(j - 8*fields))/4);
+		g.height = vdec*(j - 8*fields);
+		g.set = 0;
+	}
+	if (!g.set) 
+		mp_msg(MSGT_VO, MSGL_V, "zr: auto(re)cropping %dx%d+%d+%d to make the image fit on the screen\n", g.width, g.height, g.xoff, g.yoff);
+
 	/* the height must be a multiple of fields*8 and the width
 	 * must be a multiple of 16 */
 	/* add some black borders to make it so, and center the image*/
@@ -300,7 +324,7 @@
 	off_c += (image_width - g.width)/4;
 	framenum = 0;
 	size = image_width*image_height;
-	mp_msg(MSGT_VO, MSGL_V, "input: %dx%d, cropped: %dx%d, output: %dx%d, off_y=%d, off_c=%d\n", width/hdec, height, g.width, g.height, image_width, image_height, off_y, off_c);
+	mp_msg(MSGT_VO, MSGL_V, "input: %dx%d, cropped: %dx%d, output: %dx%d, off_y=%d, off_c=%d\n", width, height, g.width, g.height, image_width, image_height, off_y, off_c);
 	
 	image = malloc(2*size); /* this buffer allows for YUV422 data,
 				 * so it is a bit too big for YUV420 */


More information about the MPlayer-dev-eng mailing list