diff options
author | Josh Doe <josh@joshdoe.com> | 2010-11-19 15:23:41 -0500 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2010-11-22 22:25:18 -0300 |
commit | 6e43f75df3340fca4b9d084c51933a191f7737e2 (patch) | |
tree | ab435bda115e6673b0675d76ee1b1246c2c3a9a2 /ext/opencv/gstcvsobel.c | |
parent | 7622328aab0aea21841a50e1fa4ab98b8d6389fa (diff) | |
download | gstreamer-plugins-bad-6e43f75df3340fca4b9d084c51933a191f7737e2.tar.gz |
opencv: fix caps issues and extend supported caps for some elements
Some elements had vague caps, such as "video/x-raw-rgb", which caused problems
at least with textwrite. For other elements, the underlying OpenCV functions
support more than just one image type, so I increased the number of supported
caps.
I created a utility function "gst_opencv_caps_from_cv_image_type", so each
element creates caps directly from OpenCV image types, such as CV_8UC1 for
8-bit grayscale. This function uses gstvideo to create uniform caps.
https://bugzilla.gnome.org/show_bug.cgi?id=635304
Diffstat (limited to 'ext/opencv/gstcvsobel.c')
-rw-r--r-- | ext/opencv/gstcvsobel.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/opencv/gstcvsobel.c b/ext/opencv/gstcvsobel.c index eaeeeb804..9ee55d915 100644 --- a/ext/opencv/gstcvsobel.c +++ b/ext/opencv/gstcvsobel.c @@ -47,6 +47,7 @@ #include <gst/gst.h> +#include "gstopencvutils.h" #include "gstcvsobel.h" GST_DEBUG_CATEGORY_STATIC (gst_cv_sobel_debug); @@ -55,14 +56,19 @@ GST_DEBUG_CATEGORY_STATIC (gst_cv_sobel_debug); static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-gray, depth=(int)8, bpp=(int)8") + GST_STATIC_CAPS (GST_VIDEO_CAPS_GRAY8) ); +#if G_BYTE_ORDER == G_BIG_ENDIAN + #define BYTE_ORDER_STRING "BIG_ENDIAN" +#else + #define BYTE_ORDER_STRING "LITTLE_ENDIAN" +#endif + static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS - ("video/x-raw-gray, depth=(int)16, bpp=(int)16, endianness=(int)4321") + GST_STATIC_CAPS (GST_VIDEO_CAPS_GRAY16 (BYTE_ORDER_STRING)) ); /* Filter signals and args */ @@ -188,14 +194,18 @@ gst_cv_sobel_transform_caps (GstBaseTransform * trans, GstPadDirection dir, structure = gst_caps_get_structure (output, i); gst_structure_set (structure, "depth", G_TYPE_INT, 16, - "bpp", G_TYPE_INT, 16, "endianness", G_TYPE_INT, 4321, NULL); + "bpp", G_TYPE_INT, 16, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + NULL); } break; case GST_PAD_SRC: for (i = 0; i < gst_caps_get_size (output); i++) { structure = gst_caps_get_structure (output, i); gst_structure_set (structure, - "depth", G_TYPE_INT, 8, "bpp", G_TYPE_INT, 8, NULL); + "depth", G_TYPE_INT, 8, + "bpp", G_TYPE_INT, 8, + NULL); gst_structure_remove_field (structure, "endianness"); } break; |