}
}
-/* copies the given caps */
-static GstCaps *
-gst_glimage_sink_caps_remove_format_info (GstCaps * caps)
-{
- GstStructure *st;
- GstCapsFeatures *f;
- gint i, n;
- GstCaps *res;
-
- res = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- st = gst_caps_get_structure (caps, i);
- f = gst_caps_get_features (caps, i);
-
- /* If this is already expressed by the existing caps
- * skip this structure */
- if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
- continue;
-
- st = gst_structure_copy (st);
- /* Only remove format info for the cases when we can actually convert */
- if (!gst_caps_features_is_any (f)
- && gst_caps_features_is_equal (f,
- GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
- gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
- NULL);
- gst_structure_remove_fields (st, "width", "height", NULL);
-
- gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
- }
-
- return res;
-}
-
static GstCaps *
gst_glimage_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
{
tmp = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA");
- result = gst_glimage_sink_caps_remove_format_info (tmp);
- gst_caps_unref (tmp);
- tmp = result;
- GST_DEBUG_OBJECT (bsink, "remove format returned caps %" GST_PTR_FORMAT, tmp);
-
result =
gst_gl_color_convert_transform_caps (gl_sink->context, GST_PAD_SRC, tmp,
NULL);
return ret;
}
-/* copies the given caps */
-static GstCaps *
-gst_gl_mixer_caps_remove_format_info (GstCaps * caps)
-{
- GstStructure *st;
- GstCapsFeatures *f;
- gint i, n;
- GstCaps *res;
-
- res = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- st = gst_caps_get_structure (caps, i);
- f = gst_caps_get_features (caps, i);
-
- /* If this is already expressed by the existing caps
- * skip this structure */
- if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
- continue;
-
- st = gst_structure_copy (st);
- /* Only remove format info for the cases when we can actually convert */
- if (!gst_caps_features_is_any (f)
- && gst_caps_features_is_equal (f,
- GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
- gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
- NULL);
- gst_structure_remove_fields (st, "width", "height", NULL);
-
- gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
- }
-
- return res;
-}
-
GstCaps *
gst_gl_mixer_update_caps (GstGLMixer * mix, GstCaps * caps)
{
- GstCaps *result, *tmp, *gl_caps;
-
- gl_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA");
+ GstCaps *result, *tmp;
result =
- gst_gl_color_convert_transform_caps (mix->context, GST_PAD_SRC, gl_caps,
+ gst_gl_color_convert_transform_caps (mix->context, GST_PAD_SRC, caps,
NULL);
tmp = result;
GST_DEBUG_OBJECT (mix, "convert returned caps %" GST_PTR_FORMAT, tmp);
- result = gst_gl_mixer_caps_remove_format_info (tmp);
- gst_caps_unref (tmp);
- tmp = result;
- GST_DEBUG_OBJECT (mix, "remove format returned caps %" GST_PTR_FORMAT, tmp);
-
result = gst_gl_upload_transform_caps (mix->context, GST_PAD_SRC, tmp, NULL);
gst_caps_unref (tmp);
tmp = result;
NULL);
retcaps = gst_caps_merge (gl_caps, retcaps);
gst_caps_unref (current_caps);
- current_caps = retcaps;
-
- retcaps = gst_gl_mixer_caps_remove_format_info (current_caps);
- gst_caps_unref (current_caps);
if (filter) {
current_caps =
}
}
-/* copies the given caps */
-static GstCaps *
-gst_gl_test_src_caps_remove_format_info (GstCaps * caps)
-{
- GstStructure *st;
- GstCapsFeatures *f;
- gint i, n;
- GstCaps *res;
-
- res = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- st = gst_caps_get_structure (caps, i);
- f = gst_caps_get_features (caps, i);
-
- /* If this is already expressed by the existing caps
- * skip this structure */
- if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
- continue;
-
- st = gst_structure_copy (st);
- /* Only remove format info for the cases when we can actually convert */
- if (!gst_caps_features_is_any (f)
- && gst_caps_features_is_equal (f,
- GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
- gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
- NULL);
- gst_structure_remove_fields (st, "width", "height", NULL);
-
- gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
- }
-
- return res;
-}
-
static GstCaps *
gst_gl_test_src_set_caps_features (const GstCaps * caps,
const gchar * feature_name)
gst_gl_test_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
{
GstGLTestSrc *src = GST_GL_TEST_SRC (bsrc);
- GstCaps *tmp = NULL;
+ GstCaps *tmp;
GstCaps *result = NULL;
GstCaps *gl_caps;
GstCaps *caps =
gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA");
- tmp = gst_gl_test_src_caps_remove_format_info (caps);
- GST_DEBUG_OBJECT (bsrc, "remove format returned caps %" GST_PTR_FORMAT, tmp);
-
gl_caps =
- gst_caps_merge (gst_gl_test_src_set_caps_features (tmp,
+ gst_caps_merge (gst_gl_test_src_set_caps_features (caps,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY),
- gst_gl_test_src_set_caps_features (tmp,
+ gst_gl_test_src_set_caps_features (caps,
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META));
result =
- gst_gl_download_transform_caps (src->context, GST_PAD_SINK, tmp, NULL);
+ gst_gl_download_transform_caps (src->context, GST_PAD_SINK, caps, NULL);
result = gst_caps_merge (gl_caps, result);
- gst_caps_unref (tmp);
- tmp = result;
- GST_DEBUG_OBJECT (bsrc, "transfer returned caps %" GST_PTR_FORMAT, tmp);
+ GST_DEBUG_OBJECT (bsrc, "transfer returned caps %" GST_PTR_FORMAT, result);
if (filter) {
- result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (tmp);
- } else {
+ tmp = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (result);
result = tmp;
}
return ret;
}
+/* copies the given caps */
+static GstCaps *
+gst_gl_color_convert_caps_remove_format_info (GstCaps * caps)
+{
+ GstStructure *st;
+ GstCapsFeatures *f;
+ gint i, n;
+ GstCaps *res;
+
+ res = gst_caps_new_empty ();
+
+ n = gst_caps_get_size (caps);
+ for (i = 0; i < n; i++) {
+ st = gst_caps_get_structure (caps, i);
+ f = gst_caps_get_features (caps, i);
+
+ /* If this is already expressed by the existing caps
+ * skip this structure */
+ if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
+ continue;
+
+ st = gst_structure_copy (st);
+ gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
+ NULL);
+ gst_structure_remove_fields (st, "width", "height", NULL);
+
+ gst_caps_append_structure_full (res, st,
+ gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
+ }
+
+ return res;
+}
+
GstCaps *
gst_gl_color_convert_transform_caps (GstGLContext * convert,
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_COLOR_CONVERT_FORMATS));
+ caps = gst_gl_color_convert_caps_remove_format_info (caps);
+ result = gst_caps_intersect (caps, templ);
+ gst_caps_unref (caps);
+ gst_caps_unref (templ);
+
if (filter) {
- result = gst_caps_intersect_full (filter, templ, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (templ);
- } else {
- result = templ;
+ GstCaps *tmp;
+
+ tmp = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (result);
+ result = tmp;
}
return result;
return ret;
}
-/* copies the given caps */
-static GstCaps *
-gst_gl_filter_caps_remove_format_info (GstCaps * caps)
-{
- GstStructure *st;
- GstCapsFeatures *f;
- gint i, n;
- GstCaps *res;
-
- res = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- st = gst_caps_get_structure (caps, i);
- f = gst_caps_get_features (caps, i);
-
- /* If this is already expressed by the existing caps
- * skip this structure */
- if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
- continue;
-
- st = gst_structure_copy (st);
- /* Only remove format info for the cases when we can actually convert */
- if (!gst_caps_features_is_any (f)
- && gst_caps_features_is_equal (f,
- GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
- gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
- NULL);
- gst_structure_remove_fields (st, "width", "height", NULL);
-
- gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
- }
-
- return res;
-}
-
static GstCaps *
gst_gl_filter_transform_caps (GstBaseTransform * bt,
GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps)
tmp = result;
GST_DEBUG_OBJECT (bt, "transfer returned caps %" GST_PTR_FORMAT, tmp);
- result = gst_gl_filter_caps_remove_format_info (tmp);
- gst_caps_unref (tmp);
- tmp = result;
- GST_DEBUG_OBJECT (bt, "remove format returned caps %" GST_PTR_FORMAT, tmp);
-
if (direction == GST_PAD_SRC) {
result =
gst_gl_color_convert_transform_caps (filter->context, direction, tmp,