Originally committed as revision 13343 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/graphparser.c (1 of 1 file). Show all
Unified · Split
| @@ -94,14 +94,15 @@ static char *consume_string(const char **buf) · 93 unmodified lines | |||
| 94 | * @arg name a pointer (that need to be free'd after use) to the name between | 94 | * @arg name a pointer (that need to be free'd after use) to the name between |
| 95 | * parenthesis | 95 | * parenthesis |
| 96 | */ | 96 | */ |
| 97 | static void parse_link_name(const char **buf, char **name, AVClass *log_ctx) | 97 | static char *parse_link_name(const char **buf, AVClass *log_ctx) |
| 98 | { | 98 | { |
| 99 | const char *start = *buf; | 99 | const char *start = *buf; |
| 100 | char *name; | ||
| 100 | (*buf)++; | 101 | (*buf)++; |
| 101 | 102 | ||
| 102 | *name = consume_string(buf); | 103 | name = consume_string(buf); |
| 103 | 104 | ||
| 104 | if(!*name[0]) { | 105 | if(!name[0]) { |
| 105 | av_log(log_ctx, AV_LOG_ERROR, | 106 | av_log(log_ctx, AV_LOG_ERROR, |
| 106 | "Bad (empty?) label found in the following: \"%s\".\n", start); | 107 | "Bad (empty?) label found in the following: \"%s\".\n", start); |
| 107 | goto fail; | 108 | goto fail; |
| @@ -111,8 +112,10 @@ static void parse_link_name(const char **buf, char **name, AVClass *log_ctx) · 3 unmodified lines | |||
| 111 | av_log(log_ctx, AV_LOG_ERROR, | 112 | av_log(log_ctx, AV_LOG_ERROR, |
| 112 | "Mismatched '[' found in the following: \"%s\".\n", start); | 113 | "Mismatched '[' found in the following: \"%s\".\n", start); |
| 113 | fail: | 114 | fail: |
| 114 | av_freep(name); | 115 | av_freep(&name); |
| 115 | } | 116 | } |
| 117 | |||
| 118 | return name; | ||
| 116 | } | 119 | } |
| 117 | 120 | ||
| 118 | static AVFilterContext *create_filter(AVFilterGraph *ctx, int index, | 121 | static AVFilterContext *create_filter(AVFilterGraph *ctx, int index, |
| @@ -255,12 +258,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 136 unmodified lines | |||
| 255 | int pad = 0; | 258 | int pad = 0; |
| 256 | 259 | ||
| 257 | while(**buf == '[') { | 260 | while(**buf == '[') { |
| 258 | char *name; | 261 | char *name = parse_link_name(buf, log_ctx); |
| 259 | AVFilterInOut *link_to_add; | 262 | AVFilterInOut *link_to_add; |
| 260 | AVFilterInOut *match; | 263 | AVFilterInOut *match; |
| 261 | 264 | ||
| 262 | parse_link_name(buf, &name, log_ctx); | ||
| 263 | |||
| 264 | if(!name) | 265 | if(!name) |
| 265 | return -1; | 266 | return -1; |
| 266 | 267 | ||
| @@ -301,14 +302,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 34 unmodified lines | |||
| 301 | int pad = 0; | 302 | int pad = 0; |
| 302 | 303 | ||
| 303 | while(**buf == '[') { | 304 | while(**buf == '[') { |
| 304 | char *name; | 305 | char *name = parse_link_name(buf, log_ctx); |
| 305 | AVFilterInOut *match; | 306 | AVFilterInOut *match; |
| 306 | 307 | ||
| 307 | AVFilterInOut *input = *currInputs; | 308 | AVFilterInOut *input = *currInputs; |
| 308 | *currInputs = (*currInputs)->next; | 309 | *currInputs = (*currInputs)->next; |
| 309 | 310 | ||
| 310 | parse_link_name(buf, &name, log_ctx); | ||
| 311 | |||
| 312 | if(!name) | 311 | if(!name) |
| 313 | return -1; | 312 | return -1; |
| 314 | 313 | ||