Mercurial > mplayer.hg
comparison libmpcodecs/vf_scale.c @ 30642:a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
author | diego |
---|---|
date | Sun, 21 Feb 2010 15:48:03 +0000 |
parents | a7b908875c14 |
children | 3d23e24c5c60 |
comparison
equal
deleted
inserted
replaced
30641:b14b32c20935 | 30642:a972c1a4a012 |
---|---|
164 best=format; // best with conversion | 164 best=format; // best with conversion |
165 } | 165 } |
166 return best; | 166 return best; |
167 } | 167 } |
168 | 168 |
169 static int config(struct vf_instance_s* vf, | 169 static int config(struct vf_instance *vf, |
170 int width, int height, int d_width, int d_height, | 170 int width, int height, int d_width, int d_height, |
171 unsigned int flags, unsigned int outfmt){ | 171 unsigned int flags, unsigned int outfmt){ |
172 unsigned int best=find_best_out(vf, outfmt); | 172 unsigned int best=find_best_out(vf, outfmt); |
173 int vo_flags; | 173 int vo_flags; |
174 int int_sws_flags=0; | 174 int int_sws_flags=0; |
364 //d_height=d_height*vf->priv->h/height; | 364 //d_height=d_height*vf->priv->h/height; |
365 } | 365 } |
366 return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best); | 366 return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best); |
367 } | 367 } |
368 | 368 |
369 static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ | 369 static void start_slice(struct vf_instance *vf, mp_image_t *mpi){ |
370 // printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK); | 370 // printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK); |
371 if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen | 371 if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen |
372 // they want slices!!! allocate the buffer. | 372 // they want slices!!! allocate the buffer. |
373 mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt, | 373 mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt, |
374 // mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK), | 374 // mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK), |
404 }else{ | 404 }else{ |
405 sws_scale(sws1, src2, src_stride, y, h, dst, dst_stride); | 405 sws_scale(sws1, src2, src_stride, y, h, dst, dst_stride); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 static void draw_slice(struct vf_instance_s* vf, | 409 static void draw_slice(struct vf_instance *vf, |
410 unsigned char** src, int* stride, int w,int h, int x, int y){ | 410 unsigned char** src, int* stride, int w,int h, int x, int y){ |
411 mp_image_t *dmpi=vf->dmpi; | 411 mp_image_t *dmpi=vf->dmpi; |
412 if(!dmpi){ | 412 if(!dmpi){ |
413 mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n"); | 413 mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n"); |
414 return; | 414 return; |
415 } | 415 } |
416 // printf("vf_scale::draw_slice() y=%d h=%d\n",y,h); | 416 // printf("vf_scale::draw_slice() y=%d h=%d\n",y,h); |
417 scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced); | 417 scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced); |
418 } | 418 } |
419 | 419 |
420 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ | 420 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
421 mp_image_t *dmpi=mpi->priv; | 421 mp_image_t *dmpi=mpi->priv; |
422 | 422 |
423 // printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n", | 423 // printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n", |
424 // dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)); | 424 // dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)); |
425 | 425 |
442 if(vf->priv->palette) dmpi->planes[1]=vf->priv->palette; // export palette! | 442 if(vf->priv->palette) dmpi->planes[1]=vf->priv->palette; // export palette! |
443 | 443 |
444 return vf_next_put_image(vf,dmpi, pts); | 444 return vf_next_put_image(vf,dmpi, pts); |
445 } | 445 } |
446 | 446 |
447 static int control(struct vf_instance_s* vf, int request, void* data){ | 447 static int control(struct vf_instance *vf, int request, void* data){ |
448 int *table; | 448 int *table; |
449 int *inv_table; | 449 int *inv_table; |
450 int r; | 450 int r; |
451 int brightness, contrast, saturation, srcRange, dstRange; | 451 int brightness, contrast, saturation, srcRange, dstRange; |
452 vf_equalizer_t *eq; | 452 vf_equalizer_t *eq; |
505 | 505 |
506 //===========================================================================// | 506 //===========================================================================// |
507 | 507 |
508 // supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800 | 508 // supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800 |
509 | 509 |
510 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | 510 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
511 switch(fmt){ | 511 switch(fmt){ |
512 case IMGFMT_YV12: | 512 case IMGFMT_YV12: |
513 case IMGFMT_I420: | 513 case IMGFMT_I420: |
514 case IMGFMT_IYUV: | 514 case IMGFMT_IYUV: |
515 case IMGFMT_UYVY: | 515 case IMGFMT_UYVY: |
554 } | 554 } |
555 } | 555 } |
556 return 0; // nomatching in-fmt | 556 return 0; // nomatching in-fmt |
557 } | 557 } |
558 | 558 |
559 static void uninit(struct vf_instance_s *vf){ | 559 static void uninit(struct vf_instance *vf){ |
560 if(vf->priv->ctx) sws_freeContext(vf->priv->ctx); | 560 if(vf->priv->ctx) sws_freeContext(vf->priv->ctx); |
561 if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2); | 561 if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2); |
562 if(vf->priv->palette) free(vf->priv->palette); | 562 if(vf->priv->palette) free(vf->priv->palette); |
563 free(vf->priv); | 563 free(vf->priv); |
564 } | 564 } |