changeset 30349:74016937a51e

Remove any auto-inserted lavc filter. Makes sure it will not be around if we e.g. try again with a different codec, which can lead to -vo null being excessively slow.
author reimar
date Fri, 22 Jan 2010 23:19:59 +0000
parents afbbefa368ee
children 956cc6a392d7
files libmpcodecs/vd.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd.c	Fri Jan 22 22:10:28 2010 +0000
+++ b/libmpcodecs/vd.c	Fri Jan 22 23:19:59 2010 +0000
@@ -206,7 +206,7 @@
 	    goto csp_again;
 	} else
 	{ // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc
-	     vf_instance_t* vo, *vp = NULL, *ve;
+	     vf_instance_t* vo, *vp = NULL, *ve, *vpp = NULL;
 	     // Remove the scale filter if we added it ourself
 	     if(vf == sc) {
 	       ve = vf;
@@ -214,14 +214,21 @@
 	       vf_uninit_filter(ve);
 	     }
 	     // Find the last filter (vf_vo)
-	     for(vo = vf ; vo->next ; vo = vo->next)
+	     for(vo = vf ; vo->next ; vo = vo->next) {
+               vpp = vp;
 	       vp = vo;
+             }
 	     if(vo->query_format(vo,IMGFMT_MPEGPES) && (!vp || (vp && strcmp(vp->info->name,"lavc")))) {
 	       ve = vf_open_filter(vo,"lavc",NULL);
 	       if(vp) vp->next = ve;
 		 else vf = ve;
 	       goto csp_again;
 	     }
+	     if (vp && !strcmp(vp->info->name,"lavc")) {
+		if (vpp) vpp->next = vo;
+		else vf = vo;
+		vf_uninit_filter(vp);
+	     }
 	}
 	mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_VOincompCodec);
 	sh->vf_initialized=-1;