use contents of GST_REGISTRY variable if --gst-registry is not set

Original commit message from CVS:
use contents of GST_REGISTRY variable if --gst-registry is not set
This commit is contained in:
Andy Wingo 2002-05-05 17:45:41 +00:00
parent d7f4c306cd
commit 2b12a668da
6 changed files with 65 additions and 45 deletions

View file

@ -39,6 +39,7 @@ enum {
PAD_REMOVED,
ERROR,
EOS,
DEEP_NOTIFY,
LAST_SIGNAL
};
@ -57,6 +58,7 @@ static void gst_element_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void gst_element_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *pspec);
static void gst_element_dispatch_properties_changed (GObject * object, guint n_pspecs, GParamSpec **pspecs);
static void gst_element_dispose (GObject *object);
@ -129,11 +131,21 @@ gst_element_class_init (GstElementClass *klass)
g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstElementClass,eos), NULL, NULL,
gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
gst_element_signals[DEEP_NOTIFY] =
g_signal_new ("deep_notify", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (GstElementClass, deep_notify), NULL, NULL,
gst_marshal_VOID__OBJECT_PARAM, G_TYPE_NONE,
2, G_TYPE_OBJECT, G_TYPE_PARAM);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_element_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_element_get_property);
/* see the comments at gst_element_dispatch_properties_changed */
gobject_class->dispatch_properties_changed
= GST_DEBUG_FUNCPTR (gst_element_dispatch_properties_changed);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_element_dispose);
#ifndef GST_DISABLE_LOADSAVE
@ -193,6 +205,38 @@ gst_element_get_property (GObject *object, guint prop_id, GValue *value, GParamS
(oclass->get_property) (object, prop_id, value, pspec);
}
/* Changing a GObject property of an element will result in "deep_notify"
* signals being emitted by the element itself, as well as in each parent
* element. This is so that an application can connect a listener to the
* top-level bin to catch property-change notifications for all contained
* elements. */
static void
gst_element_dispatch_properties_changed (GObject *object,
guint n_pspecs,
GParamSpec **pspecs)
{
GstObject *gst_object;
guint i;
/* do the standard dispatching */
G_OBJECT_CLASS (parent_class)->dispatch_properties_changed (object, n_pspecs, pspecs);
/* now let the parent dispatch those, too */
gst_object = GST_OBJECT (object);
while (gst_object)
{
/* need own category? */
for (i = 0; i < n_pspecs; i++) {
GST_DEBUG (GST_CAT_EVENT, "deep notification from %s to %s (%s)", GST_OBJECT_NAME (object),
GST_OBJECT_NAME (gst_object), pspecs[i]->name);
g_signal_emit (gst_object, gst_element_signals[DEEP_NOTIFY], g_quark_from_string (pspecs[i]->name),
(GstObject *) object, pspecs[i]);
}
gst_object = GST_OBJECT_PARENT (gst_object);
}
}
static GstPad*
gst_element_request_pad (GstElement *element, GstPadTemplate *templ, const gchar* name)
{
@ -1331,7 +1375,7 @@ gst_element_set_state (GstElement *element, GstElementState state)
if (curpending != state) {
GST_DEBUG_ELEMENT (GST_CAT_STATES, element,
"intermediate: setting state from %s to %s",
gst_element_state_get_name (state),
gst_element_state_get_name (GST_STATE (element)),
gst_element_state_get_name (curpending));
}

View file

@ -160,6 +160,7 @@ struct _GstElementClass {
void (*pad_removed) (GstElement *element, GstPad *pad);
void (*error) (GstElement *element, GstElement *source, gchar *error);
void (*eos) (GstElement *element);
void (*deep_notify) (GstObject *object, GstObject *orig, GParamSpec *pspec);
/* local pointers for get/set */
void (*set_property) (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);

View file

@ -27,7 +27,6 @@
/* Object signals and args */
enum {
PARENT_SET,
DEEP_NOTIFY,
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
OBJECT_SAVED,
#endif
@ -65,7 +64,6 @@ static void gst_object_set_property (GObject * object, guint prop_id, const G
GParamSpec * pspec);
static void gst_object_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec);
static void gst_object_dispatch_properties_changed (GObject * object, guint n_pspecs, GParamSpec **pspecs);
static void gst_object_dispose (GObject *object);
static void gst_object_finalize (GObject *object);
@ -110,10 +108,6 @@ gst_object_class_init (GstObjectClass *klass)
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_object_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_object_get_property);
/* CR1: we override the signal property so that an object can propagate the
* signal to the parent object */
gobject_class->dispatch_properties_changed = GST_DEBUG_FUNCPTR (gst_object_dispatch_properties_changed);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME,
g_param_spec_string ("name", "Name", "The name of the object",
NULL, G_PARAM_READWRITE));
@ -123,12 +117,6 @@ gst_object_class_init (GstObjectClass *klass)
G_STRUCT_OFFSET (GstObjectClass, parent_set), NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
G_TYPE_OBJECT);
gst_object_signals[DEEP_NOTIFY] =
g_signal_new ("deep_notify", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (GstObjectClass, deep_notify), NULL, NULL,
gst_marshal_VOID__OBJECT_PARAM, G_TYPE_NONE,
2, G_TYPE_OBJECT, G_TYPE_PARAM);
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
gst_object_signals[OBJECT_SAVED] =
g_signal_new ("object_saved", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
@ -620,36 +608,6 @@ gst_object_get_property (GObject* object, guint prop_id,
}
}
/* CR1: the GObject changing a property emits signals to it's parents
* so that the app can connect a listener to the top-level bin */
static void
gst_object_dispatch_properties_changed (GObject *object,
guint n_pspecs,
GParamSpec **pspecs)
{
GstObject *gst_object;
guint i;
/* do the standard dispatching */
parent_class->dispatch_properties_changed (object, n_pspecs, pspecs);
/* now let the parent dispatch those, too */
gst_object = GST_OBJECT (object);
while (gst_object)
{
/* need own category? */
for (i = 0; i < n_pspecs; i++) {
GST_DEBUG (GST_CAT_EVENT, "deep notification from %s to %s (%s)", GST_OBJECT_NAME (object),
GST_OBJECT_NAME (gst_object), pspecs[i]->name);
g_signal_emit (gst_object, gst_object_signals[DEEP_NOTIFY], g_quark_from_string (pspecs[i]->name),
(GstObject *) object, pspecs[i]);
}
gst_object = GST_OBJECT_PARENT (gst_object);
}
}
/**
* gst_object_get_path_string:
* @object: GstObject to get the path from

View file

@ -99,7 +99,6 @@ struct _GstObjectClass {
/* signals */
void (*parent_set) (GstObject *object, GstObject *parent);
void (*deep_notify) (GstObject *object, GstObject *orig, GParamSpec *pspec);
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
void (*object_saved) (GstObject *object, xmlNodePtr parent);
#endif

