[SCM] libav/experimental: Rework link property configuration system. This can now handle filters which are added to graphs out of order, including auto-inserted scale filters. As an added bonus, it can now detect circular filter chains which wouldn't work anyway.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:14:36 UTC 2013


The following commit has been merged in the experimental branch:
commit 698181056d5ef207a69faeda547e7909d740d0e2
Author: Vitor Sessak <vitor1001 at gmail.com>
Date:   Fri Feb 15 21:39:41 2008 +0000

    Rework link property configuration system.
    This can now handle filters which are added to graphs out of order,
    including auto-inserted scale filters.  As an added bonus, it can
    now detect circular filter chains which wouldn't work anyway.
    
    Commited in SoC by Bobby Bingham on 2007-12-24 03:22:10
    
    Originally committed as revision 12031 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 2e44dce..315afe2 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -125,23 +125,41 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
     return 0;
 }
 
-int avfilter_config_link(AVFilterLink *link)
+int avfilter_config_links(AVFilterContext *filter)
 {
     int (*config_link)(AVFilterLink *);
+    unsigned i;
 
-    if(!link)
-        return 0;
+    for(i = 0; i < filter->input_count; i ++) {
+        AVFilterLink *link;
+
+        if(!(link = filter->inputs[i])) continue;
+
+        switch(link->init_state) {
+        case AVLINK_INIT:
+            continue;
+        case AVLINK_STARTINIT:
+            av_log(filter, AV_LOG_ERROR, "circular filter chain detected\n");
+            return -1;
+        case AVLINK_UNINIT:
+            link->init_state = AVLINK_STARTINIT;
+
+            if(avfilter_config_links(link->src))
+                return -1;
 
     if(!(config_link = link_spad(link).config_props))
         config_link  = avfilter_default_config_output_link;
     if(config_link(link))
             return -1;
 
-    if(!(config_link = link_dpad(link).config_props))
-        config_link  = avfilter_default_config_input_link;
+    if((config_link = link_dpad(link).config_props))
     if(config_link(link))
             return -1;
 
+            link->init_state = AVLINK_INIT;
+        }
+    }
+
     return 0;
 }
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list