{
gdouble brightness;
gint i, pw, ph, stride, width, height;
+ gint req_width, req_height;
guint8 *d, *data;
guint pattern_data;
ph = videodetect->pattern_height;
stride = GST_VIDEO_I420_Y_ROWSTRIDE (width);
+ req_width =
+ (videodetect->pattern_count + videodetect->pattern_data_count) * pw +
+ videodetect->left_offset;
+ req_height = videodetect->bottom_offset + ph;
+ if (req_width > width || req_height > height) {
+ goto no_pattern;
+ }
+
/* analyse the bottom left pixels */
for (i = 0; i < videodetect->pattern_count; i++) {
d = data;
}
}
-static void
+static GstFlowReturn
gst_video_mark_420 (GstVideoMark * videomark, GstBuffer * buffer)
{
gint i, pw, ph, stride, width, height;
+ gint req_width, req_height;
guint8 *d, *data;
guint pattern_shift;
guint8 color;
ph = videomark->pattern_height;
stride = GST_VIDEO_I420_Y_ROWSTRIDE (width);
+ req_width =
+ (videomark->pattern_count + videomark->pattern_data_count) * pw +
+ videomark->left_offset;
+ req_height = videomark->bottom_offset + ph;
+ if (req_width > width || req_height > height) {
+ GST_ELEMENT_ERROR (videomark, STREAM, WRONG_TYPE, (NULL),
+ ("videomark pattern doesn't fit video, need at least %ix%i (stream has %ix%i)",
+ req_width, req_height, width, height));
+ return GST_FLOW_ERROR;
+ }
+
/* draw the bottom left pixels */
for (i = 0; i < videomark->pattern_count; i++) {
d = data;
pattern_shift >>= 1;
}
+
+ return GST_FLOW_OK;
}
static GstFlowReturn
videomark = GST_VIDEO_MARK (trans);
if (videomark->enabled)
- gst_video_mark_420 (videomark, buf);
+ return gst_video_mark_420 (videomark, buf);
return ret;
}