#include "gstcaps.h"
#include "gsttype.h"
+#include "gstlog.h"
static GMemChunk *_gst_caps_chunk;
static GMutex *_gst_caps_chunk_lock;
GType _gst_caps_type;
+static void
+transform_func (const GValue *src_value,
+ GValue *dest_value)
+{
+ GstCaps *caps = g_value_peek_pointer (src_value);
+ GString *result = g_string_new ("");
+
+ g_string_append_printf (result, "(GstCaps *) ");
+
+ while (caps) {
+ gchar *props;
+ GValue value = { 0, }; /* the important thing is that value.type = 0 */
+
+ g_string_append_printf (result,
+ "{ %s; ", gst_caps_get_mime (caps));
+
+ g_value_init (&value, GST_TYPE_PROPS);
+ g_value_set_boxed (&value, caps->properties);
+ props = g_strdup_value_contents (&value);
+
+ g_string_append (result, props);
+ g_free (props);
+
+ caps = caps->next;
+ g_string_append_printf (result, " }%s", caps?", ":"");
+ }
+ dest_value->data[0].v_pointer = result->str;
+}
+
void
_gst_caps_initialize (void)
{
(GBoxedCopyFunc) gst_caps_ref,
(GBoxedFreeFunc) gst_caps_unref);
+ g_value_register_transform_func (_gst_caps_type,
+ G_TYPE_STRING,
+ transform_func);
}
static guint16
definition.exts = NULL;
definition.typefindfunc = NULL;
- factory = gst_typefactory_new (&definition);
+ factory = gst_type_factory_new (&definition);
typeid = gst_type_register (factory);
}
if (caps == NULL)
return;
-
+
next = caps->next;
gst_props_unref (caps->properties);
{
GST_DEBUG_ENTER ("caps debug: %s", label);
while (caps) {
- GST_DEBUG (GST_CAT_CAPS, "caps: %p %s %s", caps, caps->name, gst_caps_get_mime (caps));
+ GST_DEBUG (GST_CAT_CAPS, "caps: %p %s %s (%sfixed)", caps, caps->name, gst_caps_get_mime (caps),
+ caps->fixed ? "" : "NOT ");
if (caps->properties) {
gst_props_debug (caps->properties);
return result;
}
+/**
+ * gst_caps_normalize:
+ * @caps: a capabilty
+ *
+ * Make the normalisation of the caps. This will return a new caps
+ * that is equivalent to the input caps with the exception that all
+ * lists are unrolled. This function is useful when you want to iterate
+ * the caps.
+ *
+ * Returns: The normalisation of the caps.
+ */
GstCaps*
gst_caps_normalize (GstCaps *caps)
{