Revision b59dd1ea

View differences:

libavfilter/avfiltergraph.c
34 34

  
35 35
void avfilter_graph_free(AVFilterGraph *graph)
36 36
{
37
    for(; graph->filter_count > 0; graph->filter_count --)
37
    for (; graph->filter_count > 0; graph->filter_count --)
38 38
        avfilter_free(graph->filters[graph->filter_count - 1]);
39 39
    av_freep(&graph->scale_sws_opts);
40 40
    av_freep(&graph->filters);
......
79 79
    AVFilterContext *filt;
80 80
    int i, j;
81 81

  
82
    for (i=0; i < graph->filter_count; i++) {
82
    for (i = 0; i < graph->filter_count; i++) {
83 83
        filt = graph->filters[i];
84 84

  
85 85
        for (j = 0; j < filt->input_count; j++) {
......
125 125
{
126 126
    int i;
127 127

  
128
    for(i = 0; i < graph->filter_count; i ++)
129
        if(graph->filters[i]->name && !strcmp(name, graph->filters[i]->name))
128
    for (i = 0; i < graph->filter_count; i++)
129
        if (graph->filters[i]->name && !strcmp(name, graph->filters[i]->name))
130 130
            return graph->filters[i];
131 131

  
132 132
    return NULL;
......
139 139
    char inst_name[30];
140 140

  
141 141
    /* ask all the sub-filters for their supported media formats */
142
    for(i = 0; i < graph->filter_count; i ++) {
143
        if(graph->filters[i]->filter->query_formats)
142
    for (i = 0; i < graph->filter_count; i++) {
143
        if (graph->filters[i]->filter->query_formats)
144 144
            graph->filters[i]->filter->query_formats(graph->filters[i]);
145 145
        else
146 146
            avfilter_default_query_formats(graph->filters[i]);
147 147
    }
148 148

  
149 149
    /* go through and merge as many format lists as possible */
150
    for(i = 0; i < graph->filter_count; i ++) {
150
    for (i = 0; i < graph->filter_count; i++) {
151 151
        AVFilterContext *filter = graph->filters[i];
152 152

  
153
        for(j = 0; j < filter->input_count; j ++) {
153
        for (j = 0; j < filter->input_count; j++) {
154 154
            AVFilterLink *link = filter->inputs[j];
155
            if(link && link->in_formats != link->out_formats) {
156
                if(!avfilter_merge_formats(link->in_formats,
157
                                           link->out_formats)) {
155
            if (link && link->in_formats != link->out_formats) {
156
                if (!avfilter_merge_formats(link->in_formats,
157
                                            link->out_formats)) {
158 158
                    AVFilterContext *scale;
159 159
                    char scale_args[256];
160 160
                    /* couldn't merge format lists. auto-insert scale filter */
......
187 187

  
188 188
static void pick_format(AVFilterLink *link)
189 189
{
190
    if(!link || !link->in_formats)
190
    if (!link || !link->in_formats)
191 191
        return;
192 192

  
193 193
    link->in_formats->format_count = 1;
......
201 201
{
202 202
    int i, j;
203 203

  
204
    for(i = 0; i < graph->filter_count; i ++) {
204
    for (i = 0; i < graph->filter_count; i++) {
205 205
        AVFilterContext *filter = graph->filters[i];
206 206

  
207
        for(j = 0; j < filter->input_count; j ++)
207
        for (j = 0; j < filter->input_count; j++)
208 208
            pick_format(filter->inputs[j]);
209
        for(j = 0; j < filter->output_count; j ++)
209
        for (j = 0; j < filter->output_count; j++)
210 210
            pick_format(filter->outputs[j]);
211 211
    }
212 212
}
......
214 214
int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
215 215
{
216 216
    /* find supported formats from sub-filters, and merge along links */
217
    if(query_formats(graph, log_ctx))
217
    if (query_formats(graph, log_ctx))
218 218
        return -1;
219 219

  
220 220
    /* Once everything is merged, it's possible that we'll still have

Also available in: Unified diff