Commit fc369003 authored by vitor's avatar vitor

Provide some default functions to simplify the implementation of common one

input one output video filters.

Commited in SoC by Bobby Bingham on 2007-07-06 15:25:52


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@11976 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 2a877ad8
...@@ -88,6 +88,25 @@ void avfilter_unref_pic(AVFilterPicRef *ref) ...@@ -88,6 +88,25 @@ void avfilter_unref_pic(AVFilterPicRef *ref)
av_free(ref); av_free(ref);
} }
/**
* default config_link() implementation for output video links to simplify
* the implementation of one input one output video filters */
static int default_config_output_link(AVFilterLink *link)
{
link->w = link->src->inputs[0]->w;
link->h = link->src->inputs[0]->h;
return 0;
}
/**
* default query_formats() implementation for output video links to simplify
* the implementation of one input one output video filters */
static int *default_query_output_formats(AVFilterLink *link)
{
return avfilter_make_format_list(1, link->src->inputs[0]->format);
}
int avfilter_link(AVFilterContext *src, unsigned srcpad, int avfilter_link(AVFilterContext *src, unsigned srcpad,
AVFilterContext *dst, unsigned dstpad) AVFilterContext *dst, unsigned dstpad)
{ {
...@@ -107,7 +126,10 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, ...@@ -107,7 +126,10 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
link->cur_pic = NULL; link->cur_pic = NULL;
/* find a format both filters support - TODO: auto-insert conversion filter */ /* find a format both filters support - TODO: auto-insert conversion filter */
if(src->filter->outputs[srcpad].query_formats)
fmts[0] = src->filter->outputs[srcpad].query_formats(link); fmts[0] = src->filter->outputs[srcpad].query_formats(link);
else
fmts[0] = default_query_output_formats(link);
fmts[1] = dst->filter-> inputs[dstpad].query_formats(link); fmts[1] = dst->filter-> inputs[dstpad].query_formats(link);
for(i = 0; fmts[0][i] != -1; i ++) for(i = 0; fmts[0][i] != -1; i ++)
for(j = 0; fmts[1][j] != -1; j ++) for(j = 0; fmts[1][j] != -1; j ++)
...@@ -127,8 +149,14 @@ format_done: ...@@ -127,8 +149,14 @@ format_done:
return -1; return -1;
} }
if (src->filter->outputs[srcpad].config_props)
src->filter->outputs[srcpad].config_props(link); src->filter->outputs[srcpad].config_props(link);
dst->filter-> inputs[dstpad].config_props(link); else
default_config_output_link(link);
if (dst->filter->inputs[dstpad].config_props)
dst->filter->inputs[dstpad].config_props(link);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment