Mercurial > mplayer.hg
comparison libmpcodecs/vf_bmovl.c @ 17906:20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
author | michael |
---|---|
date | Tue, 21 Mar 2006 21:26:42 +0000 |
parents | 7c4eef408b6b |
children | d36048cad8c4 |
comparison
equal
deleted
inserted
replaced
17905:433494f162a9 | 17906:20aca9baf5d8 |
---|---|
197 return TRUE; | 197 return TRUE; |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 static int | 201 static int |
202 put_image(struct vf_instance_s* vf, mp_image_t* mpi){ | 202 put_image(struct vf_instance_s* vf, mp_image_t* mpi, double pts){ |
203 int buf_x=0, buf_y=0, buf_pos=0; | 203 int buf_x=0, buf_y=0, buf_pos=0; |
204 int have, got, want; | 204 int have, got, want; |
205 int xpos=0, ypos=0, pos=0; | 205 int xpos=0, ypos=0, pos=0; |
206 unsigned char red=0, green=0, blue=0; | 206 unsigned char red=0, green=0, blue=0; |
207 int alpha; | 207 int alpha; |
244 else if( strncmp(cmd,"CLEAR" ,5)==0 ) { pxsz=1; command = CMD_CLEAR; } | 244 else if( strncmp(cmd,"CLEAR" ,5)==0 ) { pxsz=1; command = CMD_CLEAR; } |
245 else if( strncmp(cmd,"ALPHA" ,5)==0 ) { pxsz=1; command = CMD_ALPHA; } | 245 else if( strncmp(cmd,"ALPHA" ,5)==0 ) { pxsz=1; command = CMD_ALPHA; } |
246 else if( strncmp(cmd,"OPAQUE",6)==0 ) vf->priv->opaque=TRUE; | 246 else if( strncmp(cmd,"OPAQUE",6)==0 ) vf->priv->opaque=TRUE; |
247 else if( strncmp(cmd,"SHOW", 4)==0 ) vf->priv->hidden=FALSE; | 247 else if( strncmp(cmd,"SHOW", 4)==0 ) vf->priv->hidden=FALSE; |
248 else if( strncmp(cmd,"HIDE", 4)==0 ) vf->priv->hidden=TRUE; | 248 else if( strncmp(cmd,"HIDE", 4)==0 ) vf->priv->hidden=TRUE; |
249 else if( strncmp(cmd,"FLUSH" ,5)==0 ) return vf_next_put_image(vf, dmpi); | 249 else if( strncmp(cmd,"FLUSH" ,5)==0 ) return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
250 else { | 250 else { |
251 mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Unknown command: '%s'. Ignoring.\n", cmd); | 251 mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Unknown command: '%s'. Ignoring.\n", cmd); |
252 return vf_next_put_image(vf, dmpi); | 252 return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
253 } | 253 } |
254 | 254 |
255 if(command == CMD_ALPHA) { | 255 if(command == CMD_ALPHA) { |
256 sscanf( args, "%d %d %d %d %d", &imgw, &imgh, &imgx, &imgy, &imgalpha); | 256 sscanf( args, "%d %d %d %d %d", &imgw, &imgh, &imgx, &imgy, &imgalpha); |
257 mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: ALPHA: %d %d %d %d %d\n\n", | 257 mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: ALPHA: %d %d %d %d %d\n\n", |
266 imgw, imgh, imgx, imgy, imgalpha, clear); | 266 imgw, imgh, imgx, imgy, imgalpha, clear); |
267 | 267 |
268 buffer = malloc(imgw*imgh*pxsz); | 268 buffer = malloc(imgw*imgh*pxsz); |
269 if(!buffer) { | 269 if(!buffer) { |
270 mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Couldn't allocate temporary buffer! Skipping...\n\n"); | 270 mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Couldn't allocate temporary buffer! Skipping...\n\n"); |
271 return vf_next_put_image(vf, dmpi); | 271 return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
272 } | 272 } |
273 /* pipes/sockets might need multiple calls to read(): */ | 273 /* pipes/sockets might need multiple calls to read(): */ |
274 want = (imgw*imgh*pxsz); | 274 want = (imgw*imgh*pxsz); |
275 have = 0; | 275 have = 0; |
276 while (have < want) { | 276 while (have < want) { |
327 if( (imgx <= vf->priv->x1) && ( (imgx+imgw) >= vf->priv->x1) ) | 327 if( (imgx <= vf->priv->x1) && ( (imgx+imgw) >= vf->priv->x1) ) |
328 vf->priv->x1 = imgx+imgw; | 328 vf->priv->x1 = imgx+imgw; |
329 if( (imgx <= vf->priv->x2) && ( (imgx+imgw) >= vf->priv->x2) ) | 329 if( (imgx <= vf->priv->x2) && ( (imgx+imgw) >= vf->priv->x2) ) |
330 vf->priv->x2 = imgx; | 330 vf->priv->x2 = imgx; |
331 } | 331 } |
332 return vf_next_put_image(vf, dmpi); | 332 return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
333 } | 333 } |
334 | 334 |
335 for( buf_y=0 ; (buf_y < imgh) && (buf_y < (vf->priv->h-imgy)) ; buf_y++ ) { | 335 for( buf_y=0 ; (buf_y < imgh) && (buf_y < (vf->priv->h-imgy)) ; buf_y++ ) { |
336 for( buf_x=0 ; (buf_x < (imgw*pxsz)) && (buf_x < ((vf->priv->w+imgx)*pxsz)) ; buf_x += pxsz ) { | 336 for( buf_x=0 ; (buf_x < (imgw*pxsz)) && (buf_x < ((vf->priv->w+imgx)*pxsz)) ; buf_x += pxsz ) { |
337 if(command & IS_RAWIMG) buf_pos = (buf_y * imgw * pxsz) + buf_x; | 337 if(command & IS_RAWIMG) buf_pos = (buf_y * imgw * pxsz) + buf_x; |
385 } else if(ready < 0) { | 385 } else if(ready < 0) { |
386 mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Error %d in fifo: %s\n\n", errno, strerror(errno)); | 386 mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Error %d in fifo: %s\n\n", errno, strerror(errno)); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 if(vf->priv->hidden) return vf_next_put_image(vf, dmpi); | 390 if(vf->priv->hidden) return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
391 | 391 |
392 if(vf->priv->opaque) { // Just copy buffer memory to screen | 392 if(vf->priv->opaque) { // Just copy buffer memory to screen |
393 for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) { | 393 for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) { |
394 memcpy( dmpi->planes[0] + (ypos*dmpi->stride[0]) + vf->priv->x1, | 394 memcpy( dmpi->planes[0] + (ypos*dmpi->stride[0]) + vf->priv->x1, |
395 vf->priv->bitmap.y + (ypos*vf->priv->w) + vf->priv->x1, | 395 vf->priv->bitmap.y + (ypos*vf->priv->w) + vf->priv->x1, |
437 } | 437 } |
438 } | 438 } |
439 } // for xpos | 439 } // for xpos |
440 } // for ypos | 440 } // for ypos |
441 } // if !opaque | 441 } // if !opaque |
442 return vf_next_put_image(vf, dmpi); | 442 return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); |
443 } // put_image | 443 } // put_image |
444 | 444 |
445 static int | 445 static int |
446 vf_open(vf_instance_t* vf, char* args) | 446 vf_open(vf_instance_t* vf, char* args) |
447 { | 447 { |