From 7155cfae354bfef98eaf09af35a769feadc68981 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 20 Feb 2004 00:38:24 +0000 Subject: [PATCH] gst/gstevent.c: copy navigation event correctly. Check freeing tag lists. Original commit message from CVS: 2004-02-20 Benjamin Otte * gst/gstevent.c: (_gst_event_copy), (_gst_event_free): copy navigation event correctly. Check freeing tag lists. * gst/gstthread.c: (gst_thread_change_state): don't abort() on state changing mess - it might happen because of bugs. * gst/gstvalue.c: (gst_value_set_caps), (gst_value_get_caps): use boxed functions * gst/gstvalue.h: fix GST_VALUE_HOLDS_CAPS --- ChangeLog | 12 ++++++++++++ gst/gstevent.c | 9 ++++++++- gst/gstthread.c | 6 +++++- gst/gstvalue.c | 8 ++++---- gst/gstvalue.h | 3 +-- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba0fde767c..73abeeb23f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-02-20 Benjamin Otte + + * gst/gstevent.c: (_gst_event_copy), (_gst_event_free): + copy navigation event correctly. Check freeing tag lists. + * gst/gstthread.c: (gst_thread_change_state): + don't abort() on state changing mess - it might happen because of + bugs. + * gst/gstvalue.c: (gst_value_set_caps), (gst_value_get_caps): + use boxed functions + * gst/gstvalue.h: + fix GST_VALUE_HOLDS_CAPS + 2004-02-19 David Schleef * gst/gstinfo.h: Copy G_STRFUNC implementation from glib-2.4 diff --git a/gst/gstevent.c b/gst/gstevent.c index f5a842b840..e81db15446 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -74,6 +74,9 @@ _gst_event_copy (GstEvent *event) /* FIXME copy/ref additional fields */ switch (GST_EVENT_TYPE (event)) { case GST_EVENT_TAG: + copy->event_data.structure.structure = gst_tag_list_copy ((GstTagList *) event->event_data.structure.structure); + break; + case GST_EVENT_NAVIGATION: copy->event_data.structure.structure = gst_structure_copy (event->event_data.structure.structure); default: break; @@ -92,8 +95,12 @@ _gst_event_free (GstEvent* event) } switch (GST_EVENT_TYPE (event)) { case GST_EVENT_TAG: - if (GST_IS_TAG_LIST (event->event_data.structure.structure)) + if (GST_IS_TAG_LIST (event->event_data.structure.structure)) { gst_tag_list_free (event->event_data.structure.structure); + } else { + g_warning ("tag event %p didn't contain a valid tag list!", event); + GST_ERROR ("tag event %p didn't contain a valid tag list!", event); + } break; case GST_EVENT_NAVIGATION: gst_structure_free (event->event_data.structure.structure); diff --git a/gst/gstthread.c b/gst/gstthread.c index e81ee471aa..b0eac6289b 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -476,9 +476,13 @@ gst_thread_change_state (GstElement *element) /* it should be dead now */ break; default: - GST_ERROR_OBJECT (element, "UNHANDLED STATE CHANGE! %x", + GST_ERROR_OBJECT (element, "unhandled state change! %x", GST_STATE_TRANSITION (element)); + g_warning ("thread %s: UNHANDLED STATE CHANGE! %x", + GST_STR_NULL (GST_OBJECT_NAME (element)), GST_STATE_TRANSITION (element)); + /* FIXME: not doable with current threading mess: g_assert_not_reached (); + */ break; } diff --git a/gst/gstvalue.c b/gst/gstvalue.c index b2f993bb64..5678a34f49 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -682,9 +682,9 @@ gst_value_deserialize_double_range (GValue *dest, const char *s) void gst_value_set_caps (GValue *value, const GstCaps *caps) { - g_return_if_fail (GST_VALUE_HOLDS_CAPS (value)); + g_return_if_fail (G_VALUE_TYPE (value) == GST_TYPE_CAPS); - value->data[0].v_pointer = gst_caps_copy (caps); + g_value_set_boxed (value, caps); } /** @@ -694,9 +694,9 @@ gst_value_set_caps (GValue *value, const GstCaps *caps) const GstCaps * gst_value_get_caps (const GValue *value) { - g_return_val_if_fail (GST_VALUE_HOLDS_CAPS (value), 0); + g_return_val_if_fail (G_VALUE_TYPE (value) == GST_TYPE_CAPS, NULL); - return value->data[0].v_pointer; + return (GstCaps *) g_value_get_boxed (value); } /*************************************/ diff --git a/gst/gstvalue.h b/gst/gstvalue.h index 04c5d98c57..6493ab5984 100644 --- a/gst/gstvalue.h +++ b/gst/gstvalue.h @@ -59,7 +59,7 @@ struct _GstValueTable { #define GST_VALUE_HOLDS_INT_RANGE(x) (G_VALUE_HOLDS(x, gst_type_int_range)) #define GST_VALUE_HOLDS_DOUBLE_RANGE(x) (G_VALUE_HOLDS(x, gst_type_double_range)) #define GST_VALUE_HOLDS_LIST(x) (G_VALUE_HOLDS(x, gst_type_list)) -#define GST_VALUE_HOLDS_CAPS(x) TRUE /* FIXME */ +#define GST_VALUE_HOLDS_CAPS(x) (G_VALUE_HOLDS(x, GST_TYPE_CAPS)) #define GST_TYPE_FOURCC gst_type_fourcc #define GST_TYPE_INT_RANGE gst_type_int_range @@ -102,7 +102,6 @@ double gst_value_get_double_range_min (const GValue *value); double gst_value_get_double_range_max (const GValue *value); /* caps */ - G_CONST_RETURN GstCaps *gst_value_get_caps (const GValue *value); void gst_value_set_caps (GValue *value, const GstCaps *caps);