diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-02-23 23:30:44 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-02-23 23:30:44 +0000 |
commit | f50b552000ae05a9a013815ba5e472f77d6da381 (patch) | |
tree | 908010bd0434836b35b9d8edd88915dc0f6d0bf0 | |
parent | 41b847f6a8af2013338a63c1b7311f804b2bf5b7 (diff) | |
download | mpv-f50b552000ae05a9a013815ba5e472f77d6da381.tar.bz2 mpv-f50b552000ae05a9a013815ba5e472f77d6da381.tar.xz |
experimental slices support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9496 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/vf_expand.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c index 653e156972..d4e8d61ed7 100644 --- a/libmpcodecs/vf_expand.c +++ b/libmpcodecs/vf_expand.c @@ -195,10 +195,17 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ if(vf->priv->exp_w==mpi->width || (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) ){ // try full DR ! - vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt, + mpi->priv=vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt, mpi->type, mpi->flags, MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), MAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y)); +#if 1 + if((vf->priv->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) && + !(vf->priv->dmpi->flags & MP_IMGFLAG_DIRECT)){ + printf("Full DR not possible, trying SLICES instead!\n"); + return; + } +#endif // set up mpi as a cropped-down image of dmpi: if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[0]=vf->priv->dmpi->planes[0]+ @@ -217,13 +224,38 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){ mpi->stride[0]=vf->priv->dmpi->stride[0]; mpi->width=vf->priv->dmpi->width; mpi->flags|=MP_IMGFLAG_DIRECT; - mpi->priv=(void*)vf->priv->dmpi; + mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; +// vf->priv->dmpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; + } +} + +static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ +// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK); + if(!vf->next->draw_slice){ + mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; + return; } + // they want slices!!! allocate the buffer. + if(!mpi->priv) + mpi->priv=vf->priv->dmpi=vf_get_image(vf->next,mpi->imgfmt, +// MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + mpi->type, mpi->flags, + MAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x), + MAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y)); + if(!(vf->priv->dmpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) + printf("WARNING! next filter doesn't support SLICES, get ready for sig11...\n"); // shouldn't happen. +} + +static void draw_slice(struct vf_instance_s* vf, + unsigned char** src, int* stride, int w,int h, int x, int y){ +// printf("draw_slice() called %d at %d\n",h,y); + vf_next_draw_slice(vf,src,stride,w,h,x+vf->priv->exp_x,y+vf->priv->exp_y); } static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ - if(mpi->flags&MP_IMGFLAG_DIRECT){ + if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ vf->priv->dmpi=mpi->priv; + mpi->priv=NULL; #ifdef OSD_SUPPORT if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h); #endif @@ -280,6 +312,8 @@ static int control(struct vf_instance_s* vf, int request, void* data){ static int open(vf_instance_t *vf, char* args){ vf->config=config; vf->control=control; + vf->start_slice=start_slice; + vf->draw_slice=draw_slice; vf->get_image=get_image; vf->put_image=put_image; vf->priv=malloc(sizeof(struct vf_priv_s)); |