Browse code

Check linked pads media type mismatch in avfilter_link().

Originally committed as revision 26325 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2011/01/13 10:00:36
Showing 1 changed files
... ...
@@ -107,6 +107,13 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
107 107
         src->outputs[srcpad]        || dst->inputs[dstpad])
108 108
         return -1;
109 109
 
110
+    if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
111
+        av_log(src, AV_LOG_ERROR,
112
+               "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n",
113
+               src->name, srcpad, dst->name, dstpad);
114
+        return AVERROR(EINVAL);
115
+    }
116
+
110 117
     src->outputs[srcpad] =
111 118
     dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink));
112 119