AVFilterLink *link = filter->inputs[i];
if (!link) continue;
+ if (!link->src || !link->dst) {
+ av_log(filter, AV_LOG_ERROR,
+ "Not all input and output are properly linked (%d).\n", i);
+ return AVERROR(EINVAL);
+ }
switch (link->init_state) {
case AVLINK_INIT:
}
if (link->time_base.num == 0 && link->time_base.den == 0)
- link->time_base = link->src && link->src->nb_inputs ?
+ link->time_base = link->src->nb_inputs ?
link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
if (link->type == AVMEDIA_TYPE_VIDEO) {
if ((config_link = link->dstpad->config_props))
if ((ret = config_link(link)) < 0) {
- av_log(link->src, AV_LOG_ERROR,
+ av_log(link->dst, AV_LOG_ERROR,
"Failed to configure input pad on %s\n",
link->dst->name);
return ret;
static AVFilter *first_filter;
+#if !FF_API_NOCONST_GET_NAME
+const
+#endif
AVFilter *avfilter_get_by_name(const char *name)
{
- AVFilter *f = NULL;
+ const AVFilter *f = NULL;
if (!name)
return NULL;
static const AVClass *filter_child_class_next(const AVClass *prev)
{
- AVFilter *f = NULL;
+ const AVFilter *f = NULL;
while (prev && (f = avfilter_next(f)))
if (f->priv_class == prev)
{
int (*filter_frame)(AVFilterLink *, AVFrame *);
AVFilterPad *dst = link->dstpad;
- AVFrame *out;
+ AVFrame *out = NULL;
+ int ret;
FF_DPRINTF_START(NULL, filter_frame);
ff_dlog_link(NULL, link, 1);
case AVMEDIA_TYPE_AUDIO:
out = ff_get_audio_buffer(link, frame->nb_samples);
break;
- default: return AVERROR(EINVAL);
+ default:
+ ret = AVERROR(EINVAL);
+ goto fail;
}
if (!out) {
- av_frame_free(&frame);
- return AVERROR(ENOMEM);
+ ret = AVERROR(ENOMEM);
+ goto fail;
}
- av_frame_copy_props(out, frame);
+
+ ret = av_frame_copy_props(out, frame);
+ if (ret < 0)
+ goto fail;
switch (link->type) {
case AVMEDIA_TYPE_VIDEO:
av_get_channel_layout_nb_channels(frame->channel_layout),
frame->format);
break;
- default: return AVERROR(EINVAL);
+ default:
+ ret = AVERROR(EINVAL);
+ goto fail;
}
av_frame_free(&frame);
out = frame;
return filter_frame(link, out);
+
+fail:
+ av_frame_free(&out);
+ av_frame_free(&frame);
+ return ret;
}
const AVClass *avfilter_get_class(void)