[Mplayer-cvslog] CVS: main/libmpcodecs vf_bmovl.c,1.10,1.11

Attila Kinali CVS attila at mplayerhq.hu
Wed Dec 10 13:28:44 CET 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv4962

Modified Files:
	vf_bmovl.c 
Log Message:
fix bug when bmovl can't read the whole pic at once
patch by Detlev Droege <droege at uni-koblenz.de>


Index: vf_bmovl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_bmovl.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- vf_bmovl.c	5 Oct 2003 14:17:29 -0000	1.10
+++ vf_bmovl.c	10 Dec 2003 12:28:20 -0000	1.11
@@ -199,6 +199,7 @@
 static int
 put_image(struct vf_instance_s* vf, mp_image_t* mpi){
 	int buf_x=0, buf_y=0, buf_pos=0;
+	int have, got, want;
 	int xpos=0, ypos=0, pos=0;
 	unsigned char red=0, green=0, blue=0;
 	int  alpha;
@@ -267,7 +268,22 @@
 			    	mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Couldn't allocate temporary buffer! Skipping...\n\n");
 					return vf_next_put_image(vf, dmpi);
 			    }
-			    mp_msg(MSGT_VFILTER, MSGL_DBG2, "Got %d bytes...\n", read( vf->priv->stream_fd, buffer, (imgw*imgh*pxsz) ) );
+  				/* pipes/sockets might need multiple calls to read(): */
+			    want = (imgw*imgh*pxsz);
+			    have = 0;
+			    while (have < want) {
+				got = read( vf->priv->stream_fd, buffer+have, want-have );
+				if (got == 0) {
+			    	    mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: premature EOF...\n\n");
+				    break;
+				}
+				if (got < 0) {
+			    	    mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: read error: %s\n\n", strerror(errno));
+				    break;
+				}
+				have += got;
+			    }
+			    mp_msg(MSGT_VFILTER, MSGL_DBG2, "Got %d bytes... (wanted %d)\n", have, want );
 
 				if(clear) {
 					memset( vf->priv->bitmap.y,   0, vf->priv->w*vf->priv->h );



More information about the MPlayer-cvslog mailing list