changeset 5526:30679378f814

free old context, really use query_format
author arpi
date Sun, 07 Apr 2002 23:30:59 +0000
parents 80679a6ccb4e
children 04c5047ead0c
files libmpcodecs/vf_scale.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_scale.c	Sun Apr 07 22:45:07 2002 +0000
+++ b/libmpcodecs/vf_scale.c	Sun Apr 07 23:30:59 2002 +0000
@@ -37,6 +37,7 @@
 	unsigned int flags, unsigned int outfmt){
     unsigned int* p=outfmt_list;
     unsigned int best=0;
+    
     // find the best outfmt:
     while(*p){
 	int ret=vf_next_query_format(vf,*p);
@@ -57,6 +58,9 @@
     printf("SwScale scaling %dx%d %s to %dx%d %s  \n",
 	width,height,vo_format_name(outfmt),
 	vf->priv->w,vf->priv->h,vo_format_name(best));
+
+    // free old ctx:
+    if(vf->priv->ctx) freeSwsContext(vf->priv->ctx);
     
     // new swscaler:
     vf->priv->ctx=getSwsContextFromCmdLine(width,height,outfmt,
@@ -108,6 +112,7 @@
 static int open(vf_instance_t *vf, char* args){
     vf->config=config;
     vf->put_image=put_image;
+    vf->query_format=query_format;
     vf->priv=malloc(sizeof(struct vf_priv_s));
     // TODO: parse args ->
     vf->priv->ctx=NULL;