diff options
author | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-05-20 17:42:33 +0000 |
---|---|---|
committer | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-05-20 17:42:33 +0000 |
commit | 8b0fe128407b9d0bfcb32d58c57a3f78d5a180cb (patch) | |
tree | e8e03445914fca8b44454c5c54ee828fedc3b156 /libmpcodecs/vf_crop.c | |
parent | b7fc25cc94ab79c4c225aeb028e12b83f3c3ef4e (diff) | |
download | mpv-8b0fe128407b9d0bfcb32d58c57a3f78d5a180cb.tar.bz2 mpv-8b0fe128407b9d0bfcb32d58c57a3f78d5a180cb.tar.xz |
fix segfaults with slices. support slice rendering into a filter even
when the following filter/vo doesn't support slices. also use unified
vf->dmpi rather than having vf->priv->dmpi duplicated in every filter.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10141 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_crop.c')
-rw-r--r-- | libmpcodecs/vf_crop.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c index 0191f098ea..e73b8e9fb7 100644 --- a/libmpcodecs/vf_crop.c +++ b/libmpcodecs/vf_crop.c @@ -15,7 +15,6 @@ static struct vf_priv_s { int crop_w,crop_h; int crop_x,crop_y; - mp_image_t *dmpi; } vf_priv_dflt = { -1,-1, -1,-1 @@ -71,7 +70,7 @@ static int config(struct vf_instance_s* vf, static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ mp_image_t *dmpi; if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) - return vf_next_put_image(vf,vf->priv->dmpi); + return vf_next_put_image(vf,vf->dmpi); dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, vf->priv->crop_w, vf->priv->crop_h); @@ -96,11 +95,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ } static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ - if(!vf->next->draw_slice){ - mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; - return; - } - vf->priv->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags, + vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags, vf->priv->crop_w, vf->priv->crop_h); } @@ -108,7 +103,7 @@ static void draw_slice(struct vf_instance_s* vf, unsigned char** src, int* stride, int w,int h, int x, int y){ unsigned char *src2[3]; src2[0] = src[0]; - if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) { + if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) { src2[1] = src[1]; src2[2] = src[2]; } @@ -116,9 +111,9 @@ static void draw_slice(struct vf_instance_s* vf, if ((x -= vf->priv->crop_x) < 0) { x = -x; src2[0] += x; - if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) { - src2[1] += x>>vf->priv->dmpi->chroma_x_shift; - src2[2] += x>>vf->priv->dmpi->chroma_x_shift; + if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) { + src2[1] += x>>vf->dmpi->chroma_x_shift; + src2[2] += x>>vf->dmpi->chroma_x_shift; } w -= x; x = 0; @@ -126,9 +121,9 @@ static void draw_slice(struct vf_instance_s* vf, if ((y -= vf->priv->crop_y) < 0) { y = -y; src2[0] += y*stride[0]; - if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) { - src2[1] += (y>>vf->priv->dmpi->chroma_y_shift)*stride[1]; - src2[2] += (y>>vf->priv->dmpi->chroma_y_shift)*stride[2]; + if (vf->dmpi->flags & MP_IMGFLAG_PLANAR) { + src2[1] += (y>>vf->dmpi->chroma_y_shift)*stride[1]; + src2[2] += (y>>vf->dmpi->chroma_y_shift)*stride[2]; } h -= y; y = 0; |