[FFmpeg-cvslog] r25217 - trunk/libavfilter/avfilter.c

stefano subversion
Mon Sep 27 03:17:46 CEST 2010


Author: stefano
Date: Mon Sep 27 03:17:46 2010
New Revision: 25217

Log:
Make avfilter_destroy() code less convoluted, introducing a temporary
variable link.

Modified:
   trunk/libavfilter/avfilter.c

Modified: trunk/libavfilter/avfilter.c
==============================================================================
--- trunk/libavfilter/avfilter.c	Mon Sep 27 02:30:14 2010	(r25216)
+++ trunk/libavfilter/avfilter.c	Mon Sep 27 03:17:46 2010	(r25217)
@@ -526,27 +526,28 @@ int avfilter_open(AVFilterContext **filt
 void avfilter_destroy(AVFilterContext *filter)
 {
     int i;
+    AVFilterLink *link;
 
     if (filter->filter->uninit)
         filter->filter->uninit(filter);
 
     for (i = 0; i < filter->input_count; i++) {
-        if (filter->inputs[i]) {
-            if (filter->inputs[i]->src)
-                filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
-            avfilter_formats_unref(&filter->inputs[i]->in_formats);
-            avfilter_formats_unref(&filter->inputs[i]->out_formats);
+        if ((link = filter->inputs[i])) {
+            if (link->src)
+                link->src->outputs[link->srcpad] = NULL;
+            avfilter_formats_unref(&link->in_formats);
+            avfilter_formats_unref(&link->out_formats);
         }
-        av_freep(&filter->inputs[i]);
+        av_freep(&link);
     }
     for (i = 0; i < filter->output_count; i++) {
-        if (filter->outputs[i]) {
-            if (filter->outputs[i]->dst)
-                filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
-            avfilter_formats_unref(&filter->outputs[i]->in_formats);
-            avfilter_formats_unref(&filter->outputs[i]->out_formats);
+        if ((link = filter->outputs[i])) {
+            if (link->dst)
+                link->dst->inputs[link->dstpad] = NULL;
+            avfilter_formats_unref(&link->in_formats);
+            avfilter_formats_unref(&link->out_formats);
         }
-        av_freep(&filter->outputs[i]);
+        av_freep(&link);
     }
 
     av_freep(&filter->name);



More information about the ffmpeg-cvslog mailing list