diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-02-17 18:59:47 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-02-17 18:59:47 +0000 |
commit | bdfef5ff392daf50ea5943608554b9c47e402b2a (patch) | |
tree | 66bbdcbd68ab487d4666582229c3e41ad4651c83 | |
parent | 8e5edec13eabc42923bc119f435566145955c124 (diff) | |
download | mpv-bdfef5ff392daf50ea5943608554b9c47e402b2a.tar.bz2 mpv-bdfef5ff392daf50ea5943608554b9c47e402b2a.tar.xz |
Print an error and return NULL in vf_get_image if we try to allocate
a format with bpp == 0, since this can not work.
This way at least we crash earlier and print an error message.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28637 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/vf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 632e4381a9..ad72f304d3 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -320,7 +320,6 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, // keep buffer allocation status & color flags only: // mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; - mpi->flags |= MP_IMGFLAG_IN_USE; // accept restrictions & draw_slice flags only: mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; @@ -347,6 +346,11 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // non-direct and not yet allocated image. allocate it! + if (!mpi->bpp) { // no way we can allocate this + mp_msg(MSGT_DECVIDEO, MSGL_FATAL, + "vf_get_image: Tried to allocate a format that can not be allocated!\n"); + return NULL; + } // check if codec prefer aligned stride: if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ @@ -427,6 +431,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, mpi->qscale = NULL; } + mpi->flags |= MP_IMGFLAG_IN_USE; // printf("\rVF_MPI: %p %p %p %d %d %d \n", // mpi->planes[0],mpi->planes[1],mpi->planes[2], // mpi->stride[0],mpi->stride[1],mpi->stride[2]); |