summaryrefslogtreecommitdiff
path: root/ext/opencv/gstcvlaplace.c
diff options
context:
space:
mode:
authorJosh Doe <josh@joshdoe.com>2010-11-19 15:23:41 -0500
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-11-22 22:25:18 -0300
commit6e43f75df3340fca4b9d084c51933a191f7737e2 (patch)
treeab435bda115e6673b0675d76ee1b1246c2c3a9a2 /ext/opencv/gstcvlaplace.c
parent7622328aab0aea21841a50e1fa4ab98b8d6389fa (diff)
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/gstcvlaplace.c')
-rw-r--r--ext/opencv/gstcvlaplace.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/opencv/gstcvlaplace.c b/ext/opencv/gstcvlaplace.c
index f52842871..eddcbb12c 100644
--- a/ext/opencv/gstcvlaplace.c
+++ b/ext/opencv/gstcvlaplace.c
@@ -47,6 +47,7 @@
#include <gst/gst.h>
+#include "gstopencvutils.h"
#include "gstcvlaplace.h"
GST_DEBUG_CATEGORY_STATIC (gst_cv_laplace_debug);
@@ -55,14 +56,19 @@ GST_DEBUG_CATEGORY_STATIC (gst_cv_laplace_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 */
@@ -213,14 +219,18 @@ gst_cv_laplace_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;