mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
This patch (nearly) completes the removal of vertical events from the core.
Original commit message from CVS: This patch (nearly) completes the removal of vertical events from the core. What it does: - removal of the EVENT signal of GstElement (to be replaced by g_object_notify) - changing of the ERROR signal to allow recursive notification (like deep_notify) - implementing recursive notification with error events. - removal of some functions in gstbin.c that are not used anymore. - The function gst_element_info and gst_element_send_event now do nothing but printing a warning, that these functions are gone. This is done to allow plugins to catch up. - Some bugfixes in XML saving are included, they simply were in the file.
This commit is contained in:
parent
ac5bfadbfe
commit
a2c24524e2
4 changed files with 36 additions and 104 deletions
30
gst/gstbin.c
30
gst/gstbin.c
|
@ -48,7 +48,6 @@ static GstElementStateReturn gst_bin_change_state_norecurse (GstBin *bin);
|
|||
static gboolean gst_bin_change_state_type (GstBin *bin,
|
||||
GstElementState state,
|
||||
GType type);
|
||||
static void gst_bin_send_event (GstElement *element, GstEvent *event);
|
||||
|
||||
static gboolean gst_bin_iterate_func (GstBin * bin);
|
||||
|
||||
|
@ -124,7 +123,6 @@ gst_bin_class_init (GstBinClass * klass)
|
|||
#endif
|
||||
|
||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_bin_change_state);
|
||||
gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_bin_send_event);
|
||||
|
||||
klass->change_state_type = GST_DEBUG_FUNCPTR (gst_bin_change_state_type);
|
||||
klass->iterate = GST_DEBUG_FUNCPTR (gst_bin_iterate_func);
|
||||
|
@ -491,34 +489,6 @@ gst_bin_child_state_change (GstBin *bin, GstElementState oldstate, GstElementSta
|
|||
GST_UNLOCK (bin);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_bin_child_error:
|
||||
* @bin: #GstBin with the child
|
||||
* @child: #GstElement that signaled an error
|
||||
*
|
||||
* An internal function to inform the parent bin about a failed child.
|
||||
*/
|
||||
void
|
||||
gst_bin_child_error (GstBin *bin, GstElement *child)
|
||||
{
|
||||
g_return_if_fail (GST_IS_BIN (bin));
|
||||
|
||||
if (GST_STATE (bin) != GST_STATE_NULL) {
|
||||
gst_element_info (GST_ELEMENT (bin), "bin \"%s\" stopped because child \"%s\" signalled an error",
|
||||
GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (child));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_bin_send_event (GstElement *element, GstEvent *event)
|
||||
{
|
||||
GST_DEBUG (GST_CAT_EVENT, "event from %s in %s\n",
|
||||
gst_element_get_name (GST_ELEMENT (GST_EVENT_SRC (event))),
|
||||
gst_element_get_name (element));
|
||||
|
||||
GST_ELEMENT_CLASS (parent_class)->send_event (element, event);
|
||||
}
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_bin_change_state (GstElement * element)
|
||||
{
|
||||
|
|
106
gst/gstelement.c
106
gst/gstelement.c
|
@ -38,7 +38,6 @@ enum {
|
|||
NEW_PAD,
|
||||
PAD_REMOVED,
|
||||
ERROR,
|
||||
EVENT,
|
||||
EOS,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -62,7 +61,7 @@ static void gst_element_get_property (GObject *object, guint prop_id, GValue *
|
|||
static void gst_element_dispose (GObject *object);
|
||||
|
||||
static GstElementStateReturn gst_element_change_state (GstElement *element);
|
||||
static void gst_element_send_event_func (GstElement *element, GstEvent *event);
|
||||
static void gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg);
|
||||
|
||||
#ifndef GST_DISABLE_LOADSAVE
|
||||
static xmlNodePtr gst_element_save_thyself (GstObject *object, xmlNodePtr parent);
|
||||
|
@ -123,13 +122,8 @@ gst_element_class_init (GstElementClass *klass)
|
|||
gst_element_signals[ERROR] =
|
||||
g_signal_new ("error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstElementClass, error), NULL, NULL,
|
||||
gst_marshal_VOID__STRING, G_TYPE_NONE,1,
|
||||
G_TYPE_STRING);
|
||||
gst_element_signals[EVENT] =
|
||||
g_signal_new ("event", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstElementClass, event), NULL, NULL,
|
||||
gst_marshal_VOID__POINTER, G_TYPE_NONE,1,
|
||||
G_TYPE_POINTER);
|
||||
gst_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
|
||||
G_TYPE_OBJECT, G_TYPE_STRING);
|
||||
gst_element_signals[EOS] =
|
||||
g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstElementClass,eos), NULL, NULL,
|
||||
|
@ -147,7 +141,7 @@ gst_element_class_init (GstElementClass *klass)
|
|||
#endif
|
||||
|
||||
klass->change_state = GST_DEBUG_FUNCPTR (gst_element_change_state);
|
||||
klass->send_event = GST_DEBUG_FUNCPTR (gst_element_send_event_func);
|
||||
klass->error = GST_DEBUG_FUNCPTR (gst_element_error_func);
|
||||
klass->elementfactory = NULL;
|
||||
klass->padtemplates = NULL;
|
||||
klass->numpadtemplates = 0;
|
||||
|
@ -1024,25 +1018,18 @@ gst_element_disconnect (GstElement *src, const gchar *srcpadname,
|
|||
/* we're satisified they can be disconnected, let's do it */
|
||||
gst_pad_disconnect(srcpad,destpad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_element_message (GstElement *element, const gchar *type, const gchar *info, va_list var_args)
|
||||
gst_element_error_func (GstElement* element, GstElement *source, gchar *errormsg)
|
||||
{
|
||||
GstEvent *event;
|
||||
GstProps *props;
|
||||
gchar *string;
|
||||
|
||||
string = g_strdup_vprintf (info, var_args);
|
||||
|
||||
GST_INFO (GST_CAT_EVENT, "%s sends message %s", GST_ELEMENT_NAME (element),
|
||||
string);
|
||||
|
||||
event = gst_event_new_info (type, GST_PROPS_STRING (string), NULL);
|
||||
gst_element_send_event (element, event);
|
||||
|
||||
g_free (string);
|
||||
/* tell the parent */
|
||||
if (GST_OBJECT_PARENT (element))
|
||||
{
|
||||
GST_DEBUG (GST_CAT_EVENT, "forwarding error \"%s\" from %s to %s\n", errormsg, GST_ELEMENT_NAME (element), GST_OBJECT_NAME (GST_OBJECT_PARENT (element)));
|
||||
gst_object_ref (element);
|
||||
g_signal_emit (G_OBJECT (GST_OBJECT_PARENT (element)), gst_element_signals[ERROR], 0, source, errormsg);
|
||||
gst_object_unref (element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_error:
|
||||
* @element: Element with the error
|
||||
|
@ -1056,25 +1043,31 @@ void
|
|||
gst_element_error (GstElement *element, const gchar *error, ...)
|
||||
{
|
||||
va_list var_args;
|
||||
GstObject *parent;
|
||||
gchar *string;
|
||||
|
||||
/* checks */
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (element != NULL);
|
||||
g_return_if_fail (error != NULL);
|
||||
|
||||
/* create error message */
|
||||
va_start (var_args, error);
|
||||
gst_element_message (element, "error", error, var_args);
|
||||
string = g_strdup_vprintf (error, var_args);
|
||||
va_end (var_args);
|
||||
GST_INFO (GST_CAT_EVENT, "ERROR in %s: %s", GST_ELEMENT_NAME (element), string);
|
||||
|
||||
parent = GST_ELEMENT_PARENT (element);
|
||||
|
||||
if (parent && GST_IS_BIN (parent)) {
|
||||
gst_bin_child_error (GST_BIN (parent), element);
|
||||
}
|
||||
|
||||
/* emit the signal, make sure the element stays available */
|
||||
gst_object_ref (element);
|
||||
g_signal_emit (G_OBJECT (element), gst_element_signals[ERROR], 0, element, string);
|
||||
|
||||
/* tell the scheduler */
|
||||
if (element->sched) {
|
||||
gst_scheduler_error (element->sched, element);
|
||||
}
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
gst_object_unref (element);
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1089,54 +1082,21 @@ gst_element_error (GstElement *element, const gchar *error, ...)
|
|||
void
|
||||
gst_element_info (GstElement *element, const gchar *info, ...)
|
||||
{
|
||||
va_list var_args;
|
||||
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
va_start (var_args, info);
|
||||
gst_element_message (element, "info", info, var_args);
|
||||
va_end (var_args);
|
||||
g_warning ("The function gst_element_info is gone. Use g_object_notify instead.");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gst_element_send_event_func (GstElement *element, GstEvent *event)
|
||||
{
|
||||
if (GST_OBJECT_PARENT (element)) {
|
||||
gst_element_send_event (GST_ELEMENT (GST_OBJECT_PARENT (element)), event);
|
||||
}
|
||||
else {
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
g_signal_emit (G_OBJECT (element), gst_element_signals[EVENT], 0, event);
|
||||
}
|
||||
gst_event_free (event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_send_event:
|
||||
* @element: Element generating the event
|
||||
* @event: the event to send
|
||||
*
|
||||
* This function is used intenally by elements to send an event to
|
||||
* the app. It will result in an "event" signal.
|
||||
* This function is deprecated and doesn't work anymore.
|
||||
*/
|
||||
void
|
||||
gst_element_send_event (GstElement *element, GstEvent *event)
|
||||
{
|
||||
GstElementClass *oclass = CLASS (element);
|
||||
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (event);
|
||||
|
||||
if (GST_EVENT_SRC (event) == NULL)
|
||||
GST_EVENT_SRC (event) = gst_object_ref (GST_OBJECT (element));
|
||||
|
||||
if (oclass->send_event)
|
||||
(oclass->send_event) (element, event);
|
||||
|
||||
g_warning ("The function gst_element_send_event is gone. Use g_object_notify instead.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1461,7 +1421,7 @@ gst_element_save_thyself (GstObject *object,
|
|||
GstElementClass *oclass;
|
||||
GParamSpec **specs, *spec;
|
||||
gint nspecs, i;
|
||||
GValue value;
|
||||
GValue value = { 0, };
|
||||
GstElement *element;
|
||||
gchar *str;
|
||||
|
||||
|
@ -1502,6 +1462,8 @@ gst_element_save_thyself (GstObject *object,
|
|||
xmlNewChild (param, NULL, "value", g_value_dup_string (&value));
|
||||
else if (G_IS_PARAM_SPEC_ENUM (spec))
|
||||
xmlNewChild (param, NULL, "value", g_strdup_printf ("%d", g_value_get_enum (&value)));
|
||||
else if (G_IS_PARAM_SPEC_INT64 (spec))
|
||||
xmlNewChild (param, NULL, "value", g_strdup_printf ("%lld", g_value_get_int64 (&value)));
|
||||
else
|
||||
xmlNewChild (param, NULL, "value", g_strdup_value_contents (&value));
|
||||
|
||||
|
|
|
@ -159,8 +159,7 @@ struct _GstElementClass {
|
|||
void (*state_change) (GstElement *element, GstElementState old, GstElementState state);
|
||||
void (*new_pad) (GstElement *element, GstPad *pad);
|
||||
void (*pad_removed) (GstElement *element, GstPad *pad);
|
||||
void (*error) (GstElement *element, gchar *error);
|
||||
void (*event) (GstElement *element, GstEvent *event);
|
||||
void (*error) (GstElement *element, GstElement *source, gchar *error);
|
||||
void (*eos) (GstElement *element);
|
||||
|
||||
/* local pointers for get/set */
|
||||
|
|
|
@ -6,4 +6,5 @@ VOID:POINTER
|
|||
VOID:OBJECT
|
||||
VOID:OBJECT,PARAM
|
||||
VOID:OBJECT,POINTER
|
||||
VOID:OBJECT,STRING
|
||||
VOID:INT,INT
|
||||
|
|
Loading…
Reference in a new issue