summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_bmovl.c
diff options
context:
space:
mode:
authorattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-12-10 12:28:20 +0000
committerattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-12-10 12:28:20 +0000
commitb164638fbaa46749aa8df45807a2f540d39371a9 (patch)
treef41287328a8d7ed8809e8189b484ee7fa2f1a3c1 /libmpcodecs/vf_bmovl.c
parent5cd067e6a0a8e1f399b4ecb54748438ad0dedbe7 (diff)
downloadmpv-b164638fbaa46749aa8df45807a2f540d39371a9.tar.bz2
mpv-b164638fbaa46749aa8df45807a2f540d39371a9.tar.xz
fix bug when bmovl can't read the whole pic at once
patch by Detlev Droege <droege@uni-koblenz.de> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11621 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_bmovl.c')
-rw-r--r--libmpcodecs/vf_bmovl.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c
index 98dbd029f0..86889aac24 100644
--- a/libmpcodecs/vf_bmovl.c
+++ b/libmpcodecs/vf_bmovl.c
@@ -199,6 +199,7 @@ _read_cmd(int fd, char *cmd, char *args) {
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 @@ put_image(struct vf_instance_s* vf, mp_image_t* mpi){
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 );