const char *avfilter_license(void)
{
#define LICENSE_PREFIX "libavfilter license: "
- return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+ return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1];
}
void ff_command_queue_pop(AVFilterContext *filter)
return ret;
}
-int ff_poll_frame(AVFilterLink *link)
-{
- int i, min = INT_MAX;
-
- if (link->srcpad->poll_frame)
- return link->srcpad->poll_frame(link);
-
- for (i = 0; i < link->src->nb_inputs; i++) {
- int val;
- if (!link->src->inputs[i])
- return AVERROR(EINVAL);
- val = ff_poll_frame(link->src->inputs[i]);
- min = FFMIN(min, val);
- }
-
- return min;
-}
-
static const char *const var_names[] = {
"t",
"n",
int ff_filter_get_nb_threads(AVFilterContext *ctx)
{
- if (ctx->nb_threads > 0)
- return FFMIN(ctx->nb_threads, ctx->graph->nb_threads);
- return ctx->graph->nb_threads;
+ if (ctx->nb_threads > 0)
+ return FFMIN(ctx->nb_threads, ctx->graph->nb_threads);
+ return ctx->graph->nb_threads;
}
static int process_options(AVFilterContext *ctx, AVDictionary **options,
return count;
}
+int ff_filter_process_command(AVFilterContext *ctx, const char *cmd,
+ const char *arg, char *res, int res_len, int flags)
+{
+ const AVOption *o;
+
+ if (!ctx->filter->priv_class)
+ return 0;
+ o = av_opt_find2(ctx->priv, cmd, NULL, AV_OPT_FLAG_RUNTIME_PARAM | AV_OPT_FLAG_FILTERING_PARAM, AV_OPT_SEARCH_CHILDREN, NULL);
+ if (!o)
+ return AVERROR(ENOSYS);
+ return av_opt_set(ctx->priv, cmd, arg, 0);
+}
+
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
{
int ret = 0;
and request_frame() to acknowledge status changes), to run once more
and check if enough input was present for several frames.
- Exemples of scenarios to consider:
+ Examples of scenarios to consider:
- buffersrc: activate if frame_wanted_out to notify the application;
activate when the application adds a frame to push it immediately.
- If an input has frames in fifo and frame_wanted_out == 0, dequeue a
frame and call filter_frame().
- Ratinale: filter frames as soon as possible instead of leaving them
+ Rationale: filter frames as soon as possible instead of leaving them
queued; frame_wanted_out < 0 is not possible since the old API does not
set it nor provides any similar feedback; frame_wanted_out > 0 happens
when min_samples > 0 and there are not enough samples queued.
return 1;
}
+size_t ff_inlink_queued_frames(AVFilterLink *link)
+{
+ return ff_framequeue_queued_frames(&link->fifo);
+}
+
int ff_inlink_check_available_frame(AVFilterLink *link)
{
return ff_framequeue_queued_frames(&link->fifo) > 0;
}
+int ff_inlink_queued_samples(AVFilterLink *link)
+{
+ return ff_framequeue_queued_samples(&link->fifo);
+}
+
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
{
uint64_t samples = ff_framequeue_queued_samples(&link->fifo);
return 1;
}
+AVFrame *ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
+{
+ return ff_framequeue_peek(&link->fifo, idx);
+}
+
int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
{
AVFrame *frame = *rframe;