//#define DEBUG_ENABLED
+#include "gstdebug.h"
#include "gstcaps.h"
#include "gsttype.h"
return caps;
}
+GstCaps*
+gst_caps_new_with_props (gchar *mime, GstProps *props)
+{
+ GstCaps *caps;
+
+ caps = gst_caps_new (mime);
+ caps->properties = props;
+
+ return caps;
+}
+
/**
* gst_caps_register:
* @factory: the factory to register
return caps;
}
+GstCaps*
+gst_caps_set_props (GstCaps *caps, GstProps *props)
+{
+ g_return_val_if_fail (caps != NULL, caps);
+ g_return_val_if_fail (props != NULL, caps);
+ g_return_val_if_fail (caps->properties == NULL, caps);
+
+ caps->properties = props;
+
+ return caps;
+}
+
+GstProps*
+gst_caps_get_props (GstCaps *caps)
+{
+ g_return_val_if_fail (caps != NULL, caps);
+
+ return caps->properties;
+}
/**
* gst_caps_check_compatibility:
g_return_val_if_fail (tocaps != NULL, FALSE);
if (fromcaps->id != tocaps->id) {
- //g_print ("gstcaps: mime types wrong\n");
+ DEBUG ("gstcaps: mime types wrong\n");
return FALSE;
}
if (tocaps->properties) {
- GstPropsEntry *entry = (GstPropsEntry *)tocaps->properties;
-
if (fromcaps->properties) {
return gst_props_check_compatibility (fromcaps->properties, tocaps->properties);
}
else {
- //g_print ("gstcaps: no source caps\n");
+ DEBUG ("gstcaps: no source caps\n");
return FALSE;
}
}
else {
// assume it accepts everything
- //g_print ("gstcaps: no caps\n");
+ DEBUG ("gstcaps: no caps\n");
return TRUE;
}
}
void _gst_caps_initialize (void);
GstCaps* gst_caps_new (gchar *mime);
+GstCaps* gst_caps_new_with_props (gchar *mime, GstProps *props);
GstCaps* gst_caps_register (GstCapsFactory *factory);
+GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
+GstProps* gst_caps_get_props (GstCaps *caps);
+
gboolean gst_caps_check_compatibility (GstCaps *caps1, GstCaps *caps2);
xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
return props;
}
+GstProps *
+gst_props_new (GstPropsFactoryEntry entry, ...)
+{
+ va_list var_args;
+ GstPropsFactoryEntry value;
+ gint i = 0;
+ gint size;
+ GstPropsFactoryEntry *factory;
+
+
+ size = 16;
+ factory = (GstPropsFactoryEntry *) g_malloc (size*sizeof(GstPropsFactoryEntry));
+
+ va_start (var_args, entry);
+
+ value = (GstPropsFactoryEntry) entry;
+
+ while (value) {
+ DEBUG ("%p\n", value);
+
+ factory[i++] = value;
+
+ if (i >= size) {
+ size += 16;
+ factory = (GstPropsFactoryEntry *) g_realloc (factory, size*sizeof(GstPropsFactoryEntry));
+ }
+
+ value = va_arg (var_args, GstPropsFactoryEntry);
+ }
+ factory[i++] = NULL;
+
+ return gst_props_register (factory);
+}
+
+GstProps*
+gst_props_merge (GstProps *props, GstProps *tomerge)
+{
+ GSList *merge_props;
+
+ g_return_val_if_fail (props != NULL, NULL);
+ g_return_val_if_fail (tomerge != NULL, NULL);
+
+ merge_props = tomerge->properties;
+
+ // FIXME do proper merging here...
+ while (merge_props) {
+ GstPropsEntry *entry = (GstPropsEntry *)merge_props->data;
+
+ props->properties = g_slist_insert_sorted (props->properties, entry, props_compare_func);
+
+ merge_props = g_slist_next (merge_props);
+ }
+
+ return props;
+}
+
+
/* entry2 is always a list, entry1 never is */
static gboolean
gst_props_entry_check_list_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2)
struct _GstProps {
- GSList *properties; /* properties for this capability */
+ GSList *properties; /* real properties for this property */
};
/* initialize the subsystem */
GstProps* gst_props_register (GstPropsFactory factory);
+GstProps* gst_props_new (GstPropsFactoryEntry entry, ...);
+
+GstProps* gst_props_merge (GstProps *props, GstProps *tomerge);
+
gboolean gst_props_check_compatibility (GstProps *props1, GstProps *props2);
xmlNodePtr gst_props_save_thyself (GstProps *props, xmlNodePtr parent);
-noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip mp3encode autoplug
+noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip mp3encode autoplug props
LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la
CFLAGS = -Wall