Originally committed as revision 16356 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/graphparser.c (1 of 1 file). Show all
Unified · Split
| @@ -211,13 +211,13 @@ static void insert_inout(AVFilterInOut **inouts, AVFilterInOut *element) · 210 unmodified lines | |||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static int link_filter_inouts(AVFilterContext *filter, | 213 | static int link_filter_inouts(AVFilterContext *filter, |
| 214 | AVFilterInOut **currInputs, | 214 | AVFilterInOut **curr_inputs, |
| 215 | AVFilterInOut **openInputs, AVClass *log_ctx) | 215 | AVFilterInOut **open_inputs, AVClass *log_ctx) |
| 216 | { | 216 | { |
| 217 | int pad = filter->input_count; | 217 | int pad = filter->input_count; |
| 218 | 218 | ||
| 219 | while(pad--) { | 219 | while(pad--) { |
| 220 | AVFilterInOut *p = *currInputs; | 220 | AVFilterInOut *p = *curr_inputs; |
| 221 | if(!p) { | 221 | if(!p) { |
| 222 | av_log(log_ctx, AV_LOG_ERROR, | 222 | av_log(log_ctx, AV_LOG_ERROR, |
| 223 | "Not enough inputs specified for the \"%s\" filter.\n", | 223 | "Not enough inputs specified for the \"%s\" filter.\n", |
| @@ -225,7 +225,7 @@ static int link_filter_inouts(AVFilterContext *filter, · 1 unmodified line | |||
| 225 | return -1; | 225 | return -1; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | *currInputs = (*currInputs)->next; | 228 | *curr_inputs = (*curr_inputs)->next; |
| 229 | 229 | ||
| 230 | if(p->filter) { | 230 | if(p->filter) { |
| 231 | if(link_filter(p->filter, p->pad_idx, filter, pad, log_ctx)) | 231 | if(link_filter(p->filter, p->pad_idx, filter, pad, log_ctx)) |
| @@ -235,11 +235,11 @@ static int link_filter_inouts(AVFilterContext *filter, · 3 unmodified lines | |||
| 235 | } else { | 235 | } else { |
| 236 | p->filter = filter; | 236 | p->filter = filter; |
| 237 | p->pad_idx = pad; | 237 | p->pad_idx = pad; |
| 238 | insert_inout(openInputs, p); | 238 | insert_inout(open_inputs, p); |
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | if(*currInputs) { | 242 | if(*curr_inputs) { |
| 243 | av_log(log_ctx, AV_LOG_ERROR, | 243 | av_log(log_ctx, AV_LOG_ERROR, |
| 244 | "Too many inputs specified for the \"%s\" filter.\n", | 244 | "Too many inputs specified for the \"%s\" filter.\n", |
| 245 | filter->filter->name); | 245 | filter->filter->name); |
| @@ -251,14 +251,14 @@ static int link_filter_inouts(AVFilterContext *filter, · 5 unmodified lines | |||
| 251 | AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut)); | 251 | AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut)); |
| 252 | currlinkn->filter = filter; | 252 | currlinkn->filter = filter; |
| 253 | currlinkn->pad_idx = pad; | 253 | currlinkn->pad_idx = pad; |
| 254 | insert_inout(currInputs, currlinkn); | 254 | insert_inout(curr_inputs, currlinkn); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | return 0; | 257 | return 0; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | static int parse_inputs(const char **buf, AVFilterInOut **currInputs, | 260 | static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs, |
| 261 | AVFilterInOut **openOutputs, AVClass *log_ctx) | 261 | AVFilterInOut **open_outputs, AVClass *log_ctx) |
| 262 | { | 262 | { |
| 263 | int pad = 0; | 263 | int pad = 0; |
| 264 | 264 | ||
| @@ -269,8 +269,8 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 4 unmodified lines | |||
| 269 | if(!name) | 269 | if(!name) |
| 270 | return -1; | 270 | return -1; |
| 271 | 271 | ||
| 272 | /* First check if the label is not in the openOutputs list */ | 272 | /* First check if the label is not in the open_outputs list */ |
| 273 | match = extract_inout(name, openOutputs); | 273 | match = extract_inout(name, open_outputs); |
| 274 | 274 | ||
| 275 | if(match) { | 275 | if(match) { |
| 276 | av_free(name); | 276 | av_free(name); |
| @@ -281,7 +281,7 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 4 unmodified lines | |||
| 281 | match->pad_idx = pad; | 281 | match->pad_idx = pad; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | insert_inout(currInputs, match); | 284 | insert_inout(curr_inputs, match); |
| 285 | 285 | ||
| 286 | *buf += consume_whitespace(*buf); | 286 | *buf += consume_whitespace(*buf); |
| 287 | pad++; | 287 | pad++; |
| @@ -290,9 +290,9 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 2 unmodified lines | |||
| 290 | return pad; | 290 | return pad; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | static int parse_outputs(const char **buf, AVFilterInOut **currInputs, | 293 | static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs, |
| 294 | AVFilterInOut **openInputs, | 294 | AVFilterInOut **open_inputs, |
| 295 | AVFilterInOut **openOutputs, AVClass *log_ctx) | 295 | AVFilterInOut **open_outputs, AVClass *log_ctx) |
| 296 | { | 296 | { |
| 297 | int pad = 0; | 297 | int pad = 0; |
| 298 | 298 | ||
| @@ -300,14 +300,14 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 1 unmodified line | |||
| 300 | char *name = parse_link_name(buf, log_ctx); | 300 | char *name = parse_link_name(buf, log_ctx); |
| 301 | AVFilterInOut *match; | 301 | AVFilterInOut *match; |
| 302 | 302 | ||
| 303 | AVFilterInOut *input = *currInputs; | 303 | AVFilterInOut *input = *curr_inputs; |
| 304 | *currInputs = (*currInputs)->next; | 304 | *curr_inputs = (*curr_inputs)->next; |
| 305 | 305 | ||
| 306 | if(!name) | 306 | if(!name) |
| 307 | return -1; | 307 | return -1; |
| 308 | 308 | ||
| 309 | /* First check if the label is not in the openInputs list */ | 309 | /* First check if the label is not in the open_inputs list */ |
| 310 | match = extract_inout(name, openInputs); | 310 | match = extract_inout(name, open_inputs); |
| 311 | 311 | ||
| 312 | if(match) { | 312 | if(match) { |
| 313 | if(link_filter(input->filter, input->pad_idx, | 313 | if(link_filter(input->filter, input->pad_idx, |
| @@ -318,9 +318,9 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 4 unmodified lines | |||
| 318 | av_free(match); | 318 | av_free(match); |
| 319 | av_free(input); | 319 | av_free(input); |
| 320 | } else { | 320 | } else { |
| 321 | /* Not in the list, so add the first input as a openOutput */ | 321 | /* Not in the list, so add the first input as a open_output */ |
| 322 | input->name = name; | 322 | input->name = name; |
| 323 | insert_inout(openOutputs, input); | 323 | insert_inout(open_outputs, input); |
| 324 | } | 324 | } |
| 325 | *buf += consume_whitespace(*buf); | 325 | *buf += consume_whitespace(*buf); |
| 326 | pad++; | 326 | pad++; |
| @@ -330,19 +330,19 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 3 unmodified lines | |||
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, | 332 | int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, |
| 333 | AVFilterInOut *openInputs, | 333 | AVFilterInOut *open_inputs, |
| 334 | AVFilterInOut *openOutputs, AVClass *log_ctx) | 334 | AVFilterInOut *open_outputs, AVClass *log_ctx) |
| 335 | { | 335 | { |
| 336 | int index = 0; | 336 | int index = 0; |
| 337 | char chr = 0; | 337 | char chr = 0; |
| 338 | 338 | ||
| 339 | AVFilterInOut *currInputs = NULL; | 339 | AVFilterInOut *curr_inputs = NULL; |
| 340 | 340 | ||
| 341 | do { | 341 | do { |
| 342 | AVFilterContext *filter; | 342 | AVFilterContext *filter; |
| 343 | filters += consume_whitespace(filters); | 343 | filters += consume_whitespace(filters); |
| 344 | 344 | ||
| 345 | if(parse_inputs(&filters, &currInputs, &openOutputs, log_ctx) < 0) | 345 | if(parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx) < 0) |
| 346 | goto fail; | 346 | goto fail; |
| 347 | 347 | ||
| 348 | filter = parse_filter(&filters, graph, index, log_ctx); | 348 | filter = parse_filter(&filters, graph, index, log_ctx); |
| @@ -350,24 +350,24 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 1 unmodified line | |||
| 350 | if(!filter) | 350 | if(!filter) |
| 351 | goto fail; | 351 | goto fail; |
| 352 | 352 | ||
| 353 | if(filter->input_count == 1 && !currInputs && !index) { | 353 | if(filter->input_count == 1 && !curr_inputs && !index) { |
| 354 | /* First input can be omitted if it is "[in]" */ | 354 | /* First input can be omitted if it is "[in]" */ |
| 355 | const char *tmp = "[in]"; | 355 | const char *tmp = "[in]"; |
| 356 | if(parse_inputs(&tmp, &currInputs, &openOutputs, log_ctx) < 0) | 356 | if(parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx) < 0) |
| 357 | goto fail; | 357 | goto fail; |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | if(link_filter_inouts(filter, &currInputs, &openInputs, log_ctx) < 0) | 360 | if(link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx) < 0) |
| 361 | goto fail; | 361 | goto fail; |
| 362 | 362 | ||
| 363 | if(parse_outputs(&filters, &currInputs, &openInputs, &openOutputs, | 363 | if(parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs, |
| 364 | log_ctx) < 0) | 364 | log_ctx) < 0) |
| 365 | goto fail; | 365 | goto fail; |
| 366 | 366 | ||
| 367 | filters += consume_whitespace(filters); | 367 | filters += consume_whitespace(filters); |
| 368 | chr = *filters++; | 368 | chr = *filters++; |
| 369 | 369 | ||
| 370 | if(chr == ';' && currInputs) { | 370 | if(chr == ';' && curr_inputs) { |
| 371 | av_log(log_ctx, AV_LOG_ERROR, | 371 | av_log(log_ctx, AV_LOG_ERROR, |
| 372 | "Could not find a output to link when parsing \"%s\"\n", | 372 | "Could not find a output to link when parsing \"%s\"\n", |
| 373 | filters - 1); | 373 | filters - 1); |
| @@ -376,11 +376,11 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 2 unmodified lines | |||
| 376 | index++; | 376 | index++; |
| 377 | } while(chr == ',' || chr == ';'); | 377 | } while(chr == ',' || chr == ';'); |
| 378 | 378 | ||
| 379 | if(openInputs && !strcmp(openInputs->name, "out") && currInputs) { | 379 | if(open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) { |
| 380 | /* Last output can be omitted if it is "[out]" */ | 380 | /* Last output can be omitted if it is "[out]" */ |
| 381 | const char *tmp = "[out]"; | 381 | const char *tmp = "[out]"; |
| 382 | if(parse_outputs(&tmp, &currInputs, &openInputs, | 382 | if(parse_outputs(&tmp, &curr_inputs, &open_inputs, |
| 383 | &openOutputs, log_ctx) < 0) | 383 | &open_outputs, log_ctx) < 0) |
| 384 | goto fail; | 384 | goto fail; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| @@ -388,8 +388,8 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 1 unmodified line | |||
| 388 | 388 | ||
| 389 | fail: | 389 | fail: |
| 390 | avfilter_destroy_graph(graph); | 390 | avfilter_destroy_graph(graph); |
| 391 | free_inout(openInputs); | 391 | free_inout(open_inputs); |
| 392 | free_inout(openOutputs); | 392 | free_inout(open_outputs); |
| 393 | free_inout(currInputs); | 393 | free_inout(curr_inputs); |
| 394 | return -1; | 394 | return -1; |
| 395 | } | 395 | } |