Allow code to pass data to filters it creates.
Commited in SoC by Bobby Bingham on 2007-07-15 16:45:50 Originally committed as revision 12692 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
fc27b8081e
commit
1ac87cc890
@ -56,7 +56,7 @@ void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
|
|||||||
graph->filters[graph->filter_count - 1] = filter;
|
graph->filters[graph->filter_count - 1] = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AVFilterContext *create_filter_with_args(const char *filt)
|
static AVFilterContext *create_filter_with_args(const char *filt, void *opaque)
|
||||||
{
|
{
|
||||||
AVFilterContext *ret;
|
AVFilterContext *ret;
|
||||||
char *filter = av_strdup(filt); /* copy - don't mangle the input string */
|
char *filter = av_strdup(filt); /* copy - don't mangle the input string */
|
||||||
@ -75,7 +75,7 @@ static AVFilterContext *create_filter_with_args(const char *filt)
|
|||||||
name, args ? args : "(none)");
|
name, args ? args : "(none)");
|
||||||
|
|
||||||
if((ret = avfilter_create_by_name(name, NULL))) {
|
if((ret = avfilter_create_by_name(name, NULL))) {
|
||||||
if(avfilter_init_filter(ret, args)) {
|
if(avfilter_init_filter(ret, args, opaque)) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
|
av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
|
||||||
avfilter_destroy(ret);
|
avfilter_destroy(ret);
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -90,14 +90,19 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int avfilter_graph_load_chain(AVFilterGraph *graph,
|
int avfilter_graph_load_chain(AVFilterGraph *graph,
|
||||||
unsigned count, char **filter_list,
|
unsigned count, char **filter_list, void **opaque,
|
||||||
AVFilterContext **first, AVFilterContext **last)
|
AVFilterContext **first, AVFilterContext **last)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
AVFilterContext *filters[2] = {NULL,NULL};
|
AVFilterContext *filters[2] = {NULL,NULL};
|
||||||
|
|
||||||
for(i = 0; i < count; i ++) {
|
for(i = 0; i < count; i ++) {
|
||||||
if(!(filters[1] = create_filter_with_args(filter_list[i])))
|
void *op;
|
||||||
|
|
||||||
|
if(opaque) op = opaque[i];
|
||||||
|
else op = NULL;
|
||||||
|
|
||||||
|
if(!(filters[1] = create_filter_with_args(filter_list[i], op)))
|
||||||
goto fail;
|
goto fail;
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
if(first) *first = filters[1];
|
if(first) *first = filters[1];
|
||||||
|
@ -55,6 +55,6 @@ void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter);
|
|||||||
* @return 0 on success. -1 on error.
|
* @return 0 on success. -1 on error.
|
||||||
*/
|
*/
|
||||||
int avfilter_graph_load_chain(AVFilterGraph *graph,
|
int avfilter_graph_load_chain(AVFilterGraph *graph,
|
||||||
unsigned count, char **filter_list,
|
unsigned count, char **filter_list, void **opaque,
|
||||||
AVFilterContext **first, AVFilterContext **last);
|
AVFilterContext **first, AVFilterContext **last);
|
||||||
#endif /* FFMPEG_AVFILTER_H */
|
#endif /* FFMPEG_AVFILTER_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user