History

Split openLinks linked list into openInputs and openOutputs Commited in SoC by Vitor Sessak on 2008-05-24 17:20:09

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

Vitor Sessak committed 18 years ago

Commit e2b5fda1 parent 64fbf5e2 files · +23 −41Browse files

Showing the changes to libavfilter/graphparser.c (1 of 2 files). Show all

Unified · Split

libavfilter/graphparser.c+21−34
@@ -212,7 +212,7 @@ static void insert_inout(AVFilterInOut **inouts, AVFilterInOut *element) · 211 unmodified lines
212212
213213 static int link_filter_inouts(AVFilterContext *filter,
214214 AVFilterInOut **currInputs,
215− AVFilterInOut **openLinks, AVClass *log_ctx)
215+ AVFilterInOut **openInputs, AVClass *log_ctx)
216216 {
217217 int pad = filter->input_count;
218218
@@ -249,7 +249,6 @@ static int link_filter_inouts(AVFilterContext *filter, · 30 unmodified lines
249249 pad = filter->output_count;
250250 while(pad--) {
251251 AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut));
252− currlinkn->type = LinkTypeOut;
253252 currlinkn->filter = filter;
254253 currlinkn->pad_idx = pad;
255254 insert_inout(currInputs, currlinkn);
@@ -259,7 +258,7 @@ static int link_filter_inouts(AVFilterContext *filter, · 3 unmodified lines
259258 }
260259
261260 static int parse_inputs(const char **buf, AVFilterInOut **currInputs,
262− AVFilterInOut **openLinks, AVClass *log_ctx)
261+ AVFilterInOut **openOutputs, AVClass *log_ctx)
263262 {
264263 int pad = 0;
265264
@@ -270,23 +269,15 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 4 unmodified lines
270269 if(!name)
271270 return -1;
272271
273− /* First check if the label is not in the openLinks list */
274− match = extract_inout(name, openLinks);
272+ /* First check if the label is not in the openOutputs list */
273+ match = extract_inout(name, openOutputs);
275274
276275 if(match) {
277− /* A label of a open link. Make it one of the inputs of the next
278− filter */
279− if(match->type != LinkTypeOut) {
280− av_log(log_ctx, AV_LOG_ERROR,
281− "Label \"%s\" appears twice as input!\n", match->name);
282− return -1;
283− }
284276 av_free(name);
285277 } else {
286278 /* Not in the list, so add it as an input */
287279 match = av_mallocz(sizeof(AVFilterInOut));
288280 match->name = name;
289− match->type = LinkTypeIn;
290281 match->pad_idx = pad;
291282 }
292283
@@ -300,7 +291,8 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 7 unmodified lines
300291 }
301292
302293 static int parse_outputs(const char **buf, AVFilterInOut **currInputs,
303− AVFilterInOut **openLinks, AVClass *log_ctx)
294+ AVFilterInOut **openInputs,
295+ AVFilterInOut **openOutputs, AVClass *log_ctx)
304296 {
305297 int pad = 0;
306298
@@ -314,17 +306,10 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 7 unmodified lines
314306 if(!name)
315307 return -1;
316308
317− /* First check if the label is not in the openLinks list */
318− match = extract_inout(name, openLinks);
309+ /* First check if the label is not in the openInputs list */
310+ match = extract_inout(name, openInputs);
319311
320312 if(match) {
321− /* A label of a open link. Link it. */
322− if(match->type != LinkTypeIn) {
323− av_log(log_ctx, AV_LOG_ERROR,
324− "Label \"%s\" appears twice as output!\n", match->name);
325− return -1;
326− }
327−
328313 if(link_filter(input->filter, input->pad_idx,
329314 match->filter, match->pad_idx, log_ctx) < 0)
330315 return -1;
@@ -333,9 +318,7 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 2 unmodified lines
333318 av_free(match);
334319 av_free(input);
335320 } else {
336− /* Not in the list, so add the first input as a openLink */
337− input->next = *openLinks;
338− input->type = LinkTypeOut;
321+ /* Not in the list, so add the first input as a openOutput */
339322 input->name = name;
340323 insert_inout(openOutputs, input);
341324 }
@@ -347,7 +330,8 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 5 unmodified lines
347330 }
348331
349332 int avfilter_parse_graph(AVFilterGraph *graph, const char *filters,
350− AVFilterInOut *openLinks, AVClass *log_ctx)
333+ AVFilterInOut *openInputs,
334+ AVFilterInOut *openOutputs, AVClass *log_ctx)
351335 {
352336 int index = 0;
353337 char chr = 0;
@@ -358,7 +342,7 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 4 unmodified lines
358342 AVFilterContext *filter;
359343 filters += consume_whitespace(filters);
360344
361− if(parse_inputs(&filters, &currInputs, &openLinks, log_ctx) < 0)
345+ if(parse_inputs(&filters, &currInputs, &openOutputs, log_ctx) < 0)
362346 goto fail;
363347
364348 filter = parse_filter(&filters, graph, index, log_ctx);
@@ -369,14 +353,15 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 4 unmodified lines
369353 if(filter->input_count == 1 && !currInputs && !index) {
370354 /* First input can be ommitted if it is "[in]" */
371355 const char *tmp = "[in]";
372− if(parse_inputs(&tmp, &currInputs, &openLinks, log_ctx))
356+ if(parse_inputs(&tmp, &currInputs, &openOutputs, log_ctx) < 0)
373357 goto fail;
374358 }
375359
376− if(link_filter_inouts(filter, &currInputs, &openLinks, log_ctx) < 0)
360+ if(link_filter_inouts(filter, &currInputs, &openInputs, log_ctx) < 0)
377361 goto fail;
378362
379− if(parse_outputs(&filters, &currInputs, &openLinks, log_ctx))
363+ if(parse_outputs(&filters, &currInputs, &openInputs, &openOutputs,
364+ log_ctx) < 0)
380365 goto fail;
381366
382367 filters += consume_whitespace(filters);
@@ -391,10 +376,11 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 8 unmodified lines
391376 index++;
392377 } while(chr == ',' || chr == ';');
393378
394− if(openLinks && !strcmp(openLinks->name, "out") && currInputs) {
379+ if(openInputs && !strcmp(openInputs->name, "out") && currInputs) {
395380 /* Last output can be ommitted if it is "[out]" */
396381 const char *tmp = "[out]";
397− if(parse_outputs(&tmp, &currInputs, &openLinks, log_ctx) < 0)
382+ if(parse_outputs(&tmp, &currInputs, &openInputs,
383+ &openOutputs, log_ctx) < 0)
398384 goto fail;
399385 }
400386
@@ -402,7 +388,8 @@ int avfilter_parse_graph(AVFilterGraph *graph, const char *filters, · 1 unmodified line
402388
403389 fail:
404390 avfilter_destroy_graph(graph);
405− free_inout(openLinks);
391+ free_inout(openInputs);
392+ free_inout(openOutputs);
406393 free_inout(currInputs);
407394 return -1;
408395 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t