* Various methods exist to work with the media types such as subtracting
* or intersecting.
*
+ * Be aware that the current #GstCaps / #GstStructure serialization into string
+ * has limited support for nested #GstCaps / #GstStructure fields. It can only
+ * support one level of nesting. Using more levels will lead to unexpected
+ * behavior when using serialization features, such as gst_caps_to_string() or
+ * gst_value_serialize() and their counterparts.
+ *
* Last reviewed on 2011-03-28 (0.11.3)
*/
* ]|
* This prints the caps in human readable form.
*
+ * The current implementation of serialization will lead to unexpected results
+ * when there are nested #GstCaps / #GstStructure deeper than one level.
+ *
* Returns: (transfer full): a newly allocated string representing @caps.
*/
gchar *
*
* Converts @caps from a string representation.
*
+ * The current implementation of serialization will lead to unexpected results
+ * when there are nested #GstCaps / #GstStructure deeper than one level.
+ *
* Returns: (transfer full): a newly allocated #GstCaps
*/
GstCaps *
* Strings in structures must be ASCII or UTF-8 encoded. Other encodings are
* not allowed. Strings must not be empty either, but may be NULL.
*
+ * Be aware that the current #GstCaps / #GstStructure serialization into string
+ * has limited support for nested #GstCaps / #GstStructure fields. It can only
+ * support one level of nesting. Using more levels will lead to unexpected
+ * behavior when using serialization features, such as gst_caps_to_string() or
+ * gst_value_serialize() and their counterparts.
+ *
* Last reviewed on 2012-03-29 (0.11.3)
*/
* ]|
* This prints the structure in human readble form.
*
+ * The current implementation of serialization will lead to unexpected results
+ * when there are nested #GstCaps / #GstStructure deeper than one level.
+ *
* Free-function: g_free
*
* Returns: (transfer full): a pointer to string allocated by g_malloc().
* If end is not NULL, a pointer to the place inside the given string
* where parsing ended will be returned.
*
+ * The current implementation of serialization will lead to unexpected results
+ * when there are nested #GstCaps / #GstStructure deeper than one level.
+ *
* Free-function: gst_structure_free
*
* Returns: (transfer full): a new #GstStructure or NULL when the string could
gst_value_serialize_caps (const GValue * value)
{
GstCaps *caps = g_value_get_boxed (value);
-
- return gst_caps_to_string (caps);
+ return gst_string_take_and_wrap (gst_caps_to_string (caps));
}
static gboolean
{
GstCaps *caps;
- caps = gst_caps_from_string (s);
+ if (*s != '"') {
+ caps = gst_caps_from_string (s);
+ } else {
+ gchar *str = gst_string_unwrap (s);
+
+ if (G_UNLIKELY (!str))
+ return FALSE;
+
+ caps = gst_caps_from_string (str);
+ g_free (str);
+ }
if (caps) {
g_value_take_boxed (dest, caps);
, value2 = {
0};
GstCaps *caps, *caps2;
+ GstCaps *incaps;
gchar *serialized;
+ incaps = gst_caps_new_simple ("caps/internal",
+ "in-field", G_TYPE_INT, 20, "in-field2",
+ G_TYPE_STRING, "some in ternal field", NULL);
caps = gst_caps_new_simple ("test/caps",
- "foo", G_TYPE_INT, 10, "bar", G_TYPE_STRING, "test", NULL);
+ "foo", G_TYPE_INT, 10, "bar", G_TYPE_STRING, "test",
+ "int-caps", GST_TYPE_CAPS, incaps, NULL);
fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1);
+ gst_caps_unref (incaps);
/* and assign caps to gvalue */
g_value_init (&value, GST_TYPE_CAPS);