]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avfiltergraph.c
lavfi: make formats API private on next bump.
[ffmpeg] / libavfilter / avfiltergraph.c
index 91a5f3233f4c9f44973b6a62334aa48101d5b930..42bf1f7547127ddd7ba26687017a49e678c77450 100644 (file)
@@ -93,7 +93,15 @@ fail:
     return ret;
 }
 
-int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
+/**
+ * Check for the validity of graph.
+ *
+ * A graph is considered valid if all its input and output pads are
+ * connected.
+ *
+ * @return 0 in case of success, a negative value otherwise
+ */
+static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
 {
     AVFilterContext *filt;
     int i, j;
@@ -123,7 +131,12 @@ int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
     return 0;
 }
 
-int ff_avfilter_graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
+/**
+ * Configure all the links of graphctx.
+ *
+ * @return 0 in case of success, a negative value otherwise
+ */
+static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
 {
     AVFilterContext *filt;
     int i, ret;
@@ -161,7 +174,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
         if (graph->filters[i]->filter->query_formats)
             graph->filters[i]->filter->query_formats(graph->filters[i]);
         else
-            avfilter_default_query_formats(graph->filters[i]);
+            ff_default_query_formats(graph->filters[i]);
     }
 
     /* go through and merge as many format lists as possible */
@@ -176,7 +189,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
                 continue;
 
             if (link->in_formats != link->out_formats &&
-                !avfilter_merge_formats(link->in_formats,
+                !ff_merge_formats(link->in_formats,
                                         link->out_formats))
                 convert_needed = 1;
             if (link->type == AVMEDIA_TYPE_AUDIO) {
@@ -233,8 +246,8 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
                 convert->filter->query_formats(convert);
                 inlink  = convert->inputs[0];
                 outlink = convert->outputs[0];
-                if (!avfilter_merge_formats( inlink->in_formats,  inlink->out_formats) ||
-                    !avfilter_merge_formats(outlink->in_formats, outlink->out_formats))
+                if (!ff_merge_formats( inlink->in_formats,  inlink->out_formats) ||
+                    !ff_merge_formats(outlink->in_formats, outlink->out_formats))
                     ret |= AVERROR(ENOSYS);
                 if (inlink->type == AVMEDIA_TYPE_AUDIO &&
                     (!ff_merge_samplerates(inlink->in_samplerates,
@@ -290,10 +303,10 @@ static int pick_format(AVFilterLink *link)
         link->channel_layout = link->in_channel_layouts->channel_layouts[0];
     }
 
-    avfilter_formats_unref(&link->in_formats);
-    avfilter_formats_unref(&link->out_formats);
-    avfilter_formats_unref(&link->in_samplerates);
-    avfilter_formats_unref(&link->out_samplerates);
+    ff_formats_unref(&link->in_formats);
+    ff_formats_unref(&link->out_formats);
+    ff_formats_unref(&link->in_samplerates);
+    ff_formats_unref(&link->out_samplerates);
     ff_channel_layouts_unref(&link->in_channel_layouts);
     ff_channel_layouts_unref(&link->out_channel_layouts);
 
@@ -340,9 +353,9 @@ static int reduce_formats_on_filter(AVFilterContext *filter)
     int i, j, k, ret = 0;
 
     REDUCE_FORMATS(int,      AVFilterFormats,        formats,         formats,
-                   format_count, avfilter_add_format);
+                   format_count, ff_add_format);
     REDUCE_FORMATS(int,      AVFilterFormats,        samplerates,     formats,
-                   format_count, avfilter_add_format);
+                   format_count, ff_add_format);
     REDUCE_FORMATS(uint64_t, AVFilterChannelLayouts, channel_layouts,
                    channel_layouts, nb_channel_layouts, ff_add_channel_layout);
 
@@ -546,7 +559,10 @@ static int pick_formats(AVFilterGraph *graph)
     return 0;
 }
 
-int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
+/**
+ * Configure the formats of all the links in the graph.
+ */
+static int graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
 {
     int ret;
 
@@ -575,11 +591,11 @@ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
 {
     int ret;
 
-    if ((ret = ff_avfilter_graph_check_validity(graphctx, log_ctx)))
+    if ((ret = graph_check_validity(graphctx, log_ctx)))
         return ret;
-    if ((ret = ff_avfilter_graph_config_formats(graphctx, log_ctx)))
+    if ((ret = graph_config_formats(graphctx, log_ctx)))
         return ret;
-    if ((ret = ff_avfilter_graph_config_links(graphctx, log_ctx)))
+    if ((ret = graph_config_links(graphctx, log_ctx)))
         return ret;
 
     return 0;