/*
- * Filter graphs
+ * filter graphs
* copyright (c) 2007 Bobby Bingham
*
* This file is part of FFmpeg.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string.h>
-#include <stddef.h>
-
-#include "avstring.h"
#include "avfilter.h"
#include "avfiltergraph.h"
-#include "allfilters.h"
+extern AVFilter avfilter_vf_scale;
+extern AVFilter avfilter_vf_graph;
+extern AVFilter avfilter_vf_graphfile;
+extern AVFilter avfilter_vf_graphdesc;
typedef struct AVFilterGraph {
unsigned filter_count;
/**
* Given the link between the dummy filter and an internal filter whose input
* is being exported outside the graph, this returns the externally visible
- * link
+ * link.
*/
static inline AVFilterLink *get_extern_input_link(AVFilterLink *link)
{
return avfilter_request_frame(link2);
}
+
+static int link_in_poll_frame(AVFilterLink *link)
+{
+ AVFilterLink *link2 = get_extern_input_link(link);
+ if(!link2)
+ return -1;
+ return avfilter_poll_frame(link2);
+}
+
static int link_in_config_props(AVFilterLink *link)
{
AVFilterLink *link2 = get_extern_input_link(link);
/**
* Given the link between the dummy filter and an internal filter whose input
* is being exported outside the graph, this returns the externally visible
- * link
+ * link.
*/
static inline AVFilterLink *get_extern_output_link(AVFilterLink *link)
{
static AVFilter vf_graph_dummy =
{
.name = "graph_dummy",
- .author = "Bobby Bingham",
.priv_size = sizeof(GraphLinkContext),
return -1;
}
+static int graph_out_poll_frame(AVFilterLink *link)
+{
+ AVFilterLink *link2 = get_intern_output_link(link);
+
+ if(!link2)
+ return -1;
+
+ return avfilter_poll_frame(link2);
+}
+
static int graph_out_config_props(AVFilterLink *link)
{
GraphContext *graph = link->src->priv;
AVFilterPad graph_inpad =
{
.name = name,
- .type = AV_PAD_VIDEO,
+ .type = CODEC_TYPE_VIDEO,
.start_frame = graph_in_start_frame,
.end_frame = graph_in_end_frame,
.get_video_buffer = graph_in_get_video_buffer,
AVFilterPad dummy_outpad =
{
.name = NULL, /* FIXME? */
- .type = AV_PAD_VIDEO,
+ .type = CODEC_TYPE_VIDEO,
.request_frame = link_in_request_frame,
+ .poll_frame = link_in_poll_frame,
.config_props = link_in_config_props,
};
AVFilterPad graph_outpad =
{
.name = name,
- .type = AV_PAD_VIDEO,
+ .type = CODEC_TYPE_VIDEO,
.request_frame = graph_out_request_frame,
+ .poll_frame = graph_out_poll_frame,
.config_props = graph_out_config_props,
};
AVFilterPad dummy_inpad =
{
.name = NULL, /* FIXME? */
- .type = AV_PAD_VIDEO,
+ .type = CODEC_TYPE_VIDEO,
.start_frame = link_out_start_frame,
.end_frame = link_out_end_frame,
.draw_slice = link_out_draw_slice,
{
GraphContext *graph = graphctx->priv;
- /* Find supported formats from sub-filters, and merge along links */
+ /* find supported formats from sub-filters, and merge along links */
if(query_formats(graphctx))
return -1;
for(curfilt = desc->filters; curfilt; curfilt = curfilt->next) {
if(!(filterdef = avfilter_get_by_name(curfilt->filter)) ||
!(filt = avfilter_open(filterdef, curfilt->name))) {
- av_log(ctx, AV_LOG_ERROR, "error creating filter\n");
+ av_log(ctx, AV_LOG_ERROR,
+ "error creating filter '%s'\n", curfilt->name);
goto fail;
}
avfilter_graph_add_filter(ctx, filt);
if(avfilter_init_filter(filt, curfilt->args, NULL)) {
- av_log(ctx, AV_LOG_ERROR, "error initializing filter\n");
+ av_log(ctx, AV_LOG_ERROR,
+ "error initializing filter '%s'\n", curfilt->name);
goto fail;
}
}
AVFilter avfilter_vf_graph =
{
.name = "graph",
- .author = "Bobby Bingham",
.priv_size = sizeof(GraphContext),
AVFilter avfilter_vf_graphdesc =
{
.name = "graph_desc",
- .author = "Bobby Bingham",
.priv_size = sizeof(GraphContext),
AVFilter avfilter_vf_graphfile =
{
.name = "graph_file",
- .author = "Bobby Bingham",
.priv_size = sizeof(GraphContext),