#include "framequeue.h"
#include "avfilter.h"
+#include "buffersink.h"
#include "formats.h"
#include "internal.h"
#include "thread.h"
av_freep(&(*graph)->scale_sws_opts);
av_freep(&(*graph)->aresample_swr_opts);
+#if FF_API_LAVR_OPTS
av_freep(&(*graph)->resample_lavr_opts);
+#endif
av_freep(&(*graph)->filters);
av_freep(&(*graph)->internal);
av_freep(graph);
return AVERROR(EINVAL);
}
- snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
+ snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d",
scaler_count++);
if ((ret = avfilter_graph_create_filter(&convert, filter,
return AVERROR(EINVAL);
}
- snprintf(inst_name, sizeof(inst_name), "auto-inserted resampler %d",
+ snprintf(inst_name, sizeof(inst_name), "auto_resampler_%d",
resampler_count++);
scale_args[0] = '\0';
if (graph->aresample_swr_opts)
for (j = 0; j < outlink->in_samplerates->nb_formats; j++) {
int diff = abs(sample_rate - outlink->in_samplerates->formats[j]);
+ av_assert0(diff < INT_MAX); // This would lead to the use of uninitialized best_diff but is only possible with invalid sample rates
+
if (diff < best_diff) {
best_diff = diff;
best_idx = j;
avfilter_get_by_name("fifo") :
avfilter_get_by_name("afifo");
- snprintf(name, sizeof(name), "auto-inserted fifo %d", fifo_count++);
+ snprintf(name, sizeof(name), "auto_fifo_%d", fifo_count++);
ret = avfilter_graph_create_filter(&fifo_ctx, fifo, name, NULL,
NULL, graph);
while (graph->sink_links_count) {
oldest = graph->sink_links[0];
+ if (oldest->dst->filter->activate) {
+ /* For now, buffersink is the only filter implementing activate. */
+ return av_buffersink_get_frame_flags(oldest->dst, NULL,
+ AV_BUFFERSINK_FLAG_PEEK);
+ }
r = ff_request_frame(oldest);
if (r != AVERROR_EOF)
break;
}
if (!graph->sink_links_count)
return AVERROR_EOF;
+ av_assert1(!oldest->dst->filter->activate);
av_assert1(oldest->age_index >= 0);
frame_count = oldest->frame_count_out;
while (frame_count == oldest->frame_count_out) {