gst_spider_identity_chain (GstPad *pad, GstBuffer *buf)
{
GstSpiderIdentity *ident;
- GstPad *peerpad;
/* g_print ("chaining on pad %s:%s with buffer %p\n", GST_DEBUG_PAD_NAME (pad), buf); */
list = g_list_next (list);
if (conn->sink == ident && (GstElement *) conn->src != conn->current)
{
- gst_element_set_eos (conn->src);
+ gst_element_set_eos (GST_ELEMENT (conn->src));
gst_pad_push (conn->src->src, gst_event_new (GST_EVENT_EOS));
}
}
{
GLogLevelFlags llf;
gboolean showhelp = FALSE;
+ const gchar *plugin_path;
#ifndef GST_DISABLE_TRACE
GstTrace *gst_trace;
#endif
#ifndef GST_DISABLE_AUTOPLUG
gst_autoplugfactory_get_type ();
#endif
-
- /* check for ENV variables */
- {
- const gchar *plugin_path = g_getenv("GST_PLUGIN_PATH");
- split_and_iterate (plugin_path, G_SEARCHPATH_SEPARATOR_S, add_path_func);
- }
-
+
+ plugin_path = g_getenv("GST_PLUGIN_PATH");
+ split_and_iterate (plugin_path, G_SEARCHPATH_SEPARATOR_S, add_path_func);
+
_gst_cpu_initialize ();
_gst_props_initialize ();
_gst_caps_initialize ();
gst_bin_distribute_clocks (GstBin *bin)
{
GList *needing = NULL, *providing = NULL;
- GstElement *provider;
GstClock *clock;
gst_bin_get_clock_elements (bin, &needing, &providing);
{
GstBinClass *oclass;
- GST_DEBUG (GST_CAT_STATES, "gst_bin_set_state_type(\"%s\",%d,%d)\n",
- GST_ELEMENT_NAME (bin), state, type);
+ GST_DEBUG (GST_CAT_STATES, "gst_bin_set_state_type(\"%s\",%d,%s)\n",
+ GST_ELEMENT_NAME (bin), state, G_OBJECT_TYPE_NAME (type));
g_return_val_if_fail (bin != NULL, FALSE);
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
{
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
- g_return_if_fail (name != NULL);
gst_object_set_name (GST_OBJECT (element), name);
}
void
gst_element_set_clock (GstElement *element, GstClock *clock)
{
- GstElementClass *oclass;
-
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
{
GList *pads;
GstPadTemplate *templ;
- GstCaps *intersection, *templcaps;
+ GstCaps *templcaps;
GstPad *foundpad = NULL;
/* checks */
/**
* gst_element_disconnect_elements:
- * @src: element 1
- * @dest: element 2
+ * @src: source element
+ * @dest: sink element
*
- * Disconnect all pads connecting the two elements.
+ * Disconnect all pads connecting the two elements in the direction src -> dest.
*/
void
gst_element_disconnect_elements (GstElement *src, GstElement *dest)
{
- GstPad *src, *dst;
- GList *srcpads, *destpads, *l;
+ GList *srcpads;
+ GstPad *pad;
g_return_if_fail (GST_IS_ELEMENT(src));
g_return_if_fail (GST_IS_ELEMENT(dest));
- /* loop through the existing pads in the source */
srcpads = gst_element_get_pad_list (src);
- destpads = gst_element_get_pad_list (dest);
- for (; srcpads; srcpads=srcpads->next)
- for (l=destpads; l; l=l->next)
- if (GST_PAD_PEER ((GstPad*) srcpads->data) == (GstPad*) l->data)
- gst_pad_disconnect ((GstPad*) srcpads->data, (GstPad*) l->data);
+ while (srcpads) {
+ pad = GST_PAD (srcpads->data);
+
+ if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC)
+ if (GST_OBJECT_PARENT (GST_PAD_PEER (pad)) == (GstObject*) dest)
+ gst_pad_disconnect (pad, GST_PAD_PEER (pad));
+
+ srcpads = g_list_next (srcpads);
+ }
}
static void
gst_element_dispose (GObject *object)
{
GstElement *element = GST_ELEMENT (object);
- GList *pads, *test;
+ GList *pads;
GstPad *pad;
- gint i;
GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "dispose\n");
gint nspecs, i;
GValue value = { 0, };
GstElement *element;
- gchar *str;
g_return_val_if_fail (GST_IS_ELEMENT (object), parent);
if (!factory->type)
factory->type = type;
else if (factory->type != type)
-/* FIXME: g_critical is glib-2.0, not glib-1.2
g_critical ("`%s' requested type change (!)", name);
-*/
- g_warning ("`%s' requested type change (!)", name);
+
gst_object_set_name (GST_OBJECT (factory), name);
return factory;
GstElementClass *oclass;
g_return_val_if_fail(factory != NULL, NULL);
- g_return_val_if_fail(name != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"creating element from factory \"%s\" with name \"%s\" and type %d\n",
GST_OBJECT_NAME (factory), name, factory->type);
return NULL;
if (factory->type == 0) {
-/* FIXME: g_critical is glib-2.0, not glib-1.2
g_critical ("Factory for `%s' has no type",
-*/
- g_warning ("Factory for `%s' has no type",
gst_object_get_name (GST_OBJECT (factory)));
return NULL;
}
GstElement *element;
g_return_val_if_fail (factoryname != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY, "gstelementfactory: make \"%s\" \"%s\"\n", factoryname, name);
};
GType _gst_object_type = 0;
+static GHashTable *object_name_counts = NULL;
+G_LOCK_DEFINE_STATIC (object_name_mutex);
typedef struct _GstSignalObject GstSignalObject;
typedef struct _GstSignalObjectClass GstSignalObjectClass;
parent_class->finalize (object);
}
+static void
+gst_object_set_name_default (GstObject *object)
+{
+ gint count;
+ gchar *name;
+ const gchar *type_name, *subname;
+
+ type_name = G_OBJECT_TYPE_NAME (object);
+
+ G_LOCK (object_name_mutex);
+
+ if (!object_name_counts)
+ object_name_counts = g_hash_table_new (g_str_hash, g_str_equal);
+
+ count = GPOINTER_TO_INT (g_hash_table_lookup (object_name_counts, type_name));
+ g_hash_table_insert (object_name_counts, g_strdup (type_name), GINT_TO_POINTER (++count));
+
+ G_UNLOCK (object_name_mutex);
+
+ /* GstFooSink -> sinkN */
+ subname = type_name + strlen (type_name) - 1;
+ while (g_ascii_islower (*subname) && subname > type_name)
+ subname--;
+ name = g_strdup_printf ("%s%d", subname, count);
+ *name = g_ascii_tolower (*name);
+
+ gst_object_set_name (object, name);
+ g_free (name);
+}
+
/**
* gst_object_set_name:
* @object: GstObject to set the name of
{
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
- g_return_if_fail (name != NULL);
if (object->name != NULL)
g_free (object->name);
- object->name = g_strdup (name);
+ if (name != NULL)
+ object->name = g_strdup (name);
+ else
+ gst_object_set_name_default (object);
}
/**
static void
gst_object_real_restore_thyself (GstObject *object, xmlNodePtr self)
{
- GstObjectClass *oclass;
-
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
g_return_if_fail (self != NULL);
#define GST_PAD_REALIZE(pad) (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))
#define GST_PAD_DIRECTION(pad) GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad))
#define GST_PAD_CAPS(pad) GST_RPAD_CAPS(GST_PAD_REALIZE(pad))
-#define GST_PAD_PEER(pad) GST_RPAD_PEER(GST_PAD_REALIZE(pad))
+#define GST_PAD_PEER(pad) GST_PAD_CAST(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))
/* Some check functions (unused?) */
#define GST_PAD_IS_CONNECTED(pad) (GST_PAD_PEER(pad) != NULL)
guint bincount;
guint threadcount;
gint binlevel;
- GHashTable *elementcounts;
gboolean verbose;
gboolean debug;
};
}
}
-static gchar *
-gst_parse_unique_name (const gchar * type, gst_parse_priv * priv)
-{
- gpointer tmp;
- gint count;
-
- tmp = g_hash_table_lookup (priv->elementcounts, type);
- count = GPOINTER_TO_INT (tmp);
- count++;
- g_hash_table_insert (priv->elementcounts, g_strdup (type), GINT_TO_POINTER (count));
-
- return g_strdup_printf ("%s%d", type, count - 1);
-}
-
static gint
gst_parse_launchv_recurse (const gchar **argv, GstBin * parent, gst_parse_priv * priv)
{
if (!priv) {
priv = g_new0 (gst_parse_priv, 1);
- priv->elementcounts = g_hash_table_new (g_str_hash, g_str_equal);
}
priv->binlevel++;
if (arg[0] == '(') {
/* create a bin and add it to the current parent */
- element = gst_bin_new (g_strdup_printf ("bin%d", priv->bincount++));
+ priv->bincount++;
+ element = gst_elementfactory_make ("bin", NULL);
if (!element) {
fprintf (stderr, "Couldn't create a bin!\n");
return GST_PARSE_ERROR_CREATING_ELEMENT;
GST_DEBUG (0, "CREATED bin %s\n", GST_ELEMENT_NAME (element));
} else if (arg[0] == '{') {
/* create a thread and add it to the current parent */
- element = gst_thread_new (g_strdup_printf ("thread%d", priv->threadcount++));
+ priv->threadcount++;
+ element = gst_elementfactory_make ("thread", NULL);
if (!element) {
fprintf (stderr, "Couldn't create a thread!\n");
return GST_PARSE_ERROR_CREATING_ELEMENT;
/* we have an element */
DEBUG ("attempting to create element '%s'\n", arg);
- ptr = gst_parse_unique_name (arg, priv);
- element = gst_elementfactory_make (arg, ptr);
- g_free (ptr);
+ element = gst_elementfactory_make (arg, NULL);
if (!element) {
#ifndef GST_DISABLE_REGISTRY
fprintf (stderr,
struct stat stat_buf;
#ifndef GST_DISABLE_REGISTRY
xmlDocPtr doc = NULL;
- xmlNodePtr root;
#endif
main_module = g_module_open (NULL, G_MODULE_BIND_LAZY);
return NULL;
}
-static GstPluginFeature*
+G_GNUC_UNUSED static GstPluginFeature*
gst_plugin_find_feature (const gchar *name, GType type)
{
GList *plugins;
static void
gst_props_debug_entry (GstPropsEntry *entry)
{
- gchar *name = g_quark_to_string (entry->propid);
+ const gchar *name = g_quark_to_string (entry->propid);
switch (entry->propstype) {
case GST_PROPS_INT_ID:
gst_props_copy (GstProps *props)
{
GstProps *new;
- GList *properties;
if (props == NULL)
return NULL;
case GST_PROPS_INT_RANGE_ID:
return (entry2->data.int_range_data.min <= entry1->data.int_range_data.min &&
entry2->data.int_range_data.max >= entry1->data.int_range_data.max);
+ default:
}
break;
case GST_PROPS_FLOAT_RANGE_ID:
case GST_PROPS_FLOAT_RANGE_ID:
return (entry2->data.float_range_data.min <= entry1->data.float_range_data.min &&
entry2->data.float_range_data.max >= entry1->data.float_range_data.max);
+ default:
}
break;
case GST_PROPS_FOURCC_ID:
/* b <---> a */
case GST_PROPS_FOURCC_ID:
GST_DEBUG(GST_CAT_PROPERTIES,"\"%4.4s\" <--> \"%4.4s\" ?\n",
- &entry2->data.fourcc_data, &entry1->data.fourcc_data);
+ (char*) &entry2->data.fourcc_data, (char*) &entry1->data.fourcc_data);
return (entry2->data.fourcc_data == entry1->data.fourcc_data);
+ default:
}
break;
case GST_PROPS_INT_ID:
case GST_PROPS_INT_ID:
GST_DEBUG(GST_CAT_PROPERTIES,"%d == %d ?\n",entry1->data.int_data,entry2->data.int_data);
return (entry2->data.int_data == entry1->data.int_data);
+ default:
}
break;
case GST_PROPS_FLOAT_ID:
/* b <---> a */
case GST_PROPS_FLOAT_ID:
return (entry2->data.float_data == entry1->data.float_data);
+ default:
}
break;
case GST_PROPS_BOOL_ID:
/* t <---> t */
case GST_PROPS_BOOL_ID:
return (entry2->data.bool_data == entry1->data.bool_data);
+ default:
}
case GST_PROPS_STRING_ID:
switch (entry2->propstype) {
GST_DEBUG(GST_CAT_PROPERTIES,"\"%s\" <--> \"%s\" ?\n",
entry2->data.string_data.string, entry1->data.string_data.string);
return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string));
+ default:
}
+ default:
}
return FALSE;
entry1 = entry2;
entry2 = temp;
}
+ default:
}
switch (entry1->propstype) {
entry1->data.int_range_data.max >= entry2->data.int_data) {
result = gst_props_entry_copy (entry2);
}
+ default:
}
break;
case GST_PROPS_FLOAT_RANGE_ID:
entry1->data.float_range_data.max >= entry2->data.float_data) {
result = gst_props_entry_copy (entry2);
}
+ default:
}
break;
case GST_PROPS_FOURCC_ID:
case GST_PROPS_FOURCC_ID:
if (entry1->data.fourcc_data == entry2->data.fourcc_data)
result = gst_props_entry_copy (entry1);
+ default:
}
break;
case GST_PROPS_INT_ID:
case GST_PROPS_INT_ID:
if (entry1->data.int_data == entry2->data.int_data)
result = gst_props_entry_copy (entry1);
+ default:
}
break;
case GST_PROPS_FLOAT_ID:
case GST_PROPS_FLOAT_ID:
if (entry1->data.float_data == entry2->data.float_data)
result = gst_props_entry_copy (entry1);
+ default:
}
break;
case GST_PROPS_BOOL_ID:
case GST_PROPS_BOOL_ID:
if (entry1->data.bool_data == entry2->data.bool_data)
result = gst_props_entry_copy (entry1);
+ default:
}
case GST_PROPS_STRING_ID:
switch (entry2->propstype) {
case GST_PROPS_STRING_ID:
if (!strcmp (entry1->data.string_data.string, entry2->data.string_data.string))
result = gst_props_entry_copy (entry1);
+ default:
}
+ default:
}
return result;