diff options
author | David Schleef <ds@schleef.org> | 2013-04-15 00:24:23 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2013-05-10 17:31:10 -0700 |
commit | 4a88eebe0e645ff09a97bf5bfa86d7bdc6053c01 (patch) | |
tree | ae97979aea9fe45e168795f6d8ea58754eb3555b /gst/videosignal | |
parent | b3ff0630e821f6a13ba26ce04c9554229763612d (diff) | |
download | gstreamer-plugins-bad-4a88eebe0e645ff09a97bf5bfa86d7bdc6053c01.tar.gz |
videomark/detect: rename to simplevideomark[detect]
Diffstat (limited to 'gst/videosignal')
-rw-r--r-- | gst/videosignal/Makefile.am | 8 | ||||
-rw-r--r-- | gst/videosignal/gstsimplevideomark.c (renamed from gst/videosignal/gstvideomark.c) | 140 | ||||
-rw-r--r-- | gst/videosignal/gstsimplevideomark.h (renamed from gst/videosignal/gstvideomark.h) | 26 | ||||
-rw-r--r-- | gst/videosignal/gstsimplevideomarkdetect.c (renamed from gst/videosignal/gstvideodetect.c) | 186 | ||||
-rw-r--r-- | gst/videosignal/gstsimplevideomarkdetect.h (renamed from gst/videosignal/gstvideodetect.h) | 26 | ||||
-rw-r--r-- | gst/videosignal/gstvideosignal.c | 14 |
6 files changed, 210 insertions, 190 deletions
diff --git a/gst/videosignal/Makefile.am b/gst/videosignal/Makefile.am index 3c92b662c..0f86cc5dd 100644 --- a/gst/videosignal/Makefile.am +++ b/gst/videosignal/Makefile.am @@ -3,10 +3,10 @@ plugin_LTLIBRARIES = libgstvideosignal.la libgstvideosignal_la_SOURCES = gstvideosignal.c \ gstvideoanalyse.c \ gstvideoanalyse.h \ - gstvideodetect.c \ - gstvideodetect.h \ - gstvideomark.c \ - gstvideomark.h + gstsimplevideomarkdetect.c \ + gstsimplevideomarkdetect.h \ + gstsimplevideomark.c \ + gstsimplevideomark.h libgstvideosignal_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) diff --git a/gst/videosignal/gstvideomark.c b/gst/videosignal/gstsimplevideomark.c index 32db3bf22..9c51d0d8d 100644 --- a/gst/videosignal/gstvideomark.c +++ b/gst/videosignal/gstsimplevideomark.c @@ -17,26 +17,26 @@ * Boston, MA 02110-1335, USA. */ /** - * SECTION:element-videomark + * SECTION:element-simplevideomark * @see_also: #GstVideoDetect * - * This plugin produces #GstVideoMark::pattern-count squares in the bottom left + * This plugin produces #GstSimpleVideoMark::pattern-count squares in the bottom left * corner of the video frames. The squares have a width and height of - * respectively #GstVideoMark:pattern-width and #GstVideoMark:pattern-height. + * respectively #GstSimpleVideoMark:pattern-width and #GstSimpleVideoMark:pattern-height. * Even squares will be black and odd squares will be white. * - * After writing the pattern, #GstVideoMark:pattern-data-count squares after the + * After writing the pattern, #GstSimpleVideoMark:pattern-data-count squares after the * pattern squares are produced as the bitarray given in - * #GstVideoMark:pattern-data. 1 bits will produce white squares and 0 bits will + * #GstSimpleVideoMark:pattern-data. 1 bits will produce white squares and 0 bits will * produce black squares. * - * The element can be enabled with the #GstVideoMark:enabled property. It is + * The element can be enabled with the #GstSimpleVideoMark:enabled property. It is * mostly used together with the #GstVideoDetect plugin. * * <refsect2> * <title>Example launch line</title> * |[ - * gst-launch videotestsrc ! videomark ! ximagesink + * gst-launch videotestsrc ! simplevideomark ! ximagesink * ]| Add the default black/white squares at the bottom left of the video frames. * </refsect2> * @@ -50,7 +50,7 @@ #include <gst/gst.h> #include <gst/video/video.h> #include <gst/video/gstvideofilter.h> -#include "gstvideomark.h" +#include "gstsimplevideomark.h" GST_DEBUG_CATEGORY_STATIC (gst_video_mark_debug_category); #define GST_CAT_DEFAULT gst_video_mark_debug_category @@ -104,12 +104,13 @@ enum /* class initialization */ -G_DEFINE_TYPE_WITH_CODE (GstVideoMark, gst_video_mark, GST_TYPE_VIDEO_FILTER, - GST_DEBUG_CATEGORY_INIT (gst_video_mark_debug_category, "videomark", 0, - "debug category for videomark element")); +G_DEFINE_TYPE_WITH_CODE (GstSimpleVideoMark, gst_video_mark, + GST_TYPE_VIDEO_FILTER, + GST_DEBUG_CATEGORY_INIT (gst_video_mark_debug_category, "simplevideomark", + 0, "debug category for simplevideomark element")); static void -gst_video_mark_class_init (GstVideoMarkClass * klass) +gst_video_mark_class_init (GstSimpleVideoMarkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstBaseTransformClass *base_transform_class = @@ -181,7 +182,7 @@ gst_video_mark_class_init (GstVideoMarkClass * klass) } static void -gst_video_mark_init (GstVideoMark * videomark) +gst_video_mark_init (GstSimpleVideoMark * simplevideomark) { } @@ -189,34 +190,34 @@ void gst_video_mark_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - GstVideoMark *videomark = GST_VIDEO_MARK (object); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (object); - GST_DEBUG_OBJECT (videomark, "set_property"); + GST_DEBUG_OBJECT (simplevideomark, "set_property"); switch (property_id) { case PROP_PATTERN_WIDTH: - videomark->pattern_width = g_value_get_int (value); + simplevideomark->pattern_width = g_value_get_int (value); break; case PROP_PATTERN_HEIGHT: - videomark->pattern_height = g_value_get_int (value); + simplevideomark->pattern_height = g_value_get_int (value); break; case PROP_PATTERN_COUNT: - videomark->pattern_count = g_value_get_int (value); + simplevideomark->pattern_count = g_value_get_int (value); break; case PROP_PATTERN_DATA_COUNT: - videomark->pattern_data_count = g_value_get_int (value); + simplevideomark->pattern_data_count = g_value_get_int (value); break; case PROP_PATTERN_DATA: - videomark->pattern_data = g_value_get_uint64 (value); + simplevideomark->pattern_data = g_value_get_uint64 (value); break; case PROP_ENABLED: - videomark->enabled = g_value_get_boolean (value); + simplevideomark->enabled = g_value_get_boolean (value); break; case PROP_LEFT_OFFSET: - videomark->left_offset = g_value_get_int (value); + simplevideomark->left_offset = g_value_get_int (value); break; case PROP_BOTTOM_OFFSET: - videomark->bottom_offset = g_value_get_int (value); + simplevideomark->bottom_offset = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -228,34 +229,34 @@ void gst_video_mark_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - GstVideoMark *videomark = GST_VIDEO_MARK (object); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (object); - GST_DEBUG_OBJECT (videomark, "get_property"); + GST_DEBUG_OBJECT (simplevideomark, "get_property"); switch (property_id) { case PROP_PATTERN_WIDTH: - g_value_set_int (value, videomark->pattern_width); + g_value_set_int (value, simplevideomark->pattern_width); break; case PROP_PATTERN_HEIGHT: - g_value_set_int (value, videomark->pattern_height); + g_value_set_int (value, simplevideomark->pattern_height); break; case PROP_PATTERN_COUNT: - g_value_set_int (value, videomark->pattern_count); + g_value_set_int (value, simplevideomark->pattern_count); break; case PROP_PATTERN_DATA_COUNT: - g_value_set_int (value, videomark->pattern_data_count); + g_value_set_int (value, simplevideomark->pattern_data_count); break; case PROP_PATTERN_DATA: - g_value_set_uint64 (value, videomark->pattern_data); + g_value_set_uint64 (value, simplevideomark->pattern_data); break; case PROP_ENABLED: - g_value_set_boolean (value, videomark->enabled); + g_value_set_boolean (value, simplevideomark->enabled); break; case PROP_LEFT_OFFSET: - g_value_set_int (value, videomark->left_offset); + g_value_set_int (value, simplevideomark->left_offset); break; case PROP_BOTTOM_OFFSET: - g_value_set_int (value, videomark->bottom_offset); + g_value_set_int (value, simplevideomark->bottom_offset); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -266,9 +267,9 @@ gst_video_mark_get_property (GObject * object, guint property_id, void gst_video_mark_dispose (GObject * object) { - GstVideoMark *videomark = GST_VIDEO_MARK (object); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (object); - GST_DEBUG_OBJECT (videomark, "dispose"); + GST_DEBUG_OBJECT (simplevideomark, "dispose"); /* clean up as possible. may be called multiple times */ @@ -278,9 +279,9 @@ gst_video_mark_dispose (GObject * object) void gst_video_mark_finalize (GObject * object) { - GstVideoMark *videomark = GST_VIDEO_MARK (object); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (object); - GST_DEBUG_OBJECT (videomark, "finalize"); + GST_DEBUG_OBJECT (simplevideomark, "finalize"); /* clean up object here */ @@ -290,9 +291,9 @@ gst_video_mark_finalize (GObject * object) static gboolean gst_video_mark_start (GstBaseTransform * trans) { - GstVideoMark *videomark = GST_VIDEO_MARK (trans); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (trans); - GST_DEBUG_OBJECT (videomark, "start"); + GST_DEBUG_OBJECT (simplevideomark, "start"); return TRUE; } @@ -300,9 +301,9 @@ gst_video_mark_start (GstBaseTransform * trans) static gboolean gst_video_mark_stop (GstBaseTransform * trans) { - GstVideoMark *videomark = GST_VIDEO_MARK (trans); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (trans); - GST_DEBUG_OBJECT (videomark, "stop"); + GST_DEBUG_OBJECT (simplevideomark, "stop"); return TRUE; } @@ -311,15 +312,15 @@ static gboolean gst_video_mark_set_info (GstVideoFilter * filter, GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info) { - GstVideoMark *videomark = GST_VIDEO_MARK (filter); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (filter); - GST_DEBUG_OBJECT (videomark, "set_info"); + GST_DEBUG_OBJECT (simplevideomark, "set_info"); return TRUE; } static void -gst_video_mark_draw_box (GstVideoMark * videomark, guint8 * data, +gst_video_mark_draw_box (GstSimpleVideoMark * simplevideomark, guint8 * data, gint width, gint height, gint row_stride, gint pixel_stride, guint8 color) { gint i, j; @@ -333,7 +334,7 @@ gst_video_mark_draw_box (GstVideoMark * videomark, guint8 * data, } static GstFlowReturn -gst_video_mark_yuv (GstVideoMark * videomark, GstVideoFrame * frame) +gst_video_mark_yuv (GstSimpleVideoMark * simplevideomark, GstVideoFrame * frame) { gint i, pw, ph, row_stride, pixel_stride; gint width, height, req_width, req_height; @@ -344,28 +345,28 @@ gst_video_mark_yuv (GstVideoMark * videomark, GstVideoFrame * frame) width = frame->info.width; height = frame->info.height; - pw = videomark->pattern_width; - ph = videomark->pattern_height; + pw = simplevideomark->pattern_width; + ph = simplevideomark->pattern_height; row_stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0); pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0); req_width = - (videomark->pattern_count + videomark->pattern_data_count) * pw + - videomark->left_offset; - req_height = videomark->bottom_offset + ph; + (simplevideomark->pattern_count + + simplevideomark->pattern_data_count) * pw + simplevideomark->left_offset; + req_height = simplevideomark->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)", + GST_ELEMENT_ERROR (simplevideomark, STREAM, WRONG_TYPE, (NULL), + ("simplevideomark 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++) { + for (i = 0; i < simplevideomark->pattern_count; i++) { d = GST_VIDEO_FRAME_COMP_DATA (frame, 0); /* move to start of bottom left */ - d += row_stride * (height - ph - videomark->bottom_offset) + - pixel_stride * videomark->left_offset; + d += row_stride * (height - ph - simplevideomark->bottom_offset) + + pixel_stride * simplevideomark->left_offset; /* move to i-th pattern */ d += pixel_stride * pw * i; @@ -376,30 +377,31 @@ gst_video_mark_yuv (GstVideoMark * videomark, GstVideoFrame * frame) color = 0; /* draw box of width * height */ - gst_video_mark_draw_box (videomark, d, pw, ph, row_stride, pixel_stride, - color); + gst_video_mark_draw_box (simplevideomark, d, pw, ph, row_stride, + pixel_stride, color); } - pattern_shift = G_GUINT64_CONSTANT (1) << (videomark->pattern_data_count - 1); + pattern_shift = + G_GUINT64_CONSTANT (1) << (simplevideomark->pattern_data_count - 1); /* get the data of the pattern */ - for (i = 0; i < videomark->pattern_data_count; i++) { + for (i = 0; i < simplevideomark->pattern_data_count; i++) { d = GST_VIDEO_FRAME_COMP_DATA (frame, 0); /* move to start of bottom left, adjust for offsets */ - d += row_stride * (height - ph - videomark->bottom_offset) + - pixel_stride * videomark->left_offset; + d += row_stride * (height - ph - simplevideomark->bottom_offset) + + pixel_stride * simplevideomark->left_offset; /* move after the fixed pattern */ - d += pixel_stride * videomark->pattern_count * pw; + d += pixel_stride * simplevideomark->pattern_count * pw; /* move to i-th pattern data */ d += pixel_stride * pw * i; - if (videomark->pattern_data & pattern_shift) + if (simplevideomark->pattern_data & pattern_shift) color = 255; else color = 0; - gst_video_mark_draw_box (videomark, d, pw, ph, row_stride, pixel_stride, - color); + gst_video_mark_draw_box (simplevideomark, d, pw, ph, row_stride, + pixel_stride, color); pattern_shift >>= 1; } @@ -412,12 +414,12 @@ static GstFlowReturn gst_video_mark_transform_frame_ip (GstVideoFilter * filter, GstVideoFrame * frame) { - GstVideoMark *videomark = GST_VIDEO_MARK (filter); + GstSimpleVideoMark *simplevideomark = GST_SIMPLE_VIDEO_MARK (filter); - GST_DEBUG_OBJECT (videomark, "transform_frame_ip"); + GST_DEBUG_OBJECT (simplevideomark, "transform_frame_ip"); - if (videomark->enabled) - return gst_video_mark_yuv (videomark, frame); + if (simplevideomark->enabled) + return gst_video_mark_yuv (simplevideomark, frame); return GST_FLOW_OK; } diff --git a/gst/videosignal/gstvideomark.h b/gst/videosignal/gstsimplevideomark.h index 58b081e05..63bc31107 100644 --- a/gst/videosignal/gstvideomark.h +++ b/gst/videosignal/gstsimplevideomark.h @@ -17,26 +17,26 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GST_VIDEO_MARK_H_ -#define _GST_VIDEO_MARK_H_ +#ifndef _GST_SIMPLE_VIDEO_MARK_H_ +#define _GST_SIMPLE_VIDEO_MARK_H_ #include <gst/video/video.h> #include <gst/video/gstvideofilter.h> G_BEGIN_DECLS -#define GST_TYPE_VIDEO_MARK (gst_video_mark_get_type()) -#define GST_VIDEO_MARK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_MARK,GstVideoMark)) -#define GST_VIDEO_MARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_MARK,GstVideoMarkClass)) -#define GST_IS_VIDEO_MARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_MARK)) -#define GST_IS_VIDEO_MARK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_MARK)) +#define GST_TYPE_SIMPLE_VIDEO_MARK (gst_video_mark_get_type()) +#define GST_SIMPLE_VIDEO_MARK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SIMPLE_VIDEO_MARK,GstSimpleVideoMark)) +#define GST_SIMPLE_VIDEO_MARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SIMPLE_VIDEO_MARK,GstSimpleVideoMarkClass)) +#define GST_IS_SIMPLE_VIDEO_MARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIMPLE_VIDEO_MARK)) +#define GST_IS_SIMPLE_VIDEO_MARK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIMPLE_VIDEO_MARK)) -typedef struct _GstVideoMark GstVideoMark; -typedef struct _GstVideoMarkClass GstVideoMarkClass; +typedef struct _GstSimpleVideoMark GstSimpleVideoMark; +typedef struct _GstSimpleVideoMarkClass GstSimpleVideoMarkClass; -struct _GstVideoMark +struct _GstSimpleVideoMark { - GstVideoFilter base_videomark; + GstVideoFilter base_simplevideomark; /* properties */ gint pattern_width; @@ -49,9 +49,9 @@ struct _GstVideoMark gint bottom_offset; }; -struct _GstVideoMarkClass +struct _GstSimpleVideoMarkClass { - GstVideoFilterClass base_videomark_class; + GstVideoFilterClass base_simplevideomark_class; }; GType gst_video_mark_get_type (void); diff --git a/gst/videosignal/gstvideodetect.c b/gst/videosignal/gstsimplevideomarkdetect.c index 94509fce1..5c36bcad7 100644 --- a/gst/videosignal/gstvideodetect.c +++ b/gst/videosignal/gstsimplevideomarkdetect.c @@ -17,24 +17,24 @@ * Boston, MA 02110-1335, USA. */ /** - * SECTION:element-videodetect + * SECTION:element-simplevideomarkdetect * @see_also: #GstVideoMark * - * This plugin detects #GstVideoDetect:pattern-count squares in the bottom left + * This plugin detects #GstSimpleVideoMarkDetect:pattern-count squares in the bottom left * corner of the video frames. The squares have a width and height of - * respectively #GstVideoDetect:pattern-width and #GstVideoDetect:pattern-height. + * respectively #GstSimpleVideoMarkDetect:pattern-width and #GstSimpleVideoMarkDetect:pattern-height. * Even squares must be black and odd squares must be white. * - * When the pattern has been found, #GstVideoDetect:pattern-data-count squares + * When the pattern has been found, #GstSimpleVideoMarkDetect:pattern-data-count squares * after the pattern squares are read as a bitarray. White squares represent a 1 * bit and black squares a 0 bit. The bitarray will will included in the element * message that is posted (see below). * * After the pattern has been found and the data pattern has been read, an - * element message called <classname>"GstVideoDetect"</classname> will + * element message called <classname>"GstSimpleVideoMarkDetect"</classname> will * be posted on the bus. If the pattern is no longer found in the frame, the * same element message is posted with the have-pattern field set to #FALSE. - * The message is only posted if the #GstVideoDetect:message property is #TRUE. + * The message is only posted if the #GstSimpleVideoMarkDetect:message property is #TRUE. * * The message's structure contains these fields: * <itemizedlist> @@ -87,7 +87,7 @@ * <refsect2> * <title>Example launch line</title> * |[ - * gst-launch videotestsrc ! videodetect ! videoconvert ! ximagesink + * gst-launch videotestsrc ! simplevideomarkdetect ! videoconvert ! ximagesink * ]| * </refsect2> * @@ -101,7 +101,7 @@ #include <gst/gst.h> #include <gst/video/video.h> #include <gst/video/gstvideofilter.h> -#include "gstvideodetect.h" +#include "gstsimplevideomarkdetect.h" GST_DEBUG_CATEGORY_STATIC (gst_video_detect_debug_category); #define GST_CAT_DEFAULT gst_video_detect_debug_category @@ -157,13 +157,14 @@ enum /* class initialization */ -G_DEFINE_TYPE_WITH_CODE (GstVideoDetect, gst_video_detect, +G_DEFINE_TYPE_WITH_CODE (GstSimpleVideoMarkDetect, gst_video_detect, GST_TYPE_VIDEO_FILTER, - GST_DEBUG_CATEGORY_INIT (gst_video_detect_debug_category, "videodetect", 0, - "debug category for videodetect element")); + GST_DEBUG_CATEGORY_INIT (gst_video_detect_debug_category, + "simplevideomarkdetect", 0, + "debug category for simplevideomarkdetect element")); static void -gst_video_detect_class_init (GstVideoDetectClass * klass) +gst_video_detect_class_init (GstSimpleVideoMarkDetectClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstBaseTransformClass *base_transform_class = @@ -239,7 +240,7 @@ gst_video_detect_class_init (GstVideoDetectClass * klass) } static void -gst_video_detect_init (GstVideoDetect * videodetect) +gst_video_detect_init (GstSimpleVideoMarkDetect * simplevideomarkdetect) { } @@ -247,37 +248,38 @@ void gst_video_detect_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (object); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (object); - GST_DEBUG_OBJECT (videodetect, "set_property"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "set_property"); switch (property_id) { case PROP_MESSAGE: - videodetect->message = g_value_get_boolean (value); + simplevideomarkdetect->message = g_value_get_boolean (value); break; case PROP_PATTERN_WIDTH: - videodetect->pattern_width = g_value_get_int (value); + simplevideomarkdetect->pattern_width = g_value_get_int (value); break; case PROP_PATTERN_HEIGHT: - videodetect->pattern_height = g_value_get_int (value); + simplevideomarkdetect->pattern_height = g_value_get_int (value); break; case PROP_PATTERN_COUNT: - videodetect->pattern_count = g_value_get_int (value); + simplevideomarkdetect->pattern_count = g_value_get_int (value); break; case PROP_PATTERN_DATA_COUNT: - videodetect->pattern_data_count = g_value_get_int (value); + simplevideomarkdetect->pattern_data_count = g_value_get_int (value); break; case PROP_PATTERN_CENTER: - videodetect->pattern_center = g_value_get_double (value); + simplevideomarkdetect->pattern_center = g_value_get_double (value); break; case PROP_PATTERN_SENSITIVITY: - videodetect->pattern_sensitivity = g_value_get_double (value); + simplevideomarkdetect->pattern_sensitivity = g_value_get_double (value); break; case PROP_LEFT_OFFSET: - videodetect->left_offset = g_value_get_int (value); + simplevideomarkdetect->left_offset = g_value_get_int (value); break; case PROP_BOTTOM_OFFSET: - videodetect->bottom_offset = g_value_get_int (value); + simplevideomarkdetect->bottom_offset = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -289,37 +291,38 @@ void gst_video_detect_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (object); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (object); - GST_DEBUG_OBJECT (videodetect, "get_property"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "get_property"); switch (property_id) { case PROP_MESSAGE: - g_value_set_boolean (value, videodetect->message); + g_value_set_boolean (value, simplevideomarkdetect->message); break; case PROP_PATTERN_WIDTH: - g_value_set_int (value, videodetect->pattern_width); + g_value_set_int (value, simplevideomarkdetect->pattern_width); break; case PROP_PATTERN_HEIGHT: - g_value_set_int (value, videodetect->pattern_height); + g_value_set_int (value, simplevideomarkdetect->pattern_height); break; case PROP_PATTERN_COUNT: - g_value_set_int (value, videodetect->pattern_count); + g_value_set_int (value, simplevideomarkdetect->pattern_count); break; case PROP_PATTERN_DATA_COUNT: - g_value_set_int (value, videodetect->pattern_data_count); + g_value_set_int (value, simplevideomarkdetect->pattern_data_count); break; case PROP_PATTERN_CENTER: - g_value_set_double (value, videodetect->pattern_center); + g_value_set_double (value, simplevideomarkdetect->pattern_center); break; case PROP_PATTERN_SENSITIVITY: - g_value_set_double (value, videodetect->pattern_sensitivity); + g_value_set_double (value, simplevideomarkdetect->pattern_sensitivity); break; case PROP_LEFT_OFFSET: - g_value_set_int (value, videodetect->left_offset); + g_value_set_int (value, simplevideomarkdetect->left_offset); break; case PROP_BOTTOM_OFFSET: - g_value_set_int (value, videodetect->bottom_offset); + g_value_set_int (value, simplevideomarkdetect->bottom_offset); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -330,9 +333,10 @@ gst_video_detect_get_property (GObject * object, guint property_id, void gst_video_detect_dispose (GObject * object) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (object); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (object); - GST_DEBUG_OBJECT (videodetect, "dispose"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "dispose"); /* clean up as possible. may be called multiple times */ @@ -342,9 +346,10 @@ gst_video_detect_dispose (GObject * object) void gst_video_detect_finalize (GObject * object) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (object); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (object); - GST_DEBUG_OBJECT (videodetect, "finalize"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "finalize"); /* clean up object here */ @@ -354,9 +359,10 @@ gst_video_detect_finalize (GObject * object) static gboolean gst_video_detect_start (GstBaseTransform * trans) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (trans); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (trans); - GST_DEBUG_OBJECT (videodetect, "start"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "start"); return TRUE; } @@ -364,9 +370,10 @@ gst_video_detect_start (GstBaseTransform * trans) static gboolean gst_video_detect_stop (GstBaseTransform * trans) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (trans); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (trans); - GST_DEBUG_OBJECT (videodetect, "stop"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "stop"); return TRUE; } @@ -375,22 +382,23 @@ static gboolean gst_video_detect_set_info (GstVideoFilter * filter, GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (filter); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (filter); - GST_DEBUG_OBJECT (videodetect, "set_info"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "set_info"); return TRUE; } static void -gst_video_detect_post_message (GstVideoDetect * videodetect, GstBuffer * buffer, - guint64 data) +gst_video_detect_post_message (GstSimpleVideoMarkDetect * simplevideomarkdetect, + GstBuffer * buffer, guint64 data) { GstBaseTransform *trans; GstMessage *m; guint64 duration, timestamp, running_time, stream_time; - trans = GST_BASE_TRANSFORM_CAST (videodetect); + trans = GST_BASE_TRANSFORM_CAST (simplevideomarkdetect); /* get timestamps */ timestamp = GST_BUFFER_TIMESTAMP (buffer); @@ -401,20 +409,21 @@ gst_video_detect_post_message (GstVideoDetect * videodetect, GstBuffer * buffer, timestamp); /* post message */ - m = gst_message_new_element (GST_OBJECT_CAST (videodetect), - gst_structure_new ("GstVideoDetect", - "have-pattern", G_TYPE_BOOLEAN, videodetect->in_pattern, + m = gst_message_new_element (GST_OBJECT_CAST (simplevideomarkdetect), + gst_structure_new ("GstSimpleVideoMarkDetect", + "have-pattern", G_TYPE_BOOLEAN, simplevideomarkdetect->in_pattern, "timestamp", G_TYPE_UINT64, timestamp, "stream-time", G_TYPE_UINT64, stream_time, "running-time", G_TYPE_UINT64, running_time, "duration", G_TYPE_UINT64, duration, "data", G_TYPE_UINT64, data, NULL)); - gst_element_post_message (GST_ELEMENT_CAST (videodetect), m); + gst_element_post_message (GST_ELEMENT_CAST (simplevideomarkdetect), m); } static gdouble -gst_video_detect_calc_brightness (GstVideoDetect * videodetect, guint8 * data, - gint width, gint height, gint row_stride, gint pixel_stride) +gst_video_detect_calc_brightness (GstSimpleVideoMarkDetect * + simplevideomarkdetect, guint8 * data, gint width, gint height, + gint row_stride, gint pixel_stride) { gint i, j; guint64 sum; @@ -430,7 +439,8 @@ gst_video_detect_calc_brightness (GstVideoDetect * videodetect, guint8 * data, } static void -gst_video_detect_yuv (GstVideoDetect * videodetect, GstVideoFrame * frame) +gst_video_detect_yuv (GstSimpleVideoMarkDetect * simplevideomarkdetect, + GstVideoFrame * frame) { gdouble brightness; gint i, pw, ph, row_stride, pixel_stride; @@ -441,85 +451,92 @@ gst_video_detect_yuv (GstVideoDetect * videodetect, GstVideoFrame * frame) width = frame->info.width; height = frame->info.height; - pw = videodetect->pattern_width; - ph = videodetect->pattern_height; + pw = simplevideomarkdetect->pattern_width; + ph = simplevideomarkdetect->pattern_height; row_stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0); pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0); req_width = - (videodetect->pattern_count + videodetect->pattern_data_count) * pw + - videodetect->left_offset; - req_height = videodetect->bottom_offset + ph; + (simplevideomarkdetect->pattern_count + + simplevideomarkdetect->pattern_data_count) * pw + + simplevideomarkdetect->left_offset; + req_height = simplevideomarkdetect->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++) { + for (i = 0; i < simplevideomarkdetect->pattern_count; i++) { d = GST_VIDEO_FRAME_COMP_DATA (frame, 0); /* move to start of bottom left, adjust for offsets */ - d += row_stride * (height - ph - videodetect->bottom_offset) + - pixel_stride * videodetect->left_offset; + d += row_stride * (height - ph - simplevideomarkdetect->bottom_offset) + + pixel_stride * simplevideomarkdetect->left_offset; /* move to i-th pattern */ d += pixel_stride * pw * i; /* calc brightness of width * height box */ - brightness = gst_video_detect_calc_brightness (videodetect, d, pw, ph, + brightness = + gst_video_detect_calc_brightness (simplevideomarkdetect, d, pw, ph, row_stride, pixel_stride); - GST_DEBUG_OBJECT (videodetect, "brightness %f", brightness); + GST_DEBUG_OBJECT (simplevideomarkdetect, "brightness %f", brightness); if (i & 1) { /* odd pixels must be white, all pixels darker than the center + * sensitivity are considered wrong. */ if (brightness < - (videodetect->pattern_center + videodetect->pattern_sensitivity)) + (simplevideomarkdetect->pattern_center + + simplevideomarkdetect->pattern_sensitivity)) goto no_pattern; } else { /* even pixels must be black, pixels lighter than the center - sensitivity * are considered wrong. */ if (brightness > - (videodetect->pattern_center - videodetect->pattern_sensitivity)) + (simplevideomarkdetect->pattern_center - + simplevideomarkdetect->pattern_sensitivity)) goto no_pattern; } } - GST_DEBUG_OBJECT (videodetect, "found pattern"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "found pattern"); pattern_data = 0; /* get the data of the pattern */ - for (i = 0; i < videodetect->pattern_data_count; i++) { + for (i = 0; i < simplevideomarkdetect->pattern_data_count; i++) { d = GST_VIDEO_FRAME_COMP_DATA (frame, 0); /* move to start of bottom left, adjust for offsets */ - d += row_stride * (height - ph - videodetect->bottom_offset) + - pixel_stride * videodetect->left_offset; + d += row_stride * (height - ph - simplevideomarkdetect->bottom_offset) + + pixel_stride * simplevideomarkdetect->left_offset; /* move after the fixed pattern */ - d += pixel_stride * (videodetect->pattern_count * pw); + d += pixel_stride * (simplevideomarkdetect->pattern_count * pw); /* move to i-th pattern data */ d += pixel_stride * pw * i; /* calc brightness of width * height box */ - brightness = gst_video_detect_calc_brightness (videodetect, d, pw, ph, + brightness = + gst_video_detect_calc_brightness (simplevideomarkdetect, d, pw, ph, row_stride, pixel_stride); /* update pattern, we just use the center to decide between black and white. */ pattern_data <<= 1; - if (brightness > videodetect->pattern_center) + if (brightness > simplevideomarkdetect->pattern_center) pattern_data |= 1; } - GST_DEBUG_OBJECT (videodetect, "have data %" G_GUINT64_FORMAT, pattern_data); + GST_DEBUG_OBJECT (simplevideomarkdetect, "have data %" G_GUINT64_FORMAT, + pattern_data); - videodetect->in_pattern = TRUE; - gst_video_detect_post_message (videodetect, frame->buffer, pattern_data); + simplevideomarkdetect->in_pattern = TRUE; + gst_video_detect_post_message (simplevideomarkdetect, frame->buffer, + pattern_data); return; no_pattern: { - GST_DEBUG_OBJECT (videodetect, "no pattern found"); - if (videodetect->in_pattern) { - videodetect->in_pattern = FALSE; - gst_video_detect_post_message (videodetect, frame->buffer, 0); + GST_DEBUG_OBJECT (simplevideomarkdetect, "no pattern found"); + if (simplevideomarkdetect->in_pattern) { + simplevideomarkdetect->in_pattern = FALSE; + gst_video_detect_post_message (simplevideomarkdetect, frame->buffer, 0); } return; } @@ -529,11 +546,12 @@ static GstFlowReturn gst_video_detect_transform_frame_ip (GstVideoFilter * filter, GstVideoFrame * frame) { - GstVideoDetect *videodetect = GST_VIDEO_DETECT (filter); + GstSimpleVideoMarkDetect *simplevideomarkdetect = + GST_SIMPLE_VIDEO_MARK_DETECT (filter); - GST_DEBUG_OBJECT (videodetect, "transform_frame_ip"); + GST_DEBUG_OBJECT (simplevideomarkdetect, "transform_frame_ip"); - gst_video_detect_yuv (videodetect, frame); + gst_video_detect_yuv (simplevideomarkdetect, frame); return GST_FLOW_OK; } diff --git a/gst/videosignal/gstvideodetect.h b/gst/videosignal/gstsimplevideomarkdetect.h index 3e942420b..51386867c 100644 --- a/gst/videosignal/gstvideodetect.h +++ b/gst/videosignal/gstsimplevideomarkdetect.h @@ -17,26 +17,26 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _GST_VIDEO_DETECT_H_ -#define _GST_VIDEO_DETECT_H_ +#ifndef _GST_SIMPLE_VIDEO_MARK_DETECT_H_ +#define _GST_SIMPLE_VIDEO_MARK_DETECT_H_ #include <gst/video/video.h> #include <gst/video/gstvideofilter.h> G_BEGIN_DECLS -#define GST_TYPE_VIDEO_DETECT (gst_video_detect_get_type()) -#define GST_VIDEO_DETECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_DETECT,GstVideoDetect)) -#define GST_VIDEO_DETECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_DETECT,GstVideoDetectClass)) -#define GST_IS_VIDEO_DETECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_DETECT)) -#define GST_IS_VIDEO_DETECT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_DETECT)) +#define GST_TYPE_SIMPLE_VIDEO_MARK_DETECT (gst_video_detect_get_type()) +#define GST_SIMPLE_VIDEO_MARK_DETECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SIMPLE_VIDEO_MARK_DETECT,GstSimpleVideoMarkDetect)) +#define GST_SIMPLE_VIDEO_MARK_DETECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SIMPLE_VIDEO_MARK_DETECT,GstSimpleVideoMarkDetectClass)) +#define GST_IS_SIMPLE_VIDEO_MARK_DETECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIMPLE_VIDEO_MARK_DETECT)) +#define GST_IS_SIMPLE_VIDEO_MARK_DETECT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIMPLE_VIDEO_MARK_DETECT)) -typedef struct _GstVideoDetect GstVideoDetect; -typedef struct _GstVideoDetectClass GstVideoDetectClass; +typedef struct _GstSimpleVideoMarkDetect GstSimpleVideoMarkDetect; +typedef struct _GstSimpleVideoMarkDetectClass GstSimpleVideoMarkDetectClass; -struct _GstVideoDetect +struct _GstSimpleVideoMarkDetect { - GstVideoFilter base_videodetect; + GstVideoFilter base_simplevideomarkdetect; gboolean message; gint pattern_width; @@ -51,9 +51,9 @@ struct _GstVideoDetect gboolean in_pattern; }; -struct _GstVideoDetectClass +struct _GstSimpleVideoMarkDetectClass { - GstVideoFilterClass base_videodetect_class; + GstVideoFilterClass base_simplevideomarkdetect_class; }; GType gst_video_detect_get_type (void); diff --git a/gst/videosignal/gstvideosignal.c b/gst/videosignal/gstvideosignal.c index f96450002..918dc028a 100644 --- a/gst/videosignal/gstvideosignal.c +++ b/gst/videosignal/gstvideosignal.c @@ -22,8 +22,8 @@ #endif #include "gstvideoanalyse.h" -#include "gstvideodetect.h" -#include "gstvideomark.h" +#include "gstsimplevideomarkdetect.h" +#include "gstsimplevideomark.h" static gboolean plugin_init (GstPlugin * plugin) @@ -34,14 +34,14 @@ plugin_init (GstPlugin * plugin) GST_TYPE_VIDEO_ANALYSE); /* FIXME under no circumstances is anyone allowed to revive the - * element formerly known as videodetect without changing the name + * element formerly known as simplevideomarkdetect without changing the name * first. XOXO --ds */ - res &= gst_element_register (plugin, "videodetect", GST_RANK_NONE, - GST_TYPE_VIDEO_DETECT); + res &= gst_element_register (plugin, "simplevideomarkdetect", GST_RANK_NONE, + GST_TYPE_SIMPLE_VIDEO_MARK_DETECT); - res &= gst_element_register (plugin, "videomark", GST_RANK_NONE, - GST_TYPE_VIDEO_MARK); + res &= gst_element_register (plugin, "simplevideomark", GST_RANK_NONE, + GST_TYPE_SIMPLE_VIDEO_MARK); return res; } |