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
static gboolean gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2);
static GList* gst_props_list_copy (GList *propslist);
+static void
+transform_func (const GValue *src_value,
+ GValue *dest_value)
+{
+ GstProps *props = g_value_peek_pointer (src_value);
+ GString *result = g_string_new ("");
+ GList *propslist = props->properties;
+
+ while (propslist) {
+ GstPropsEntry *entry = (GstPropsEntry *)propslist->data;
+ const gchar *name = g_quark_to_string (entry->propid);
+
+ switch (entry->propstype) {
+ case GST_PROPS_STRING_TYPE:
+ g_string_append_printf (result, "%s='%s'", name, entry->data.string_data.string);
+ default:
+ break;
+ }
+
+ propslist = g_list_next (propslist);
+ if (propslist) {
+ g_string_append (result, "; ");
+ }
+ }
+ dest_value->data[0].v_pointer = result->str;
+}
+
void
_gst_props_initialize (void)
(GBoxedCopyFunc) gst_props_ref,
(GBoxedFreeFunc) gst_props_unref);
+ g_value_register_transform_func (_gst_props_type,
+ G_TYPE_STRING,
+ transform_func);
}
static void
GST_DEBUG (GST_CAT_PROPERTIES, "%s: bool %d", name, entry->data.bool_data);
break;
case GST_PROPS_STRING_TYPE:
- GST_DEBUG (GST_CAT_PROPERTIES, "%s: string %s", name, entry->data.string_data.string);
+ GST_DEBUG (GST_CAT_PROPERTIES, "%s: string \"%s\"", name, entry->data.string_data.string);
break;
case GST_PROPS_INT_RANGE_TYPE:
GST_DEBUG (GST_CAT_PROPERTIES, "%s: int range %d-%d", name, entry->data.int_range_data.min,
case GST_PROPS_STRING_TYPE: \
entry->data.string_data.string = g_strdup (va_arg (var_args, gchar*)); \
break; \
+ case GST_PROPS_LIST_TYPE: \
+ entry->data.list_data.entries = g_list_copy (va_arg (var_args, GList*)); \
+ break; \
default: \
break; \
} \