| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2009 Stefano Sabatini | 2 * Copyright (c) 2009 Stefano Sabatini |
| 3 * | 3 * |
| 4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
| 5 * | 5 * |
| 6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 filter_args = argv[2]; | 42 filter_args = argv[2]; |
| 43 | 43 |
| 44 avfilter_register_all(); | 44 avfilter_register_all(); |
| 45 | 45 |
| 46 /* get a corresponding filter and open it */ | 46 /* get a corresponding filter and open it */ |
| 47 if (!(filter = avfilter_get_by_name(filter_name))) { | 47 if (!(filter = avfilter_get_by_name(filter_name))) { |
| 48 fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name); | 48 fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name); |
| 49 return 1; | 49 return 1; |
| 50 } | 50 } |
| 51 | 51 |
| 52 if (!(filter_ctx = avfilter_open(filter, NULL))) { | 52 if (avfilter_open(&filter_ctx, filter, NULL) < 0) { |
| 53 fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_nam
e); | 53 fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_nam
e); |
| 54 return 1; | 54 return 1; |
| 55 } | 55 } |
| 56 if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) { | 56 if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) { |
| 57 fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n",
filter_name, filter_args); | 57 fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n",
filter_name, filter_args); |
| 58 return 1; | 58 return 1; |
| 59 } | 59 } |
| 60 | 60 |
| 61 /* create a link for each of the input pads */ | 61 /* create a link for each of the input pads */ |
| 62 for (i = 0; i < filter_ctx->input_count; i++) { | 62 for (i = 0; i < filter_ctx->input_count; i++) { |
| 63 AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); | 63 AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); |
| 64 link->type = filter_ctx->filter->inputs[i].type; | 64 link->type = filter_ctx->filter->inputs[i].type; |
| 65 filter_ctx->inputs[i] = link; | 65 filter_ctx->inputs[i] = link; |
| 66 } | 66 } |
| 67 for (i = 0; i < filter_ctx->output_count; i++) { | 67 for (i = 0; i < filter_ctx->output_count; i++) { |
| 68 AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); | 68 AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); |
| 69 link->type = filter_ctx->filter->inputs[i].type; | 69 link->type = filter_ctx->filter->outputs[i].type; |
| 70 filter_ctx->outputs[i] = link; | 70 filter_ctx->outputs[i] = link; |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (filter->query_formats) | 73 if (filter->query_formats) |
| 74 filter->query_formats(filter_ctx); | 74 filter->query_formats(filter_ctx); |
| 75 else | 75 else |
| 76 avfilter_default_query_formats(filter_ctx); | 76 avfilter_default_query_formats(filter_ctx); |
| 77 | 77 |
| 78 /* print the supported formats in input */ | 78 /* print the supported formats in input */ |
| 79 for (i = 0; i < filter_ctx->input_count; i++) { | 79 for (i = 0; i < filter_ctx->input_count; i++) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 for (j = 0; j < fmts->format_count; j++) | 90 for (j = 0; j < fmts->format_count; j++) |
| 91 printf("OUTPUT[%d] %s: %s\n", | 91 printf("OUTPUT[%d] %s: %s\n", |
| 92 i, filter_ctx->filter->outputs[i].name, | 92 i, filter_ctx->filter->outputs[i].name, |
| 93 av_pix_fmt_descriptors[fmts->formats[j]].name); | 93 av_pix_fmt_descriptors[fmts->formats[j]].name); |
| 94 } | 94 } |
| 95 | 95 |
| 96 avfilter_destroy(filter_ctx); | 96 avfilter_destroy(filter_ctx); |
| 97 fflush(stdout); | 97 fflush(stdout); |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| OLD | NEW |