Browse code

Merge two ifs Commited in SoC by Vitor Sessak on 2008-04-03 16:44:27

Originally committed as revision 12751 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak authored on 2008/04/05 05:09:40
Showing 1 changed files
... ...
@@ -68,20 +68,16 @@ static int query_formats(AVFilterGraph *graph)
68 68
         AVFilterContext *filter = graph->filters[i];
69 69
 
70 70
         for(j = 0; j < filter->input_count; j ++) {
71
-            AVFilterLink *link;
72
-            if(!(link = filter->inputs[j]))
73
-                continue;
74
-            if(link->in_formats != link->out_formats) {
71
+            AVFilterLink *link = filter->inputs[j];
72
+            if(link && link->in_formats != link->out_formats) {
75 73
                 if(!avfilter_merge_formats(link->in_formats,
76 74
                                            link->out_formats)) {
77 75
                     /* couldn't merge format lists. auto-insert scale filter */
78
-                    AVFilterContext *scale;
76
+                    AVFilterContext *scale =
77
+                        avfilter_open(avfilter_get_by_name("scale"), NULL);
79 78
 
80
-                    if(!(scale =
81
-                         avfilter_open(avfilter_get_by_name("scale"), NULL)))
82
-                        return -1;
83
-                    if(scale->filter->init(scale, NULL, NULL) ||
84
-                       avfilter_insert_filter(link, scale, 0, 0)) {
79
+                    if(!scale || scale->filter->init(scale, NULL, NULL) ||
80
+                                 avfilter_insert_filter(link, scale, 0, 0)) {
85 81
                         avfilter_destroy(scale);
86 82
                         return -1;
87 83
                     }