#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
-int filter_nbthreads = -1;
-int filter_complex_nbthreads = -1;
-
static const enum AVPixelFormat *get_compliance_unofficial_pix_fmts(enum AVCodecID codec_id, const enum AVPixelFormat default_formats[])
{
static const enum AVPixelFormat mjpeg_formats[] =
int ret;
char name[255];
- snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
+ snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("buffersink"),
name, NULL, NULL, fg->graph);
av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
}
- snprintf(name, sizeof(name), "scaler for output stream %d:%d",
+ snprintf(name, sizeof(name), "scaler_out_%d_%d",
ost->file_index, ost->index);
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
name, args, NULL, fg->graph)) < 0)
if ((pix_fmts = choose_pix_fmts(ofilter))) {
AVFilterContext *filter;
- snprintf(name, sizeof(name), "pixel format for output stream %d:%d",
+ snprintf(name, sizeof(name), "format_out_%d_%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num,
ost->frame_rate.den);
- snprintf(name, sizeof(name), "fps for output stream %d:%d",
+ snprintf(name, sizeof(name), "fps_out_%d_%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"),
name, args, NULL, fg->graph);
pad_idx = 0;
}
- snprintf(name, sizeof(name), "trim for output stream %d:%d",
+ snprintf(name, sizeof(name), "trim_out_%d_%d",
ost->file_index, ost->index);
ret = insert_trim(of->start_time, of->recording_time,
&last_filter, &pad_idx, name);
char name[255];
int ret;
- snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
+ snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("abuffersink"),
name, NULL, NULL, fg->graph);
av_freep(&sample_rates);
av_freep(&channel_layouts);
- snprintf(name, sizeof(name), "audio format for output stream %d:%d",
+ snprintf(name, sizeof(name), "format_out_%d_%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&format,
avfilter_get_by_name("aformat"),
if (ist->framerate.num) {
AVFilterContext *setpts;
- snprintf(name, sizeof(name), "force CFR for input from stream %d:%d",
+ snprintf(name, sizeof(name), "forcecfr_in_%d_%d",
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&setpts,
avfilter_get_by_name("setpts"),
if (do_deinterlace) {
AVFilterContext *yadif;
- snprintf(name, sizeof(name), "deinterlace input from stream %d:%d",
+ snprintf(name, sizeof(name), "deinterlace_in_%d_%d",
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&yadif,
avfilter_get_by_name("yadif"),
last_filter = yadif;
}
- snprintf(name, sizeof(name), "trim for input stream %d:%d",
+ snprintf(name, sizeof(name), "trim_in_%d_%d",
ist->file_index, ist->st->index);
if (copy_ts) {
tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
ifilter->channel_layout);
else
av_bprintf(&args, ":channels=%d", ifilter->channels);
- snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
+ snprintf(name, sizeof(name), "graph_%d_in_%d_%d", fg->index,
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&ifilter->filter, abuffer_filt,
av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
"similarly to -af " filter_name "=%s.\n", arg); \
\
- snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
+ snprintf(name, sizeof(name), "graph_%d_%s_in_%d_%d", \
fg->index, filter_name, ist->file_index, ist->st->index); \
ret = avfilter_graph_create_filter(&filt_ctx, \
avfilter_get_by_name(filter_name), \
char args[512];
AVDictionaryEntry *e = NULL;
- fg->graph->nb_threads = filter_complex_nbthreads;
+ fg->graph->nb_threads = filter_nbthreads;
args[0] = 0;
while ((e = av_dict_get(ost->sws_dict, "", e,
if (e)
av_opt_set(fg->graph, "threads", e->value, 0);
} else {
- fg->graph->nb_threads = filter_nbthreads;
+ fg->graph->nb_threads = filter_complex_nbthreads;
}
if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
* make sure they stay the same if the filtergraph is reconfigured later */
for (i = 0; i < fg->nb_outputs; i++) {
OutputFilter *ofilter = fg->outputs[i];
- AVFilterLink *link = ofilter->filter->inputs[0];
+ AVFilterContext *sink = ofilter->filter;
- ofilter->format = link->format;
+ ofilter->format = av_buffersink_get_format(sink);
- ofilter->width = link->w;
- ofilter->height = link->h;
+ ofilter->width = av_buffersink_get_w(sink);
+ ofilter->height = av_buffersink_get_h(sink);
- ofilter->sample_rate = link->sample_rate;
- ofilter->channel_layout = link->channel_layout;
+ ofilter->sample_rate = av_buffersink_get_sample_rate(sink);
+ ofilter->channel_layout = av_buffersink_get_channel_layout(sink);
}
fg->reconfiguration = 1;