Commit 2169b1a5 authored by Wim Taymans's avatar Wim Taymans
Browse files

gst/: Keep track of current target state while performing a state change so...

gst/: Keep track of current target state while performing a state change so that subclasses can do something interest...

Original commit message from CVS:
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstmessage.c: (gst_message_parse_error),
(gst_message_parse_warning):
Keep track of current target state while performing a state
change so that subclasses can do something interesting.
Fix parsing of warning/error messages when GError is NULL.
parent 87d6d314
2005-06-25 Wim Taymans <wim@fluendo.com>
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstmessage.c: (gst_message_parse_error),
(gst_message_parse_warning):
Keep track of current target state while performing a state
change so that subclasses can do something interesting.
Fix parsing of warning/error messages when GError is NULL.
2005-06-24 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/gst/Makefile.am:
......
......@@ -1686,6 +1686,8 @@ gst_element_set_state (GstElement * element, GstElementState state)
/* get the element state lock */
GST_STATE_LOCK (element);
/* this is the state we should go to */
GST_STATE_FINAL (element) = state;
if (ret == GST_STATE_ASYNC) {
gst_element_commit_state (element);
}
......@@ -1771,6 +1773,7 @@ gst_element_set_state (GstElement * element, GstElementState state)
while (current != state);
exit:
GST_STATE_FINAL (element) = GST_STATE_VOID_PENDING;
GST_STATE_UNLOCK (element);
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "exit state change");
......@@ -1780,6 +1783,7 @@ exit:
/* ERROR */
invalid_return:
{
GST_STATE_FINAL (element) = GST_STATE_VOID_PENDING;
GST_STATE_UNLOCK (element);
/* somebody added a GST_STATE_ and forgot to do stuff here ! */
g_critical ("unknown return value %d from a state change function",
......
......@@ -55,6 +55,7 @@ GST_EXPORT GType _gst_element_type;
*/
#define GST_STATE(obj) (GST_ELEMENT(obj)->current_state)
#define GST_STATE_PENDING(obj) (GST_ELEMENT(obj)->pending_state)
#define GST_STATE_FINAL(obj) (GST_ELEMENT(obj)->final_state)
#define GST_STATE_ERROR(obj) (GST_ELEMENT(obj)->state_error)
#define GST_STATE_NO_PREROLL(obj) (GST_ELEMENT(obj)->no_preroll)
......@@ -171,6 +172,7 @@ struct _GstElement
GCond *state_cond;
guint8 current_state;
guint8 pending_state;
guint8 final_state;
gboolean state_error; /* flag is set when the element has an error in the last state
change. it is cleared when doing another state change. */
gboolean no_preroll; /* flag is set when the element cannot preroll */
......
......@@ -414,6 +414,7 @@ void
gst_message_parse_error (GstMessage * message, GError ** gerror, gchar ** debug)
{
const GValue *error_gvalue;
GError *error_val;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
......@@ -422,7 +423,11 @@ gst_message_parse_error (GstMessage * message, GError ** gerror, gchar ** debug)
g_return_if_fail (error_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (error_gvalue) == G_TYPE_POINTER);
*gerror = g_error_copy (g_value_get_pointer (error_gvalue));
error_val = g_value_get_pointer (error_gvalue);
if (error_val)
*gerror = g_error_copy (error_val);
else
*gerror = NULL;
*debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
}
......@@ -440,6 +445,7 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror,
gchar ** debug)
{
const GValue *error_gvalue;
GError *error_val;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING);
......@@ -448,6 +454,11 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror,
g_return_if_fail (error_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (error_gvalue) == G_TYPE_POINTER);
*gerror = g_error_copy (g_value_get_pointer (error_gvalue));
error_val = g_value_get_pointer (error_gvalue);
if (error_val)
*gerror = g_error_copy (error_val);
else
*gerror = NULL;
*debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment