Mercurial > mplayer.hg
changeset 5737:de47aebf654c
filters uninit
author | arpi |
---|---|
date | Sat, 20 Apr 2002 22:24:19 +0000 |
parents | 0ddd0a5d8907 |
children | ef3c2f82ea70 |
files | libmpcodecs/dec_video.c libmpcodecs/mp_image.h libmpcodecs/vf.c libmpcodecs/vf.h |
diffstat | 4 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/dec_video.c Sat Apr 20 21:06:09 2002 +0000 +++ b/libmpcodecs/dec_video.c Sat Apr 20 22:24:19 2002 +0000 @@ -131,6 +131,7 @@ if(!sh_video->inited) return; mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver); mpvdec->uninit(sh_video); + vf_uninit_filter_chain(sh_video->vfilter); sh_video->inited=0; }
--- a/libmpcodecs/mp_image.h Sat Apr 20 21:06:09 2002 +0000 +++ b/libmpcodecs/mp_image.h Sat Apr 20 22:24:19 2002 +0000 @@ -97,4 +97,12 @@ return mpi; } +static inline void free_mp_image(mp_image_t* mpi){ + if(!mpi) return; + if(mpi->flags&MP_IMGFLAG_ALLOCATED){ + if(mpi->planes[0]) free(mpi->planes[0]); + } + free(mpi); +} + #endif
--- a/libmpcodecs/vf.c Sat Apr 20 21:06:09 2002 +0000 +++ b/libmpcodecs/vf.c Sat Apr 20 22:24:19 2002 +0000 @@ -299,3 +299,19 @@ //============================================================================ +void vf_uninit_filter(vf_instance_t* vf){ + if(vf->uninit) vf->uninit(vf); + free_mp_image(vf->imgctx.static_images[0]); + free_mp_image(vf->imgctx.static_images[1]); + free_mp_image(vf->imgctx.temp_images[0]); + free_mp_image(vf->imgctx.export_images[0]); + free(vf); +} + +void vf_uninit_filter_chain(vf_instance_t* vf){ + while(vf){ + vf_instance_t* next=vf->next; + vf_uninit_filter(vf); + vf=next; + } +}