MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / configure_filtergraph

Function configure_filtergraph

fftools/ffplay.c:1860–1901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1858}
1859
1860static int configure_filtergraph(AVFilterGraph *graph, const char *filtergraph,
1861 AVFilterContext *source_ctx, AVFilterContext *sink_ctx)
1862{
1863 int ret, i;
1864 int nb_filters = graph->nb_filters;
1865 AVFilterInOut *outputs = NULL, *inputs = NULL;
1866
1867 if (filtergraph) {
1868 outputs = avfilter_inout_alloc();
1869 inputs = avfilter_inout_alloc();
1870 if (!outputs || !inputs) {
1871 ret = AVERROR(ENOMEM);
1872 goto fail;
1873 }
1874
1875 outputs->name = av_strdup("in");
1876 outputs->filter_ctx = source_ctx;
1877 outputs->pad_idx = 0;
1878 outputs->next = NULL;
1879
1880 inputs->name = av_strdup("out");
1881 inputs->filter_ctx = sink_ctx;
1882 inputs->pad_idx = 0;
1883 inputs->next = NULL;
1884
1885 if ((ret = avfilter_graph_parse_ptr(graph, filtergraph, &inputs, &outputs, NULL)) < 0)
1886 goto fail;
1887 } else {
1888 if ((ret = avfilter_link(source_ctx, 0, sink_ctx, 0)) < 0)
1889 goto fail;
1890 }
1891
1892 /* Reorder the filters to ensure that inputs of the custom filters are merged first */
1893 for (i = 0; i < graph->nb_filters - nb_filters; i++)
1894 FFSWAP(AVFilterContext*, graph->filters[i], graph->filters[i + nb_filters]);
1895
1896 ret = avfilter_graph_config(graph, NULL);
1897fail:
1898 avfilter_inout_free(&outputs);
1899 avfilter_inout_free(&inputs);
1900 return ret;
1901}
1902
1903static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters, AVFrame *frame)
1904{

Callers 2

configure_video_filtersFunction · 0.70
configure_audio_filtersFunction · 0.70

Calls 6

avfilter_inout_allocFunction · 0.85
av_strdupFunction · 0.85
avfilter_graph_parse_ptrFunction · 0.85
avfilter_linkFunction · 0.85
avfilter_graph_configFunction · 0.85
avfilter_inout_freeFunction · 0.85

Tested by

no test coverage detected