[FFmpeg-devel] [PATCH] Check linked pads media type match in avfilter_link().

Stefano Sabatini stefano.sabatini-lala
Wed Jan 12 22:21:43 CET 2011


---
 libavfilter/avfilter.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index a7d7de0..dc8aa34 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -108,6 +108,13 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
         src->outputs[srcpad]        || dst->inputs[dstpad])
         return -1;
 
+    if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
+        av_log(src, AV_LOG_ERROR,
+               "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n",
+               src->name, srcpad, dst->name, dstpad);
+        return AVERROR(EINVAL);
+    }
+
     src->outputs[srcpad] =
     dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink));
 
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list