| 41 | } |
| 42 | |
| 43 | int main(int argc, char **argv) |
| 44 | { |
| 45 | char *in_graph_desc, **out_dev_name; |
| 46 | int nb_out_dev = 0, nb_streams = 0; |
| 47 | AVFilterGraph *in_graph = NULL; |
| 48 | Stream *streams = NULL, *st; |
| 49 | AVFrame *frame = NULL; |
| 50 | int i, j, run = 1, ret; |
| 51 | |
| 52 | //av_log_set_level(AV_LOG_DEBUG); |
| 53 | |
| 54 | if (argc < 3) { |
| 55 | av_log(NULL, AV_LOG_ERROR, |
| 56 | "Usage: %s filter_graph dev:out [dev2:out2...]\n\n" |
| 57 | "Examples:\n" |
| 58 | "%s movie=file.nut:s=v+a xv:- alsa:default\n" |
| 59 | "%s movie=file.nut:s=v+a uncodedframecrc:pipe:0\n", |
| 60 | argv[0], argv[0], argv[0]); |
| 61 | exit(1); |
| 62 | } |
| 63 | in_graph_desc = argv[1]; |
| 64 | out_dev_name = argv + 2; |
| 65 | nb_out_dev = argc - 2; |
| 66 | |
| 67 | avdevice_register_all(); |
| 68 | |
| 69 | /* Create input graph */ |
| 70 | if (!(in_graph = avfilter_graph_alloc())) { |
| 71 | ret = AVERROR(ENOMEM); |
| 72 | av_log(NULL, AV_LOG_ERROR, "Unable to alloc graph graph: %s\n", |
| 73 | av_err2str(ret)); |
| 74 | goto fail; |
| 75 | } |
| 76 | ret = avfilter_graph_parse_ptr(in_graph, in_graph_desc, NULL, NULL, NULL); |
| 77 | if (ret < 0) { |
| 78 | av_log(NULL, AV_LOG_ERROR, "Unable to parse graph: %s\n", |
| 79 | av_err2str(ret)); |
| 80 | goto fail; |
| 81 | } |
| 82 | nb_streams = 0; |
| 83 | for (i = 0; i < in_graph->nb_filters; i++) { |
| 84 | AVFilterContext *f = in_graph->filters[i]; |
| 85 | for (j = 0; j < f->nb_inputs; j++) { |
| 86 | if (!f->inputs[j]) { |
| 87 | av_log(NULL, AV_LOG_ERROR, "Graph has unconnected inputs\n"); |
| 88 | ret = AVERROR(EINVAL); |
| 89 | goto fail; |
| 90 | } |
| 91 | } |
| 92 | for (j = 0; j < f->nb_outputs; j++) |
| 93 | if (!f->outputs[j]) |
| 94 | nb_streams++; |
| 95 | } |
| 96 | if (!nb_streams) { |
| 97 | av_log(NULL, AV_LOG_ERROR, "Graph has no output stream\n"); |
| 98 | ret = AVERROR(EINVAL); |
| 99 | goto fail; |
| 100 | } |
nothing calls this directly
no test coverage detected