diff options
author | René Stadler <mail@renestadler.de> | 2009-09-04 22:30:27 +0300 |
---|---|---|
committer | René Stadler <mail@renestadler.de> | 2009-09-26 19:11:09 +0300 |
commit | d171d713f3eabfe891fab59e94eca352b985c049 (patch) | |
tree | 22b0c545b19e0cebdb8765908d4f6e567b7ea08b /gst/videosignal/gstvideodetect.c | |
parent | 5b87b537beea3e2f5f4b59589a56a68d725b57b8 (diff) | |
download | gstreamer-plugins-bad-d171d713f3eabfe891fab59e94eca352b985c049.tar.gz |
videosignal: add support for all planar YUV formats, using gstvideo
Diffstat (limited to 'gst/videosignal/gstvideodetect.c')
-rw-r--r-- | gst/videosignal/gstvideodetect.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gst/videosignal/gstvideodetect.c b/gst/videosignal/gstvideodetect.c index 3cdf3c661..942392fa2 100644 --- a/gst/videosignal/gstvideodetect.c +++ b/gst/videosignal/gstvideodetect.c @@ -145,14 +145,14 @@ static GstStaticPadTemplate gst_video_detect_src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12 }")) + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, Y41B, Y42B, Y444 }")) ); static GstStaticPadTemplate gst_video_detect_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12 }")) + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, Y41B, Y42B, Y444 }")) ); static GstVideoFilterClass *parent_class = NULL; @@ -163,6 +163,7 @@ gst_video_detect_set_caps (GstBaseTransform * btrans, GstCaps * incaps, { GstVideoDetect *vf; GstStructure *in_s; + guint32 fourcc; gboolean ret; vf = GST_VIDEO_DETECT (btrans); @@ -171,13 +172,14 @@ gst_video_detect_set_caps (GstBaseTransform * btrans, GstCaps * incaps, ret = gst_structure_get_int (in_s, "width", &vf->width); ret &= gst_structure_get_int (in_s, "height", &vf->height); - ret &= gst_structure_get_fourcc (in_s, "format", &vf->format); + ret &= gst_structure_get_fourcc (in_s, "format", &fourcc); + + if (ret) + vf->format = gst_video_format_from_fourcc (fourcc); return ret; } -#define GST_VIDEO_I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width)) - static void gst_video_detect_post_message (GstVideoDetect * videodetect, GstBuffer * buffer, guint data) @@ -227,8 +229,9 @@ gst_video_detect_calc_brightness (GstVideoDetect * videodetect, guint8 * data, } static void -gst_video_detect_420 (GstVideoDetect * videodetect, GstBuffer * buffer) +gst_video_detect_yuv (GstVideoDetect * videodetect, GstBuffer * buffer) { + GstVideoFormat format; gdouble brightness; gint i, pw, ph, stride, width, height; gint req_width, req_height; @@ -237,12 +240,13 @@ gst_video_detect_420 (GstVideoDetect * videodetect, GstBuffer * buffer) data = GST_BUFFER_DATA (buffer); + format = videodetect->format; width = videodetect->width; height = videodetect->height; pw = videodetect->pattern_width; ph = videodetect->pattern_height; - stride = GST_VIDEO_I420_Y_ROWSTRIDE (width); + stride = gst_video_format_get_row_stride (format, 0, width); req_width = (videodetect->pattern_count + videodetect->pattern_data_count) * pw + @@ -331,7 +335,7 @@ gst_video_detect_transform_ip (GstBaseTransform * trans, GstBuffer * buf) videodetect = GST_VIDEO_DETECT (trans); - gst_video_detect_420 (videodetect, buf); + gst_video_detect_yuv (videodetect, buf); return ret; } |