|
|
@@ -1180,25 +1180,27 @@ fail:
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
|
|
|
- char *graph_desc,
|
|
|
- Scheduler *sch, unsigned sched_idx_enc,
|
|
|
- const OutputFilterOptions *opts)
|
|
|
+int fg_create_simple(FilterGraph **pfg,
|
|
|
+ InputStream *ist,
|
|
|
+ char *graph_desc,
|
|
|
+ Scheduler *sch, unsigned sched_idx_enc,
|
|
|
+ const OutputFilterOptions *opts)
|
|
|
{
|
|
|
+ const enum AVMediaType type = ist->par->codec_type;
|
|
|
FilterGraph *fg;
|
|
|
FilterGraphPriv *fgp;
|
|
|
int ret;
|
|
|
|
|
|
- ret = fg_create(&ost->fg_simple, graph_desc, sch);
|
|
|
+ ret = fg_create(pfg, graph_desc, sch);
|
|
|
if (ret < 0)
|
|
|
return ret;
|
|
|
- fg = ost->fg_simple;
|
|
|
+ fg = *pfg;
|
|
|
fgp = fgp_from_fg(fg);
|
|
|
|
|
|
fgp->is_simple = 1;
|
|
|
|
|
|
snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf%s",
|
|
|
- av_get_media_type_string(ost->type)[0], opts->name);
|
|
|
+ av_get_media_type_string(type)[0], opts->name);
|
|
|
|
|
|
if (fg->nb_inputs != 1 || fg->nb_outputs != 1) {
|
|
|
av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "
|
|
|
@@ -1208,16 +1210,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
|
|
|
graph_desc, fg->nb_inputs, fg->nb_outputs);
|
|
|
return AVERROR(EINVAL);
|
|
|
}
|
|
|
- if (fg->outputs[0]->type != ost->type) {
|
|
|
+ if (fg->outputs[0]->type != type) {
|
|
|
av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect "
|
|
|
"it to %s output stream\n",
|
|
|
av_get_media_type_string(fg->outputs[0]->type),
|
|
|
- av_get_media_type_string(ost->type));
|
|
|
+ av_get_media_type_string(type));
|
|
|
return AVERROR(EINVAL);
|
|
|
}
|
|
|
|
|
|
- ost->filter = fg->outputs[0];
|
|
|
-
|
|
|
ret = ifilter_bind_ist(fg->inputs[0], ist, opts->vs);
|
|
|
if (ret < 0)
|
|
|
return ret;
|