Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -29,6 +29,7 @@ int main(int argc, char **argv) · 28 unmodified lines | |||
| 29 | { | 29 | { |
| 30 | AVFilter *filter; | 30 | AVFilter *filter; |
| 31 | AVFilterContext *filter_ctx; | 31 | AVFilterContext *filter_ctx; |
| 32 | AVFilterGraph *graph_ctx; | ||
| 32 | const char *filter_name; | 33 | const char *filter_name; |
| 33 | const char *filter_args = NULL; | 34 | const char *filter_args = NULL; |
| 34 | int i, j; | 35 | int i, j; |
| @@ -44,6 +45,11 @@ int main(int argc, char **argv) · 9 unmodified lines | |||
| 44 | if (argv[2]) | 45 | if (argv[2]) |
| 45 | filter_args = argv[2]; | 46 | filter_args = argv[2]; |
| 46 | 47 | ||
| 48 | /* allocate graph */ | ||
| 49 | graph_ctx = avfilter_graph_alloc(); | ||
| 50 | if (!graph_ctx) | ||
| 51 | return 1; | ||
| 52 | |||
| 47 | avfilter_register_all(); | 53 | avfilter_register_all(); |
| 48 | 54 | ||
| 49 | /* get a corresponding filter and open it */ | 55 | /* get a corresponding filter and open it */ |
| @@ -52,7 +58,8 @@ int main(int argc, char **argv) · 2 unmodified lines | |||
| 52 | return 1; | 58 | return 1; |
| 53 | } | 59 | } |
| 54 | 60 | ||
| 55 | if (avfilter_open(&filter_ctx, filter, NULL) < 0) { | 61 | /* open filter and add it to the graph */ |
| 62 | if (!(filter_ctx = avfilter_graph_alloc_filter(graph_ctx, filter, filter_name))) { | ||
| 56 | fprintf(stderr, "Impossible to open filter with name '%s'\n", | 63 | fprintf(stderr, "Impossible to open filter with name '%s'\n", |
| 57 | filter_name); | 64 | filter_name); |
| 58 | return 1; | 65 | return 1; |
| @@ -99,6 +106,7 @@ int main(int argc, char **argv) · 40 unmodified lines | |||
| 99 | } | 106 | } |
| 100 | 107 | ||
| 101 | avfilter_free(filter_ctx); | 108 | avfilter_free(filter_ctx); |
| 109 | avfilter_graph_free(&graph_ctx); | ||
| 102 | fflush(stdout); | 110 | fflush(stdout); |
| 103 | return 0; | 111 | return 0; |
| 104 | } | 112 | } |