gint * height, gint * ipldepth, gint * channels, GError ** err)
{
GstVideoInfo info;
- gint depth = 0;
- guint i;
- gchar *caps_str;
if (!gst_video_info_from_caps (&info, caps)) {
GST_ERROR ("Failed to get the videoinfo from caps");
return FALSE;
}
- *width = GST_VIDEO_INFO_WIDTH (&info);
- *height = GST_VIDEO_INFO_HEIGHT (&info);
- if (GST_VIDEO_INFO_IS_RGB (&info))
+ return gst_opencv_iplimage_params_from_video_info (&info, width, height,
+ ipldepth, channels, err);
+}
+
+gboolean
+gst_opencv_iplimage_params_from_video_info (GstVideoInfo * info, gint * width,
+ gint * height, gint * ipldepth, gint * channels, GError ** err)
+{
+ gint depth = 0;
+ guint i;
+
+ *width = GST_VIDEO_INFO_WIDTH (info);
+ *height = GST_VIDEO_INFO_HEIGHT (info);
+ if (GST_VIDEO_INFO_IS_RGB (info))
*channels = 3;
- else if (GST_VIDEO_INFO_IS_GRAY (&info))
+ else if (GST_VIDEO_INFO_IS_GRAY (info))
*channels = 1;
else {
- caps_str = gst_caps_to_string (caps);
g_set_error (err, GST_CORE_ERROR, GST_CORE_ERROR_NEGOTIATION,
- "Unsupported caps %s", caps_str);
- g_free (caps_str);
+ "Unsupported video format %s",
+ gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info)));
return FALSE;
}
- for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (&info); i++)
- depth += GST_VIDEO_INFO_COMP_DEPTH (&info, i);
+ for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (info); i++)
+ depth += GST_VIDEO_INFO_COMP_DEPTH (info, i);
if (depth / *channels == 8) {
/* TODO signdness? */
(GstCaps * caps, gint * width, gint * height, gint * depth,
gint * channels, GError ** err);
+gboolean gst_opencv_iplimage_params_from_video_info
+ (GstVideoInfo * info, gint * width, gint * height, gint * depth,
+ gint * channels, GError ** err);
+
GstCaps * gst_opencv_caps_from_cv_image_type (int cv_type);
G_END_DECLS
GError *in_err = NULL;
GError *out_err = NULL;
- if (!gst_opencv_parse_iplimage_params_from_caps (incaps, &in_width,
+ if (!gst_opencv_iplimage_params_from_video_info (in_info, &in_width,
&in_height, &in_depth, &in_channels, &in_err)) {
GST_WARNING_OBJECT (transform, "Failed to parse input caps: %s",
in_err->message);
return FALSE;
}
- if (!gst_opencv_parse_iplimage_params_from_caps (outcaps, &out_width,
+ if (!gst_opencv_iplimage_params_from_video_info (out_info, &out_width,
&out_height, &out_depth, &out_channels, &out_err)) {
GST_WARNING_OBJECT (transform, "Failed to parse output caps: %s",
out_err->message);