diff options
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/dec_video.c | 1 | ||||
-rw-r--r-- | libmpcodecs/mp_image.h | 8 | ||||
-rw-r--r-- | libmpcodecs/vf.c | 16 | ||||
-rw-r--r-- | libmpcodecs/vf.h | 3 |
4 files changed, 28 insertions, 0 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index a1d57dda4e..211ebdc856 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -131,6 +131,7 @@ void uninit_video(sh_video_t *sh_video){ 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; } diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h index c92e213ff0..d818f21f2e 100644 --- a/libmpcodecs/mp_image.h +++ b/libmpcodecs/mp_image.h @@ -97,4 +97,12 @@ static inline mp_image_t* new_mp_image(int w,int h){ 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 diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 25d59838d4..b46d58720a 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -299,3 +299,19 @@ vf_instance_t* append_filters(vf_instance_t* last){ //============================================================================ +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; + } +} diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h index 4b3013eacf..6b70004935 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h @@ -74,3 +74,6 @@ void vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi); vf_instance_t* append_filters(vf_instance_t* last); +void vf_uninit_filter(vf_instance_t* vf); +void vf_uninit_filter_chain(vf_instance_t* vf); + |