diff --git a/ChangeLog b/ChangeLog index 7fa142b482..0c61d51747 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-08-25 Jan Schmidt + + * check/gst/gstbin.c: (GST_START_TEST): + * gst/gstbin.c: (bin_bus_handler): + * gst/gstmessage.c: (gst_message_finalize), (_gst_message_copy), + (gst_message_new), (gst_message_new_eos), (gst_message_new_error), + (gst_message_new_warning), (gst_message_new_tag), + (gst_message_new_state_changed), (gst_message_new_segment_start), + (gst_message_new_segment_done), (gst_message_new_custom): + * gst/gstmessage.h: + * tools/gst-launch.c: (event_loop): + * tools/gst-md5sum.c: (event_loop): + Revert unpopular change for GST_MESSAGE_SRC to GObject. + 2005-08-25 Wim Taymans * check/generic/states.c: (GST_START_TEST): diff --git a/check/gst/gstbin.c b/check/gst/gstbin.c index fffada30b8..0bef198f24 100644 --- a/check/gst/gstbin.c +++ b/check/gst/gstbin.c @@ -170,7 +170,7 @@ GST_START_TEST (test_message_state_changed_child) == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); message = gst_bus_pop (bus); - fail_unless (GST_MESSAGE_SRC (message) == G_OBJECT (src)); + fail_unless (message->src == GST_OBJECT (src)); gst_message_unref (message); ASSERT_OBJECT_REFCOUNT (src, "src", 1); @@ -181,7 +181,7 @@ GST_START_TEST (test_message_state_changed_child) == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); message = gst_bus_pop (bus); - fail_unless (GST_MESSAGE_SRC (message) == G_OBJECT (bin)); + fail_unless (message->src == GST_OBJECT (bin)); gst_message_unref (message); ASSERT_OBJECT_REFCOUNT (src, "src", 1); diff --git a/gst/gstbin.c b/gst/gstbin.c index 156f84a71f..729a44427d 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -1555,13 +1555,7 @@ bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin) switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_EOS:{ - GObject *src = GST_MESSAGE_SRC (message); - gchar *name; - - if (src && GST_IS_OBJECT (src)) - name = gst_object_get_name (GST_OBJECT (src)); - else - name = g_strdup ("(null)"); + gchar *name = gst_object_get_name (GST_MESSAGE_SRC (message)); GST_DEBUG_OBJECT (bin, "got EOS message from %s", name); g_free (name); diff --git a/gst/gstmessage.c b/gst/gstmessage.c index 1dce0a728a..599c508f95 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -105,10 +105,7 @@ gst_message_finalize (GstMessage * message) GST_CAT_INFO (GST_CAT_MESSAGE, "finalize message %p", message); if (GST_MESSAGE_SRC (message)) { - if (GST_IS_OBJECT (GST_MESSAGE_SRC (message))) - gst_object_unref (GST_OBJECT (GST_MESSAGE_SRC (message))); - else - g_object_unref (GST_MESSAGE_SRC (message)); + gst_object_unref (GST_MESSAGE_SRC (message)); GST_MESSAGE_SRC (message) = NULL; } @@ -142,11 +139,7 @@ _gst_message_copy (GstMessage * message) GST_MESSAGE_TIMESTAMP (copy) = GST_MESSAGE_TIMESTAMP (message); if (GST_MESSAGE_SRC (message)) { - if (GST_IS_OBJECT (GST_MESSAGE_SRC (message))) - GST_MESSAGE_SRC (copy) = - gst_object_ref (GST_OBJECT (GST_MESSAGE_SRC (message))); - else - GST_MESSAGE_SRC (copy) = g_object_ref (GST_MESSAGE_SRC (message)); + GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message)); } if (message->structure) { @@ -159,7 +152,7 @@ _gst_message_copy (GstMessage * message) } static GstMessage * -gst_message_new (GstMessageType type, GObject * src) +gst_message_new (GstMessageType type, GstObject * src) { GstMessage *message; @@ -169,11 +162,7 @@ gst_message_new (GstMessageType type, GObject * src) message->type = type; if (src) { - if (GST_IS_OBJECT (src)) - message->src = gst_object_ref (GST_OBJECT (src)); - else - message->src = g_object_ref (src); - + message->src = gst_object_ref (src); GST_CAT_DEBUG_OBJECT (GST_CAT_MESSAGE, src, "message source"); } else { message->src = NULL; @@ -200,7 +189,7 @@ gst_message_new_eos (GstObject * src) { GstMessage *message; - message = gst_message_new (GST_MESSAGE_EOS, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_EOS, src); return message; } @@ -225,7 +214,7 @@ gst_message_new_error (GstObject * src, GError * error, gchar * debug) GstMessage *message; GstStructure *s; - message = gst_message_new (GST_MESSAGE_ERROR, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_ERROR, src); /* gst_structure_new takes copies of the types passed in */ s = gst_structure_new ("GstMessageError", "gerror", GST_TYPE_G_ERROR, error, "debug", G_TYPE_STRING, debug, NULL); @@ -254,7 +243,7 @@ gst_message_new_warning (GstObject * src, GError * error, gchar * debug) GstMessage *message; GstStructure *s; - message = gst_message_new (GST_MESSAGE_WARNING, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_WARNING, src); /* gst_structure_new takes copies of the types passed in */ s = gst_structure_new ("GstMessageWarning", "gerror", GST_TYPE_G_ERROR, error, "debug", G_TYPE_STRING, debug, NULL); @@ -283,7 +272,7 @@ gst_message_new_tag (GstObject * src, GstTagList * tag_list) g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL); - message = gst_message_new (GST_MESSAGE_TAG, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_TAG, src); gst_structure_set_parent_refcount (tag_list, &message->mini_object.refcount); message->structure = tag_list; @@ -310,7 +299,7 @@ gst_message_new_state_changed (GstObject * src, GstElementState old, GstMessage *message; GstStructure *s; - message = gst_message_new (GST_MESSAGE_STATE_CHANGED, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_STATE_CHANGED, src); s = gst_structure_new ("GstMessageState", "old-state", G_TYPE_INT, (gint) old, "new-state", G_TYPE_INT, (gint) new, NULL); @@ -340,7 +329,7 @@ gst_message_new_segment_start (GstObject * src, GstClockTime timestamp) GstMessage *message; GstStructure *s; - message = gst_message_new (GST_MESSAGE_SEGMENT_START, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_SEGMENT_START, src); s = gst_structure_new ("GstMessageSegmentStart", "timestamp", G_TYPE_INT64, (gint64) timestamp, NULL); @@ -370,7 +359,7 @@ gst_message_new_segment_done (GstObject * src, GstClockTime timestamp) GstMessage *message; GstStructure *s; - message = gst_message_new (GST_MESSAGE_SEGMENT_DONE, (GObject *) (src)); + message = gst_message_new (GST_MESSAGE_SEGMENT_DONE, src); s = gst_structure_new ("GstMessageSegmentDone", "timestamp", G_TYPE_INT64, (gint64) timestamp, NULL); @@ -395,7 +384,7 @@ gst_message_new_segment_done (GstObject * src, GstClockTime timestamp) * MT safe. */ GstMessage * -gst_message_new_custom (GstMessageType type, GObject * src, +gst_message_new_custom (GstMessageType type, GstObject * src, GstStructure * structure) { GstMessage *message; diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 279b025bd6..47f34c1a34 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -108,7 +108,7 @@ struct _GstMessage /*< public > *//* with COW */ GstMessageType type; guint64 timestamp; - GObject *src; + GstObject *src; GstStructure *structure; @@ -143,7 +143,7 @@ GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState ol GstMessage * gst_message_new_segment_start (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_segment_done (GstObject * src, GstClockTime timestamp); GstMessage * gst_message_new_custom (GstMessageType type, - GObject * src, + GstObject * src, GstStructure * structure); #define gst_message_new_application(src, str) \ gst_message_new_custom (GST_MESSAGE_APPLICATION, src, str) diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c index fffada30b8..0bef198f24 100644 --- a/tests/check/gst/gstbin.c +++ b/tests/check/gst/gstbin.c @@ -170,7 +170,7 @@ GST_START_TEST (test_message_state_changed_child) == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); message = gst_bus_pop (bus); - fail_unless (GST_MESSAGE_SRC (message) == G_OBJECT (src)); + fail_unless (message->src == GST_OBJECT (src)); gst_message_unref (message); ASSERT_OBJECT_REFCOUNT (src, "src", 1); @@ -181,7 +181,7 @@ GST_START_TEST (test_message_state_changed_child) == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); message = gst_bus_pop (bus); - fail_unless (GST_MESSAGE_SRC (message) == G_OBJECT (bin)); + fail_unless (message->src == GST_OBJECT (bin)); gst_message_unref (message); ASSERT_OBJECT_REFCOUNT (src, "src", 1); diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 2c292bfb9a..b5891d25cc 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -431,9 +431,7 @@ event_loop (GstElement * pipeline, gboolean blocking) gchar *debug; gst_message_parse_error (message, &gerror, &debug); - if (GST_IS_OBJECT (GST_MESSAGE_SRC (message))) - gst_object_default_error (GST_OBJECT (GST_MESSAGE_SRC (message)), - gerror, debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); gst_message_unref (message); if (gerror) g_error_free (gerror); @@ -446,7 +444,7 @@ event_loop (GstElement * pipeline, gboolean blocking) gst_message_parse_state_changed (message, &old, &new); if (!(old == GST_STATE_PLAYING && new == GST_STATE_PAUSED && - GST_MESSAGE_SRC (message) == G_OBJECT (pipeline))) { + GST_MESSAGE_SRC (message) == GST_OBJECT (pipeline))) { gst_message_unref (message); break; } diff --git a/tools/gst-md5sum.c b/tools/gst-md5sum.c index 617512efa4..f64e9277b5 100644 --- a/tools/gst-md5sum.c +++ b/tools/gst-md5sum.c @@ -34,9 +34,7 @@ event_loop (GstElement * pipeline) gst_message_parse_error (message, &gerror, &debug); gst_message_unref (message); - if (GST_IS_OBJECT (GST_MESSAGE_SRC (message))) - gst_object_default_error (GST_OBJECT (GST_MESSAGE_SRC (message)), - gerror, debug); + gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); return TRUE;