mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
initial checkin for the deep_notify signal which replaces INFO events in the long run.
Original commit message from CVS: initial checkin for the deep_notify signal which replaces INFO events in the long run. PLEASE do not use gst_element_[info,message,error] anymore. Use g_object_notify instead. Thank you.
This commit is contained in:
parent
7ec0610594
commit
5efa475181
8 changed files with 103 additions and 7 deletions
|
@ -247,21 +247,28 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
|
|||
} else {
|
||||
src->filename = g_strdup (g_value_get_string (value));
|
||||
}
|
||||
g_object_notify (G_OBJECT (src), "location");
|
||||
break;
|
||||
case ARG_BLOCKSIZE:
|
||||
src->block_size = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "blocksize");
|
||||
break;
|
||||
case ARG_OFFSET:
|
||||
src->curoffset = g_value_get_int64 (value);
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
break;
|
||||
case ARG_MAPSIZE:
|
||||
if ((src->mapsize % src->pagesize) == 0)
|
||||
{
|
||||
src->mapsize = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "mmapsize");
|
||||
}
|
||||
else
|
||||
GST_INFO(0, "invalid mapsize, must a multiple of pagesize, which is %d\n",src->pagesize);
|
||||
break;
|
||||
case ARG_TOUCH:
|
||||
src->touch = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (src), "touch");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -542,6 +549,7 @@ gst_filesrc_get (GstPad *pad)
|
|||
|
||||
/* we're done, return the buffer */
|
||||
src->curoffset += GST_BUFFER_SIZE(buf);
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -579,6 +587,12 @@ gst_filesrc_open_file (GstFileSrc *src)
|
|||
|
||||
src->curoffset = 0;
|
||||
|
||||
/* now notify of the changes */
|
||||
g_object_freeze_notify (G_OBJECT (src));
|
||||
g_object_notify (G_OBJECT (src), "filesize");
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
g_object_thaw_notify (G_OBJECT (src));
|
||||
|
||||
GST_FLAG_SET (src, GST_FILESRC_OPEN);
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -597,6 +611,12 @@ gst_filesrc_close_file (GstFileSrc *src)
|
|||
src->fd = 0;
|
||||
src->filelen = 0;
|
||||
src->curoffset = 0;
|
||||
/* and notify that things changed */
|
||||
g_object_freeze_notify (G_OBJECT (src));
|
||||
g_object_notify (G_OBJECT (src), "filesize");
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
g_object_thaw_notify (G_OBJECT (src));
|
||||
|
||||
if (src->mapbuf)
|
||||
gst_buffer_unref (src->mapbuf);
|
||||
|
||||
|
@ -654,6 +674,7 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
|
|||
return FALSE;
|
||||
break;
|
||||
}
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
src->seek_happened = TRUE;
|
||||
src->need_flush = GST_EVENT_SEEK_FLUSH(event);
|
||||
gst_event_free (event);
|
||||
|
|
|
@ -422,15 +422,17 @@ gst_md5sink_change_state (GstElement *element)
|
|||
|
||||
/* element check */
|
||||
sink = GST_MD5SINK (element);
|
||||
g_return_val_if_fail (sink != NULL, GST_PAD_CONNECT_REFUSED);
|
||||
g_return_val_if_fail (GST_IS_MD5SINK (sink), GST_PAD_CONNECT_REFUSED);
|
||||
|
||||
g_return_val_if_fail (GST_IS_MD5SINK (sink), GST_STATE_FAILURE);
|
||||
|
||||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
md5_init_ctx (sink);
|
||||
g_object_notify (G_OBJECT (element), "md5");
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
md5_finish_ctx (sink, sink->md5);
|
||||
g_object_notify (G_OBJECT (element), "md5");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -454,7 +456,8 @@ gst_md5sink_get_property (GObject *object, guint prop_id, GValue *value, GParamS
|
|||
|
||||
switch (prop_id) {
|
||||
case ARG_MD5:
|
||||
md5_read_ctx (sink, sink->md5);
|
||||
/* you could actually get a value for the current md5. This is currently disabled.
|
||||
* md5_read_ctx (sink, sink->md5); */
|
||||
g_value_set_pointer (value, sink->md5);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -42,6 +42,11 @@ typedef struct _GObjectClass GObjectClass;
|
|||
#define g_object_ref(obj) gtk_object_ref((GtkObject *)(obj))
|
||||
#define g_object_unref(obj) gtk_object_unref((GtkObject *)(obj))
|
||||
|
||||
/* notification - just disable it */
|
||||
#define g_object_freeze_notify(obj)
|
||||
#define g_object_notify(obj,name)
|
||||
#define g_object_thaw_notify(obj)
|
||||
|
||||
/* the helper macros for type checking */
|
||||
#define G_TYPE_CHECK_INSTANCE_CAST GTK_CHECK_CAST
|
||||
#define G_TYPE_CHECK_INSTANCE_TYPE GTK_CHECK_TYPE
|
||||
|
@ -70,7 +75,7 @@ typedef struct _GObjectClass GObjectClass;
|
|||
#define G_TYPE_STRING GTK_TYPE_STRING
|
||||
#define G_TYPE_POINTER GTK_TYPE_POINTER
|
||||
#define G_TYPE_BOXED GTK_TYPE_BOXED
|
||||
#define G_TYPE_PARAM GTK_TYPE_PARAM
|
||||
#define G_TYPE_PARAM GTK_TYPE_POINTER
|
||||
|
||||
/* marshallers */
|
||||
#define g_cclosure_marshal_VOID__VOID gtk_marshal_NONE__NONE
|
||||
|
@ -100,6 +105,7 @@ typedef struct _GObjectClass GObjectClass;
|
|||
#define gst_marshal_VOID__STRING gtk_marshal_NONE__STRING
|
||||
#define gst_marshal_VOID__POINTER gtk_marshal_NONE__POINTER
|
||||
#define gst_marshal_VOID__OBJECT gtk_marshal_NONE__POINTER
|
||||
#define gst_marshal_VOID__OBJECT_PARAM gtk_marshal_NONE__POINTER_POINTER
|
||||
#define gst_marshal_VOID__OBJECT_POINTER gtk_marshal_NONE__POINTER_POINTER
|
||||
#define gst_marshal_VOID__INT_INT gtk_marshal_NONE__INT_INT
|
||||
|
||||
|
@ -197,6 +203,7 @@ void g2g_object_run_dispose (GObject *object);
|
|||
#define G_SIGNAL_RUN_CLEANUP 0
|
||||
#define G_SIGNAL_NO_RECURSE GTK_RUN_NO_RECURSE
|
||||
#define G_SIGNAL_NO_HOOKS GTK_RUN_NO_HOOKS
|
||||
#define G_SIGNAL_DETAILED 0
|
||||
|
||||
#define GCallback gpointer /* FIXME?*/
|
||||
#define G_CALLBACK(f) ((gpointer)(f))
|
||||
|
@ -431,6 +438,10 @@ struct _GObjectClass {
|
|||
const GValue *value, GParamSpec *pspec);
|
||||
void (*get_property) (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
void (*dispatch_properties_changed) (GObject *object, guint n_pspecs,
|
||||
GParamSpec **pspecs);
|
||||
|
||||
};
|
||||
|
||||
GType g_object_get_type (void);
|
||||
|
|
|
@ -4,5 +4,6 @@ VOID:INT
|
|||
VOID:STRING
|
||||
VOID:POINTER
|
||||
VOID:OBJECT
|
||||
VOID:OBJECT,PARAM
|
||||
VOID:OBJECT,POINTER
|
||||
VOID:INT,INT
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
/* Object signals and args */
|
||||
enum {
|
||||
PARENT_SET,
|
||||
DEEP_NOTIFY,
|
||||
#ifndef GST_DISABLE_LOADSAVE_REGISTRY
|
||||
OBJECT_SAVED,
|
||||
#endif
|
||||
|
@ -62,6 +63,7 @@ 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);
|
||||
|
@ -105,6 +107,7 @@ 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);
|
||||
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",
|
||||
|
@ -115,6 +118,12 @@ 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,
|
||||
|
@ -574,6 +583,32 @@ gst_object_get_property (GObject* object, guint prop_id,
|
|||
break;
|
||||
}
|
||||
}
|
||||
static void
|
||||
gst_object_dispatch_properties_changed (GObject *object,
|
||||
guint n_pspecs,
|
||||
GParamSpec **pspecs)
|
||||
{
|
||||
#ifdef USE_GLIB2
|
||||
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? */
|
||||
GST_DEBUG (GST_CAT_EVENT, "deep notification from %s to %s\n", GST_OBJECT_NAME (object), GST_OBJECT_NAME (gst_object));
|
||||
for (i = 0; i < n_pspecs; i++)
|
||||
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);
|
||||
}
|
||||
#endif /* USE_GLIB2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_object_get_path_string:
|
||||
* @object: GstObject to get the path from
|
||||
|
|
|
@ -102,6 +102,7 @@ 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
|
||||
|
|
|
@ -247,21 +247,28 @@ gst_filesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
|
|||
} else {
|
||||
src->filename = g_strdup (g_value_get_string (value));
|
||||
}
|
||||
g_object_notify (G_OBJECT (src), "location");
|
||||
break;
|
||||
case ARG_BLOCKSIZE:
|
||||
src->block_size = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "blocksize");
|
||||
break;
|
||||
case ARG_OFFSET:
|
||||
src->curoffset = g_value_get_int64 (value);
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
break;
|
||||
case ARG_MAPSIZE:
|
||||
if ((src->mapsize % src->pagesize) == 0)
|
||||
{
|
||||
src->mapsize = g_value_get_ulong (value);
|
||||
g_object_notify (G_OBJECT (src), "mmapsize");
|
||||
}
|
||||
else
|
||||
GST_INFO(0, "invalid mapsize, must a multiple of pagesize, which is %d\n",src->pagesize);
|
||||
break;
|
||||
case ARG_TOUCH:
|
||||
src->touch = g_value_get_boolean (value);
|
||||
g_object_notify (G_OBJECT (src), "touch");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -542,6 +549,7 @@ gst_filesrc_get (GstPad *pad)
|
|||
|
||||
/* we're done, return the buffer */
|
||||
src->curoffset += GST_BUFFER_SIZE(buf);
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -579,6 +587,12 @@ gst_filesrc_open_file (GstFileSrc *src)
|
|||
|
||||
src->curoffset = 0;
|
||||
|
||||
/* now notify of the changes */
|
||||
g_object_freeze_notify (G_OBJECT (src));
|
||||
g_object_notify (G_OBJECT (src), "filesize");
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
g_object_thaw_notify (G_OBJECT (src));
|
||||
|
||||
GST_FLAG_SET (src, GST_FILESRC_OPEN);
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -597,6 +611,12 @@ gst_filesrc_close_file (GstFileSrc *src)
|
|||
src->fd = 0;
|
||||
src->filelen = 0;
|
||||
src->curoffset = 0;
|
||||
/* and notify that things changed */
|
||||
g_object_freeze_notify (G_OBJECT (src));
|
||||
g_object_notify (G_OBJECT (src), "filesize");
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
g_object_thaw_notify (G_OBJECT (src));
|
||||
|
||||
if (src->mapbuf)
|
||||
gst_buffer_unref (src->mapbuf);
|
||||
|
||||
|
@ -654,6 +674,7 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
|
|||
return FALSE;
|
||||
break;
|
||||
}
|
||||
g_object_notify (G_OBJECT (src), "offset");
|
||||
src->seek_happened = TRUE;
|
||||
src->need_flush = GST_EVENT_SEEK_FLUSH(event);
|
||||
gst_event_free (event);
|
||||
|
|
|
@ -422,15 +422,17 @@ gst_md5sink_change_state (GstElement *element)
|
|||
|
||||
/* element check */
|
||||
sink = GST_MD5SINK (element);
|
||||
g_return_val_if_fail (sink != NULL, GST_PAD_CONNECT_REFUSED);
|
||||
g_return_val_if_fail (GST_IS_MD5SINK (sink), GST_PAD_CONNECT_REFUSED);
|
||||
|
||||
g_return_val_if_fail (GST_IS_MD5SINK (sink), GST_STATE_FAILURE);
|
||||
|
||||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
md5_init_ctx (sink);
|
||||
g_object_notify (G_OBJECT (element), "md5");
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
md5_finish_ctx (sink, sink->md5);
|
||||
g_object_notify (G_OBJECT (element), "md5");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -454,7 +456,8 @@ gst_md5sink_get_property (GObject *object, guint prop_id, GValue *value, GParamS
|
|||
|
||||
switch (prop_id) {
|
||||
case ARG_MD5:
|
||||
md5_read_ctx (sink, sink->md5);
|
||||
/* you could actually get a value for the current md5. This is currently disabled.
|
||||
* md5_read_ctx (sink, sink->md5); */
|
||||
g_value_set_pointer (value, sink->md5);
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue