static gboolean playing;
/* eos will be called when the src element has an end of stream */
-void eos(GstSrc *src)
+void eos(GstElement *src)
{
g_print("have eos, quitting\n");
"sink",
GST_PAD_FACTORY_SINK,
GST_PAD_FACTORY_ALWAYS,
- "audio/raw",
- "format", GST_PROPS_INT (AFMT_S16_LE),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
+ GST_PAD_FACTORY_CAPS (
+ "audiosink_sink",
+ "audio/raw",
+ "format", GST_PROPS_INT (AFMT_S16_LE),
+ "depth", GST_PROPS_LIST (
+ GST_PROPS_INT (8),
GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
+ ),
+ "rate", GST_PROPS_INT_RANGE (8000, 48000),
+ "channels", GST_PROPS_INT_RANGE (1, 2)
+ ),
NULL
};
#include <gst/gstpipeline.h>
#include <gst/gstthread.h>
#include <gst/gsttype.h>
+#include <gst/gstautoplug.h>
#include <gst/gstcaps.h>
#include <gst/gstprops.h>
#include <gst/gstplugin.h>
if (srctemp->direction == GST_PAD_SRC &&
desttemp->direction == GST_PAD_SINK) {
- if (gst_caps_check_compatibility (srctemp->caps, desttemp->caps)) {
+ if (gst_caps_list_check_compatibility (srctemp->caps, desttemp->caps)) {
INFO(0,"factory \"%s\" can connect with factory \"%s\"", src->name, dest->name);
return TRUE;
}
}
typedef struct {
- GstCaps *src;
- GstCaps *sink;
+ GList *src;
+ GList *sink;
} caps_struct;
#define IS_CAPS(cap) (((cap) == caps->src) || (cap) == caps->sink)
gboolean res;
if (IS_CAPS (src) && IS_CAPS (dest)) {
- res = gst_caps_check_compatibility ((GstCaps *)src, (GstCaps *)dest);
- INFO (0,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res);
+ res = gst_caps_list_check_compatibility ((GList *)src, (GList *)dest);
+ //INFO (0,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res);
}
else if (IS_CAPS (src)) {
- res = gst_elementfactory_can_sink_caps ((GstElementFactory *)dest, src);
- INFO (0,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res);
+ res = gst_elementfactory_can_sink_caps_list ((GstElementFactory *)dest, (GList *)src);
+ //INFO (0,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res);
}
else if (IS_CAPS (dest)) {
- res = gst_elementfactory_can_src_caps ((GstElementFactory *)src, dest);
- INFO (0,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res);
+ res = gst_elementfactory_can_src_caps_list ((GstElementFactory *)src, (GList *)dest);
+ //INFO (0,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res);
}
else {
res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest);
{
caps_struct caps;
+ caps.src = g_list_prepend (NULL,srccaps);
+ caps.sink = g_list_prepend (NULL,sinkcaps);
+
+ INFO (0,"autoplugging two caps structures");
+
+ return gst_autoplug_func (caps.src, caps.sink,
+ gst_autoplug_elementfactory_get_list,
+ gst_autoplug_caps_find_cost,
+ &caps);
+}
+
+GList*
+gst_autoplug_caps_list (GList *srccaps, GList *sinkcaps)
+{
+ caps_struct caps;
+
caps.src = srccaps;
caps.sink = sinkcaps;
- INFO (0,"autoplugging two caps structures");
+ INFO (0,"autoplugging two caps list structures");
- return gst_autoplug_func (srccaps, sinkcaps,
+ return gst_autoplug_func (caps.src, caps.sink,
gst_autoplug_elementfactory_get_list,
gst_autoplug_caps_find_cost,
&caps);
}
+GList*
+gst_autoplug_pads (GstPad *srcpad, GstPad *sinkpad)
+{
+ caps_struct caps;
+
+ caps.src = srcpad->caps;
+ caps.sink = sinkpad->caps;
+
+ INFO (0,"autoplugging two caps structures");
+
+ return gst_autoplug_func (caps.src, caps.sink,
+ gst_autoplug_elementfactory_get_list,
+ gst_autoplug_caps_find_cost,
+ &caps);
+}
static gint
find_factory (gst_autoplug_node *rgnNodes, gpointer factory)
{
GtkType gst_autoplug_get_type (void);
GList* gst_autoplug_caps (GstCaps *srccaps, GstCaps *sinkcaps);
+GList* gst_autoplug_caps_list (GList *srccaps, GList *sinkcaps);
+GList* gst_autoplug_pads (GstPad *srcpad, GstPad *sinkpad);
#ifdef __cplusplus
* Boston, MA 02111-1307, USA.
*/
-#define GST_DEBUG_ENABLED
+//#define GST_DEBUG_ENABLED
#include "gst_private.h"
#include "gstcaps.h"
/**
* gst_caps_new:
+ * @name: the name of this capability
* @mime: the mime type to attach to the capability
*
* create a new capability with the given mime type
* Returns: a new capability
*/
GstCaps*
-gst_caps_new (gchar *mime)
+gst_caps_new (gchar *name, gchar *mime)
{
GstCaps *caps;
g_return_val_if_fail (mime != NULL, NULL);
caps = g_new0 (GstCaps, 1);
+ caps->name = g_strdup (name);
caps->id = get_type_for_mime (mime);
caps->properties = NULL;
/**
* gst_caps_new_with_props:
+ * @name: the name of this capability
* @mime: the mime type to attach to the capability
* @props: the properties for this capability
*
* Returns: a new capability
*/
GstCaps*
-gst_caps_new_with_props (gchar *mime, GstProps *props)
+gst_caps_new_with_props (gchar *name, gchar *mime, GstProps *props)
{
GstCaps *caps;
- caps = gst_caps_new (mime);
+ caps = gst_caps_new (name, mime);
caps->properties = props;
return caps;
GstCaps*
gst_caps_register (GstCapsFactory *factory)
{
+ guint dummy;
+
+ return gst_caps_register_count (factory, &dummy);
+}
+
+/**
+ * gst_caps_register_count:
+ * @factory: the factory to register
+ * @counter: count how many entries were consumed
+ *
+ * Register the factory.
+ *
+ * Returns: The registered capability
+ */
+GstCaps*
+gst_caps_register_count (GstCapsFactory *factory, guint *counter)
+{
GstCapsFactoryEntry tag;
gint i = 0;
guint16 typeid;
+ gchar *name;
GstCaps *caps;
-
+
g_return_val_if_fail (factory != NULL, NULL);
tag = (*factory)[i++];
+ g_return_val_if_fail (tag != NULL, NULL);
+
+ name = tag;
+ tag = (*factory)[i++];
g_return_val_if_fail (tag != NULL, NULL);
typeid = get_type_for_mime ((gchar *)tag);
caps = g_new0 (GstCaps, 1);
g_return_val_if_fail (caps != NULL, NULL);
+ caps->name = g_strdup (name);
caps->id = typeid;
- caps->properties = gst_props_register (&(*factory)[i]);
+ caps->properties = gst_props_register_count (&(*factory)[i], counter);
+
+ *counter += 2;
return caps;
}
GstProps*
gst_caps_get_props (GstCaps *caps)
{
- g_return_val_if_fail (caps != NULL, caps);
+ g_return_val_if_fail (caps != NULL, NULL);
return caps->properties;
}
}
}
+/**
+ * gst_caps_list_check_compatibility:
+ * @fromcaps: a capabilty
+ * @tocaps: a capabilty
+ *
+ * Checks whether two capability lists are compatible
+ *
+ * Returns: true if compatible, false otherwise
+ */
+gboolean
+gst_caps_list_check_compatibility (GList *fromcaps, GList *tocaps)
+{
+ while (fromcaps) {
+ GstCaps *fromcap = (GstCaps *)fromcaps->data;
+ GList *destcaps = tocaps;
+
+ while (destcaps) {
+ GstCaps *destcap = (GstCaps *)destcaps->data;
+
+ if (gst_caps_check_compatibility (fromcap, destcap))
+ return TRUE;
+
+ destcaps = g_list_next (destcaps);
+ }
+ fromcaps = g_list_next (fromcaps);
+ }
+ return FALSE;
+}
/**
* gst_caps_save_thyself:
g_return_val_if_fail (caps != NULL, NULL);
+ xmlNewChild (parent, NULL, "name", caps->name);
xmlNewChild (parent, NULL, "type", gst_type_find_by_id (caps->id)->mime);
if (caps->properties) {
subtree = xmlNewChild (parent, NULL, "properties", NULL);
xmlNodePtr field = parent->childs;
while (field) {
+ if (!strcmp (field->name, "name")) {
+ caps->name = g_strdup (xmlNodeGetContent (field));
+ }
if (!strcmp (field->name, "type")) {
caps->id = get_type_for_mime (xmlNodeGetContent (field));
}
typedef GstCapsFactoryEntry GstCapsFactory[];
struct _GstCaps {
+ gchar *name; /* the name of this caps */
+
guint16 id; /* type id (major type) */
GstProps *properties; /* properties for this capability */
};
/* initialize the subsystem */
-void _gst_caps_initialize (void);
+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_new (gchar *name, gchar *mime);
+GstCaps* gst_caps_new_with_props (gchar *name, gchar *mime, GstProps *props);
+GstCaps* gst_caps_register (GstCapsFactory *factory);
+GstCaps* gst_caps_register_count (GstCapsFactory *factory, guint *count);
-GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
-GstProps* gst_caps_get_props (GstCaps *caps);
+GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
+GstProps* gst_caps_get_props (GstCaps *caps);
-gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps);
+gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps);
+gboolean gst_caps_list_check_compatibility (GList *fromcaps, GList *tocaps);
-xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
-GstCaps* gst_caps_load_thyself (xmlNodePtr parent);
+xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
+GstCaps* gst_caps_load_thyself (xmlNodePtr parent);
#endif /* __GST_CAPS_H__ */
GstCaps *caps);
gboolean gst_elementfactory_can_sink_caps (GstElementFactory *factory,
GstCaps *caps);
+gboolean gst_elementfactory_can_src_caps_list (GstElementFactory *factory,
+ GList *caps);
+gboolean gst_elementfactory_can_sink_caps_list (GstElementFactory *factory,
+ GList *caps);
GstElement* gst_elementfactory_create (GstElementFactory *factory,
gchar *name);
}
/**
- * gst_elementfactory_can_src_caps :
+ * gst_elementfactory_can_src_caps_list :
* @factory: factory to query
- * @caps: the caps to check
+ * @caps: the caps list to check
*
- * Checks if the factory can source the given capability
+ * Checks if the factory can source the given capability list
*
- * Returns: true if it can src the capability
+ * Returns: true if it can src the capabilities
*/
gboolean
-gst_elementfactory_can_src_caps (GstElementFactory *factory,
- GstCaps *caps)
+gst_elementfactory_can_src_caps_list (GstElementFactory *factory,
+ GList *caps)
{
GList *templates;
GstPadTemplate *template = (GstPadTemplate *)templates->data;
if (template->direction == GST_PAD_SRC) {
- if (gst_caps_check_compatibility (template->caps, caps))
+ if (gst_caps_list_check_compatibility (template->caps, caps))
return TRUE;
}
templates = g_list_next (templates);
}
/**
- * gst_elementfactory_can_sink_caps :
+ * gst_elementfactory_can_sink_caps_list :
* @factory: factory to query
- * @caps: the caps to check
+ * @caps: the caps list to check
*
- * Checks if the factory can sink the given capability
+ * Checks if the factory can sink the given capability list
*
- * Returns: true if it can sink the capability
+ * Returns: true if it can sink the capabilities
*/
gboolean
-gst_elementfactory_can_sink_caps (GstElementFactory *factory,
- GstCaps *caps)
+gst_elementfactory_can_sink_caps_list (GstElementFactory *factory,
+ GList *caps)
{
GList *templates;
GstPadTemplate *template = (GstPadTemplate *)templates->data;
if (template->direction == GST_PAD_SINK) {
- if (gst_caps_check_compatibility (caps, template->caps))
+ if (gst_caps_list_check_compatibility (caps, template->caps))
return TRUE;
}
templates = g_list_next (templates);
}
/**
+ * gst_elementfactory_can_src_caps :
+ * @factory: factory to query
+ * @caps: the caps to check
+ *
+ * Checks if the factory can src the given capability
+ *
+ * Returns: true if it can sink the capability
+ */
+gboolean
+gst_elementfactory_can_src_caps (GstElementFactory *factory,
+ GstCaps *caps)
+{
+ GList *dummy;
+ gboolean ret;
+
+ dummy = g_list_prepend (NULL, caps);
+
+ ret = gst_elementfactory_can_src_caps_list (factory, dummy);
+
+ g_list_free (dummy);
+
+ return ret;
+}
+
+/**
+ * gst_elementfactory_can_sink_caps :
+ * @factory: factory to query
+ * @caps: the caps to check
+ *
+ * Checks if the factory can sink the given capability
+ *
+ * Returns: true if it can sink the capability
+ */
+gboolean
+gst_elementfactory_can_sink_caps (GstElementFactory *factory,
+ GstCaps *caps)
+{
+ GList *dummy;
+ gboolean ret;
+
+ dummy = g_list_prepend (NULL, caps);
+
+ ret = gst_elementfactory_can_sink_caps_list (factory, dummy);
+
+ g_list_free (dummy);
+
+ return ret;
+}
+
+/**
* gst_elementfactory_save_thyself:
* @factory: factory to save
* @parent: the parent xmlNodePtr
/***** INFO system *****/
GstInfoHandler _gst_info_handler = gst_default_info_handler;
-guint32 _gst_info_categories = 0xffffffff;
+//guint32 _gst_info_categories = 0xffffffff;
+guint32 _gst_info_categories = 0x00000000;
static gchar *_gst_info_category_strings[] = {
"GST_INIT",
/* chack pad compatibility */
if (srcpad->caps && sinkpad->caps) {
- if (!gst_caps_check_compatibility (srcpad->caps, sinkpad->caps))
+ if (!gst_caps_check_compatibility (srcpad->caps, sinkpad->caps)) {
g_warning ("gstpad: connecting incompatible pads (%s:%s) and (%s:%s)\n",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
- else
+ }
+ else {
DEBUG ("gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
+ }
}
- else
+ else {
DEBUG ("gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
+ }
/* first set peers */
srcpad->peer = sinkpad;
}
/**
- * gst_pad_set_caps:
+ * gst_pad_set_caps_list:
* @pad: the pad to set the caps to
- * @caps: the caps to attach to this pad
+ * @caps: the capslist to attach to this pad
*
* set the capabilities of this pad
*/
void
-gst_pad_set_caps (GstPad *pad,
- GstCaps *caps)
+gst_pad_set_caps_list (GstPad *pad,
+ GList *caps)
{
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
pad->caps = caps;
}
/**
- * gst_pad_get_caps:
+ * gst_pad_get_caps_list:
* @pad: the pad to get the capabilities from
*
* get the capabilities of this pad
*
- * Returns: the capabilities of this pad
+ * Returns: a list of capabilities of this pad
*/
-GstCaps *
-gst_pad_get_caps (GstPad *pad)
+GList *
+gst_pad_get_caps_list (GstPad *pad)
{
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
GstPadTemplate *new;
GstPadFactoryEntry tag;
gint i = 0;
+ guint counter = 0;
g_return_val_if_fail (factory != NULL, NULL);
tag = (*factory)[i++];
new->presence = GPOINTER_TO_UINT (tag);
- new->caps = gst_caps_register ((GstCapsFactory *)&(*factory)[i]);
+ tag = (*factory)[i++];
+
+ while (GPOINTER_TO_INT (tag) == 1) {
+ new->caps = g_list_append (new->caps, gst_caps_register_count ((GstCapsFactory *)&(*factory)[i], &counter));
+ i+=counter;
+ tag = (*factory)[i++];
+ }
return new;
}
* @name_template: the name template
* @direction: the direction for the template
* @presence: the presence of the pad
- * @caps: the capabilities for the template
+ * @caps: a list of capabilities for the template
*
* creates a new padtemplate from the given arguments
*
GstPadTemplate*
gst_padtemplate_create (gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
- GstCaps *caps)
+ GList *caps)
{
GstPadTemplate *new;
gst_padtemplate_save_thyself (GstPadTemplate *pad, xmlNodePtr parent)
{
xmlNodePtr subtree;
+ GList *caps;
xmlNewChild(parent,NULL,"nametemplate", pad->name_template);
xmlNewChild(parent,NULL,"direction", (pad->direction == GST_PAD_SINK? "sink":"src"));
xmlNewChild(parent,NULL,"presence", (pad->presence == GST_PAD_ALWAYS? "always":"sometimes"));
- subtree = xmlNewChild(parent,NULL,"caps", NULL);
- gst_caps_save_thyself (pad->caps, subtree);
+ caps = pad->caps;
+ while (caps) {
+ GstCaps *cap = (GstCaps *)caps->data;
+
+ subtree = xmlNewChild(parent,NULL,"caps", NULL);
+ gst_caps_save_thyself (cap, subtree);
+
+ caps = g_list_next (caps);
+ }
return parent;
}
}
}
else if (!strcmp(field->name, "caps")) {
- factory->caps = gst_caps_load_thyself (field);
+ factory->caps = g_list_append(factory->caps, gst_caps_load_thyself (field));
}
field = field->next;
}
GstObject object;
gchar *name;
- GstCaps *caps;
+ GList *caps;
cothread_state *threadstate;
gchar *name_template;
GstPadDirection direction;
GstPadPresence presence;
- GstCaps *caps;
+ GList *caps;
};
struct _GstPadTemplateClass {
/* factory */
typedef gpointer GstPadFactoryEntry;
typedef GstPadFactoryEntry GstPadFactory[];
+
#define GST_PAD_FACTORY_ALWAYS GINT_TO_POINTER(GST_PAD_ALWAYS)
#define GST_PAD_FACTORY_SOMETIMES GINT_TO_POINTER(GST_PAD_SOMETIMES)
#define GST_PAD_FACTORY_SRC GINT_TO_POINTER(GST_PAD_SRC)
#define GST_PAD_FACTORY_SINK GINT_TO_POINTER(GST_PAD_SINK)
+#define GST_PAD_FACTORY_CAPS(a...) GINT_TO_POINTER(1),##a,NULL
+
GtkType gst_pad_get_type (void);
GstPad* gst_pad_new (gchar *name, GstPadDirection direction);
void gst_pad_set_getregion_function (GstPad *pad, GstPadGetRegionFunction getregion);
void gst_pad_set_qos_function (GstPad *pad, GstPadQoSFunction qos);
-void gst_pad_set_caps (GstPad *pad, GstCaps *caps);
-GstCaps* gst_pad_get_caps (GstPad *pad);
+void gst_pad_set_caps_list (GstPad *pad, GList *caps);
+GList* gst_pad_get_caps_list (GstPad *pad);
+GstCaps* gst_pad_get_caps_by_name (GstPad *pad, gchar *name);
+gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_set_name (GstPad *pad, const gchar *name);
const gchar* gst_pad_get_name (GstPad *pad);
GstPadTemplate* gst_padtemplate_new (GstPadFactory *factory);
GstPadTemplate* gst_padtemplate_create (gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
- GstCaps *caps);
+ GList *caps);
xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *pad, xmlNodePtr parent);
GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent);
if (found) {
caps = gst_util_get_pointer_arg (GTK_OBJECT (typefind), "caps");
- gst_pad_set_caps (gst_element_get_pad (element, "src"), caps);
+ gst_pad_set_caps_list (gst_element_get_pad (element, "src"), g_list_prepend (NULL, caps));
}
gst_pad_disconnect (gst_element_get_pad (element, "src"),
if (sinkpad->direction == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad))
{
- if (gst_caps_check_compatibility (pad->caps, sinkpad->caps)) {
+ if (gst_caps_list_check_compatibility (pad->caps, sinkpad->caps)) {
gst_pad_connect(pad, sinkpad);
DEBUG("gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name,
gst_element_get_name(src));
GList **factories;
GList **base_factories;
GstElementFactory *factory;
- GList *src_pads;
GstCaps *src_caps = 0;
guint i, numsinks;
gboolean use_thread = FALSE, have_common = FALSE;
i = 0;
// fase 2, loop over all the sinks..
while (elements) {
- GList *pads;
GstPad *pad;
element = GST_ELEMENT(elements->data);
pad = (GstPad *)gst_element_get_pad_list (element)->data;
- base_factories[i] = factories[i] = gst_autoplug_caps (src_caps, pad->caps);
+ base_factories[i] = factories[i] = gst_autoplug_caps_list (g_list_append(NULL,src_caps), pad->caps);
// if we have a succesfull connection, proceed
if (factories[i] != NULL)
i++;
// FIXME connect matching pads, not just the first one...
if (sinkpad->direction == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad)) {
- GstCaps *caps = gst_pad_get_caps (sinkpad);
+ GList *caps = gst_pad_get_caps_list (sinkpad);
// the queue has the type of the elements it connects
- gst_pad_set_caps (srcpad, caps);
- gst_pad_set_caps (gst_element_get_pad(queue, "sink"), caps);
+ gst_pad_set_caps_list (srcpad, caps);
+ gst_pad_set_caps_list (gst_element_get_pad(queue, "sink"), caps);
break;
}
sinkpads = g_list_next(sinkpads);
gchar *pluginname = g_strdup (plugin->name);
INFO(GST_INFO_PLUGIN_LOADING,"loading type factory for \"%s\" from plugin %s",mime,plugin->name);
+ plugin->loaded = TRUE;
gst_plugin_remove(plugin);
if (!gst_plugin_load_absolute(filename)) {
DEBUG("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, pluginname);
* Boston, MA 02111-1307, USA.
*/
-#define GST_DEBUG_ENABLED
+//#define GST_DEBUG_ENABLED
#include "gst_private.h"
#include "gstprops.h"
GstProps *
gst_props_register (GstPropsFactory factory)
{
+ guint dummy;
+
+ return gst_props_register_count (factory, &dummy);
+}
+
+/**
+ * gst_props_register_count:
+ * @factory: the factory to register
+ * @counter: count how many fields were consumed
+ *
+ * Register the factory.
+ *
+ * Returns: The new property created from the factory
+ */
+GstProps *
+gst_props_register_count (GstPropsFactory factory, guint *counter)
+{
GstPropsFactoryEntry tag;
gint i = 0;
- GstProps *props;
+ GstProps *props = NULL;
gint skipped;
g_return_val_if_fail (factory != NULL, NULL);
tag = factory[i++];
- if (!tag) return NULL;
+ if (!tag) goto end;
props = g_new0 (GstProps, 1);
g_return_val_if_fail (props != NULL, NULL);
GQuark quark;
GstPropsEntry *entry;
+ if (tag < GST_PROPS_LAST_ID) {
+ g_warning ("properties seem to be wrong\n");
+ return NULL;
+ }
+
quark = g_quark_from_string ((gchar *)tag);
tag = factory[i];
tag = factory[i++];
}
+end:
+ *counter = i;
+
return props;
}
GST_PROPS_INT_RANGE_ID_NUM,
GST_PROPS_FOURCC_ID_NUM,
GST_PROPS_BOOL_ID_NUM,
+ GST_PROPS_LAST_ID_NUM = GST_PROPS_END_ID_NUM + 16,
} GstPropsId;
#define GST_PROPS_END_ID GINT_TO_POINTER(GST_PROPS_END_ID_NUM)
#define GST_PROPS_INT_RANGE_ID GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM)
#define GST_PROPS_FOURCC_ID GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM)
#define GST_PROPS_BOOL_ID GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM)
+#define GST_PROPS_LAST_ID GINT_TO_POINTER(GST_PROPS_LAST_ID_NUM)
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_ID,##a,NULL
#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(GINT_TO_POINTER(a))
void _gst_props_initialize (void);
GstProps* gst_props_register (GstPropsFactory factory);
+GstProps* gst_props_register_count (GstPropsFactory factory, guint *counter);
GstProps* gst_props_new (GstPropsFactoryEntry entry, ...);
"sink",
GST_PAD_FACTORY_SINK,
GST_PAD_FACTORY_ALWAYS,
- "audio/raw",
- "format", GST_PROPS_INT (AFMT_S16_LE),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
+ GST_PAD_FACTORY_CAPS (
+ "audiosink_sink",
+ "audio/raw",
+ "format", GST_PROPS_INT (AFMT_S16_LE),
+ "depth", GST_PROPS_LIST (
+ GST_PROPS_INT (8),
GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
+ ),
+ "rate", GST_PROPS_INT_RANGE (8000, 48000),
+ "channels", GST_PROPS_INT_RANGE (1, 2)
+ ),
NULL
};
-noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip mp3encode autoplug props case4
+noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip mp3encode autoplug props case4 padfactory
LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la
CFLAGS = -Wall
{
GstCaps *caps1, *caps2;
- caps1 = gst_caps_new (mime1);
- caps2 = gst_caps_new (mime2);
+ caps1 = gst_caps_new ("tescaps1", mime1);
+ caps2 = gst_caps_new ("tescaps2", mime2);
return gst_autoplug_caps (caps1, caps2);
}
factories = gst_autoplug_caps (
gst_caps_new_with_props(
+ "testcaps3",
"video/mpeg",
gst_props_new (
"mpegversion", GST_PROPS_INT (1),
"systemstream", GST_PROPS_BOOLEAN (TRUE),
NULL)),
- gst_caps_new("audio/raw"));
+ gst_caps_new("testcaps4","audio/raw"));
dump_factories (factories);
factories = gst_autoplug_caps (
gst_caps_new_with_props(
+ "testcaps5",
"video/mpeg",
gst_props_new (
"mpegversion", GST_PROPS_INT (1),
"systemstream", GST_PROPS_BOOLEAN (FALSE),
NULL)),
- gst_caps_new("video/raw"));
+ gst_caps_new("testcaps6", "video/raw"));
dump_factories (factories);
+
+ exit (0);
}
#include <gst/gst.h>
-static GstTypeFactory mpegfactory = {
- "video/mpeg", // major type
- ".mpg .mpeg", // extenstions
- NULL, // typefind function
-};
-
static GstCapsFactory mpeg2dec_sink_caps = {
+ "mpeg2dec_sink",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT(1),
};
static GstCapsFactory mp1parse_src_caps = {
+ "mp1parse_src",
"video/mpeg",
"mpegtype", GST_PROPS_LIST (
GST_PROPS_INT(1)
};
static GstCapsFactory mpeg2dec_src_caps = {
+ "mpeg2dec_src",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC ('Y','V','1','2'),
};
static GstCapsFactory raw_sink_caps = {
+ "raw_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC_INT (0x32315659)
};
static GstCapsFactory raw2_sink_caps = {
+ "raw2_sink_caps",
"video/raw",
"fourcc", GST_PROPS_LIST (
GST_PROPS_FOURCC_INT (0x32315659),
*rawcaps = NULL,
*rawcaps2 = NULL,
*rawcaps3 = NULL,
- *sinkcapslist = NULL,
*mp1parsecaps = NULL;
int main(int argc,char *argv[])
int main(int argc,char *argv[]) {
GstBin *thread;
GstElement *src,*identity,*sink;
- int i;
DEBUG_ENTER("(%d)",argc);
gst_bin_iterate(thread);
gst_bin_iterate(thread);
+
+ exit(0);
}
int main(int argc,char *argv[]) {
gst_init(&argc,&argv);
+
+ exit (0);
}
static gboolean playing;
/* eos will be called when the src element has an end of stream */
-void eos(GstSrc *src)
+void eos(GstElement *src)
{
g_print("have eos, quitting\n");
// thr1 = gst_bin_new("thr1");
g_return_val_if_fail(2,thr1 != NULL);
// thr2 = GST_BIN(gst_thread_new("thr2"));
- thr2 = gst_bin_new("thr2");
+ thr2 = GST_BIN(gst_bin_new("thr2"));
g_return_val_if_fail(3,thr2 != NULL);
fprintf(stderr,"QUEUE: fakesrc\n");
src = gst_elementfactory_make("fakesrc","src");
gst_bin_add(pipeline,GST_ELEMENT(queue));
gst_bin_add(pipeline,GST_ELEMENT(thr2));
fprintf(stderr,"QUEUE: connecting elements\n");
- gst_element_connect(thr1,"src",queue,"sink");
- gst_element_connect(queue,"src",thr2,"sink");
+ gst_element_connect(GST_ELEMENT(thr1),"src",queue,"sink");
+ gst_element_connect(queue,"src",GST_ELEMENT(thr2),"sink");
// gst_pad_connect(gst_element_get_pad(src,"src"),gst_element_get_pad(queue,"sink"));
// gst_pad_connect(gst_element_get_pad(queue,"src"),gst_element_get_pad(sink,"sink"));
fprintf(stderr,"QUEUE: constructed outer pipeline\n");
// fflush(stdout);
// fflush(stderr);
// gst_bin_iterate(thr2);
+//
+ exit (0);
}
#include <assert.h>
int main(int argc,char *argv[]) {
- GstPipeline *pipeline;
+ GstElement *pipeline;
GstElement *src,*identity,*sink;
int i;
fprintf(stderr,"\n");
gst_bin_iterate(GST_BIN(pipeline));
}
+
+ exit (0);
}
g_print(">STATES: element '%s' state set to %d(%s)\n",
gst_element_get_name(element),state,_gst_print_statename(state));
g_print(">STATES: element state is actually %d\n",GST_STATE(element));
+
+ return TRUE;
}
int main(int argc,char *argv[]) {
gst_element_set_state (bin, GST_STATE_PLAYING);
gst_bin_iterate (GST_BIN (bin));
+
+ exit (0);
}