View file

@ -87,6 +87,12 @@ gst_registry_write_get ()
/* we cannot use the temp dir since the move needs to be on same device */
gst_reg->tmp_file = g_strdup_printf ("%s.tmp", gst_registry_option);
}
else if (g_getenv ("GST_REGISTRY"))
{
gst_reg->dir = NULL;
gst_reg->file = g_strdup (g_getenv ("GST_REGISTRY"));
gst_reg->tmp_file = g_strdup_printf ("%s.tmp", g_getenv ("GST_REGISTRY"));
}
else
{
if (gst_registry_use_global ())
@ -119,6 +125,11 @@ gst_registry_read_get ()
/* FIXME: maybe parse the dir from file ? */
gst_reg->local_reg = NULL;
gst_reg->global_reg = gst_registry_option;
}
else if (g_getenv ("GST_REGISTRY"))
{
gst_reg->local_reg = NULL;
gst_reg->global_reg = g_strdup (g_getenv ("GST_REGISTRY"));
}
else
{

View file

@ -166,5 +166,12 @@ graph_t * _gst_parse_launch (const gchar *str, GError **error)
g_free (dstr);
/* if the toplevel only contains one bin, make that bin top-level */
if (g->elements == NULL && g->bins && g->bins->next == NULL) {
g = (graph_t*)g->bins->data;
g_free (g->parent);
g->parent = NULL;
}
return g;
}