diff libmpcodecs/vf.c @ 14183:c9ff4fe2caaf

add the flip filter at the end of the filter chain. Fixes -vf pp -flip and the flip option in the Gui.
author reimar
date Sat, 18 Dec 2004 14:06:35 +0000
parents 9e81af56f554
children 1fab95e4513c
line wrap: on
line diff
--- a/libmpcodecs/vf.c	Sat Dec 18 11:26:01 2004 +0000
+++ b/libmpcodecs/vf.c	Sat Dec 18 14:06:35 2004 +0000
@@ -473,6 +473,26 @@
   return vf_open_plugin(filter_list,next,name,args);
 }
 
+/**
+ * \brief adds a filter before the last one (which should be the vo filter).
+ * \param vf start of the filter chain.
+ * \param name name of the filter to add.
+ * \param args argument list for the filter.
+ * \return pointer to the filter instance that was created.
+ */
+vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args) {
+  vf_instance_t *vo, *prev = NULL, *new;
+  // Find the last filter (should be vf_vo)
+  for (vo = *vf; vo->next; vo = vo->next)
+    prev = vo;
+  new = vf_open_filter(vo, name, args);
+  if (prev)
+    prev->next = new;
+  else
+    *vf = new;
+  return new;
+}
+
 //============================================================================
 
 unsigned int vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int preferred){