diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | gst/videosignal/gstvideodetect.c | 40 | ||||
-rw-r--r-- | gst/videosignal/gstvideodetect.h | 2 | ||||
-rw-r--r-- | gst/videosignal/gstvideomark.c | 38 | ||||
-rw-r--r-- | gst/videosignal/gstvideomark.h | 2 |
5 files changed, 86 insertions, 9 deletions
@@ -1,3 +1,16 @@ +2007-06-27 Wim Taymans <wim@fluendo.com> + + * gst/videosignal/gstvideodetect.c: (gst_video_detect_420), + (gst_video_detect_set_property), (gst_video_detect_get_property), + (gst_video_detect_class_init): + * gst/videosignal/gstvideodetect.h: + * gst/videosignal/gstvideomark.c: (gst_video_mark_draw_box), + (gst_video_mark_420), (gst_video_mark_set_property), + (gst_video_mark_get_property), (gst_video_mark_class_init): + * gst/videosignal/gstvideomark.h: + Add left and bottom offset properties to control the position of the + pattern. + 2007-06-25 Stefan Kost <ensonic@users.sf.net> * docs/plugins/gst-plugins-bad-plugins.args: diff --git a/gst/videosignal/gstvideodetect.c b/gst/videosignal/gstvideodetect.c index 54d0dd77..e26e1561 100644 --- a/gst/videosignal/gstvideodetect.c +++ b/gst/videosignal/gstvideodetect.c @@ -121,6 +121,8 @@ #define DEFAULT_PATTERN_COUNT 4 #define DEFAULT_PATTERN_DATA_COUNT 5 #define DEFAULT_PATTERN_SENSITIVITY 0.2 +#define DEFAULT_LEFT_OFFSET 0 +#define DEFAULT_BOTTOM_OFFSET 0 enum { @@ -130,7 +132,9 @@ enum PROP_PATTERN_HEIGHT, PROP_PATTERN_COUNT, PROP_PATTERN_DATA_COUNT, - PROP_PATTERN_SENSITIVITY + PROP_PATTERN_SENSITIVITY, + PROP_LEFT_OFFSET, + PROP_BOTTOM_OFFSET }; GST_DEBUG_CATEGORY_STATIC (video_detect_debug); @@ -256,8 +260,9 @@ gst_video_detect_420 (GstVideoDetect * videodetect, GstBuffer * buffer) /* analyse the bottom left pixels */ for (i = 0; i < videodetect->pattern_count; i++) { d = data; - /* move to start of bottom left */ - d += stride * (height - ph); + /* move to start of bottom left, adjust for offsets */ + d += stride * (height - ph - videodetect->bottom_offset) + + videodetect->left_offset; /* move to i-th pattern */ d += pw * i; @@ -284,8 +289,11 @@ gst_video_detect_420 (GstVideoDetect * videodetect, GstBuffer * buffer) /* get the data of the pattern */ for (i = 0; i < videodetect->pattern_data_count; i++) { d = data; - /* move to start of bottom left, after the pattern */ - d += stride * (height - ph) + (videodetect->pattern_count * pw); + /* move to start of bottom left, adjust for offsets */ + d += stride * (height - ph - videodetect->bottom_offset) + + videodetect->left_offset; + /* move after the fixed pattern */ + d += (videodetect->pattern_count * pw); /* move to i-th pattern data */ d += pw * i; @@ -356,6 +364,12 @@ gst_video_detect_set_property (GObject * object, guint prop_id, case PROP_PATTERN_SENSITIVITY: videodetect->pattern_sensitivity = g_value_get_double (value); break; + case PROP_LEFT_OFFSET: + videodetect->left_offset = g_value_get_int (value); + break; + case PROP_BOTTOM_OFFSET: + videodetect->bottom_offset = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -389,6 +403,12 @@ gst_video_detect_get_property (GObject * object, guint prop_id, GValue * value, case PROP_PATTERN_SENSITIVITY: g_value_set_double (value, videodetect->pattern_sensitivity); break; + case PROP_LEFT_OFFSET: + g_value_set_int (value, videodetect->left_offset); + break; + case PROP_BOTTOM_OFFSET: + g_value_set_int (value, videodetect->bottom_offset); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -447,6 +467,16 @@ gst_video_detect_class_init (gpointer klass, gpointer class_data) "The sensitivity for detecting the markers (0.0 = highest, 0.5 lowest)", 0.0, 0.5, DEFAULT_PATTERN_SENSITIVITY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, PROP_LEFT_OFFSET, + g_param_spec_int ("left-offset", "Left Offset", + "The offset from the left border where the pattern starts", 0, + G_MAXINT, DEFAULT_LEFT_OFFSET, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, PROP_BOTTOM_OFFSET, + g_param_spec_int ("bottom-offset", "Bottom Offset", + "The offset from the bottom border where the pattern starts", 0, + G_MAXINT, DEFAULT_BOTTOM_OFFSET, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_detect_set_caps); trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_video_detect_transform_ip); diff --git a/gst/videosignal/gstvideodetect.h b/gst/videosignal/gstvideodetect.h index 8fa5c05f..99912a28 100644 --- a/gst/videosignal/gstvideodetect.h +++ b/gst/videosignal/gstvideodetect.h @@ -55,6 +55,8 @@ struct _GstVideoDetect { gint pattern_count; gint pattern_data_count; gdouble pattern_sensitivity; + gint left_offset; + gint bottom_offset; gboolean in_pattern; }; diff --git a/gst/videosignal/gstvideomark.c b/gst/videosignal/gstvideomark.c index da2daa07..f73d618e 100644 --- a/gst/videosignal/gstvideomark.c +++ b/gst/videosignal/gstvideomark.c @@ -68,6 +68,8 @@ #define DEFAULT_PATTERN_DATA_COUNT 5 #define DEFAULT_PATTERN_DATA 10 #define DEFAULT_ENABLED TRUE +#define DEFAULT_LEFT_OFFSET 0 +#define DEFAULT_BOTTOM_OFFSET 0 enum { @@ -77,7 +79,9 @@ enum PROP_PATTERN_COUNT, PROP_PATTERN_DATA_COUNT, PROP_PATTERN_DATA, - PROP_ENABLED + PROP_ENABLED, + PROP_LEFT_OFFSET, + PROP_BOTTOM_OFFSET }; GST_DEBUG_CATEGORY_STATIC (video_mark_debug); @@ -171,7 +175,8 @@ gst_video_mark_420 (GstVideoMark * videomark, GstBuffer * buffer) for (i = 0; i < videomark->pattern_count; i++) { d = data; /* move to start of bottom left */ - d += stride * (height - ph); + d += stride * (height - ph - videomark->bottom_offset) + + videomark->left_offset; /* move to i-th pattern */ d += pw * i; @@ -190,8 +195,11 @@ gst_video_mark_420 (GstVideoMark * videomark, GstBuffer * buffer) /* get the data of the pattern */ for (i = 0; i < videomark->pattern_data_count; i++) { d = data; - /* move to start of bottom left, after the pattern */ - d += stride * (height - ph) + (videomark->pattern_count * pw); + /* move to start of bottom left, adjust for offsets */ + d += stride * (height - ph - videomark->bottom_offset) + + videomark->left_offset; + /* move after the fixed pattern */ + d += (videomark->pattern_count * pw); /* move to i-th pattern data */ d += pw * i; @@ -247,6 +255,12 @@ gst_video_mark_set_property (GObject * object, guint prop_id, case PROP_ENABLED: videomark->enabled = g_value_get_boolean (value); break; + case PROP_LEFT_OFFSET: + videomark->left_offset = g_value_get_int (value); + break; + case PROP_BOTTOM_OFFSET: + videomark->bottom_offset = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -280,6 +294,12 @@ gst_video_mark_get_property (GObject * object, guint prop_id, GValue * value, case PROP_ENABLED: g_value_set_boolean (value, videomark->enabled); break; + case PROP_LEFT_OFFSET: + g_value_set_int (value, videomark->left_offset); + break; + case PROP_BOTTOM_OFFSET: + g_value_set_int (value, videomark->bottom_offset); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -337,6 +357,16 @@ gst_video_mark_class_init (gpointer klass, gpointer class_data) g_param_spec_boolean ("enabled", "Enabled", "Enable or disable the filter", DEFAULT_ENABLED, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, PROP_LEFT_OFFSET, + g_param_spec_int ("left-offset", "Left Offset", + "The offset from the left border where the pattern starts", 0, + G_MAXINT, DEFAULT_LEFT_OFFSET, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, PROP_BOTTOM_OFFSET, + g_param_spec_int ("bottom-offset", "Bottom Offset", + "The offset from the bottom border where the pattern starts", 0, + G_MAXINT, DEFAULT_BOTTOM_OFFSET, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_mark_set_caps); trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_video_mark_transform_ip); diff --git a/gst/videosignal/gstvideomark.h b/gst/videosignal/gstvideomark.h index a756bd2b..b75e7d33 100644 --- a/gst/videosignal/gstvideomark.h +++ b/gst/videosignal/gstvideomark.h @@ -55,6 +55,8 @@ struct _GstVideoMark { gint pattern_data_count; gint pattern_data; gboolean enabled; + gint left_offset; + gint bottom_offset; }; struct _GstVideoMarkClass { |