From f3c9c3493d1d352b7dec9be4d42a84147d715483 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 5 Feb 2004 23:46:13 +0000 Subject: [PATCH] gst/: put reverted patch back in Original commit message from CVS: 2004-02-06 Benjamin Otte * gst/gstcaps.h: * gst/gstelement.c: (gst_element_base_class_init), (gst_element_class_set_details), (gst_element_clear_pad_caps): * gst/gstpad.c: (gst_pad_link_intersect), (gst_pad_link_fixate), (gst_pad_try_set_caps), (gst_pad_can_link_filtered), (gst_real_pad_dispose): * gst/gststructure.c: (gst_structure_free), (gst_structure_from_string): put reverted patch back in * gst/gstelement.c: (gst_element_remove_pad): free explicit caps if they're set * gst/gstpad.c: (_gst_pad_default_fixate_func): copy the structure when fixating --- ChangeLog | 16 ++++++++++++++++ gst/gstcaps.h | 10 ++++------ gst/gstelement.c | 12 ++++++++++-- gst/gstpad.c | 39 ++++++++++++++++++++++----------------- gst/gststructure.c | 31 ++++++++++++++++--------------- 5 files changed, 68 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index f978028..bb56541 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-02-06 Benjamin Otte + + * gst/gstcaps.h: + * gst/gstelement.c: (gst_element_base_class_init), + (gst_element_class_set_details), (gst_element_clear_pad_caps): + * gst/gstpad.c: (gst_pad_link_intersect), (gst_pad_link_fixate), + (gst_pad_try_set_caps), (gst_pad_can_link_filtered), + (gst_real_pad_dispose): + * gst/gststructure.c: (gst_structure_free), + (gst_structure_from_string): + put reverted patch back in + * gst/gstelement.c: (gst_element_remove_pad): + free explicit caps if they're set + * gst/gstpad.c: (_gst_pad_default_fixate_func): + copy the structure when fixating + 2004-02-05 David Schleef * gst/gstmarshal.list: diff --git a/gst/gstcaps.h b/gst/gstcaps.h index aac52e5..fcf44a6 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -58,12 +58,10 @@ struct _GstStaticCaps { #define GST_TYPE_CAPS gst_caps_get_type() -/* FIXME Company should decide the best way to do this */ -#define GST_DEBUG_CAPS(string, caps) do { \ - char *s = gst_caps_to_string(caps); \ - GST_DEBUG ( "%s: %s", (string), s); \ - g_free(s); \ -}while(0) +#ifndef GST_DISABLE_DEPRECATED +#define GST_DEBUG_CAPS(string, caps) \ + GST_DEBUG ( string "%s: " GST_PTR_FORMAT, caps) +#endif void _gst_caps_initialize (void); diff --git a/gst/gstelement.c b/gst/gstelement.c index e2918d1..9090cca 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -53,7 +53,7 @@ enum { }; extern void __gst_element_details_clear (GstElementDetails *dp); -extern void __gst_element_details_set (GstElementDetails *dest, +extern void __gst_element_details_copy (GstElementDetails *dest, const GstElementDetails *src); static void gst_element_class_init (GstElementClass *klass); @@ -172,6 +172,7 @@ gst_element_base_class_init (gpointer g_class) gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_element_real_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_element_real_get_property); + memset (&element_class->details, 0, sizeof (GstElementDetails)); element_class->padtemplates = NULL; } @@ -1144,8 +1145,12 @@ gst_element_remove_pad (GstElement *element, GstPad *pad) if (GST_RPAD_PEER (pad) != NULL) { gst_pad_unlink (pad, GST_PAD (GST_RPAD_PEER (pad))); } +<<<<<<< gstelement.c + gst_caps_replace (&GST_RPAD_EXPLICIT_CAPS (pad), NULL); +======= } else if (GST_IS_GHOST_PAD (pad)) { g_object_set (pad, "real-pad", NULL, NULL); +>>>>>>> 1.250 } /* remove it from the list */ @@ -1379,7 +1384,7 @@ gst_element_class_set_details (GstElementClass *klass, const GstElementDetails * g_return_if_fail (GST_IS_ELEMENT_CLASS (klass)); g_return_if_fail (GST_IS_ELEMENT_DETAILS (details)); - __gst_element_details_set (&klass->details, details); + __gst_element_details_copy (&klass->details, details); } /** @@ -2753,6 +2758,9 @@ gst_element_clear_pad_caps (GstElement *element) GstPad *pad = GST_PAD (pads->data); gst_pad_unnegotiate (pad); + if (GST_IS_REAL_PAD (pad)){ + gst_caps_replace (&GST_RPAD_EXPLICIT_CAPS (pad), NULL); + } pads = g_list_next (pads); } diff --git a/gst/gstpad.c b/gst/gstpad.c index e580b47..7c1f917 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -35,9 +35,6 @@ #define GST_CAT_DEFAULT GST_CAT_PADS -/* FIXME */ -#define gst_caps_debug(a,b) GST_DEBUG_CAPS(b,a) - enum { TEMPL_PAD_CREATED, @@ -1049,21 +1046,21 @@ static void gst_pad_link_intersect (GstPadLink *link) GST_DEBUG ("intersecting link from %s:%s to %s:%s", GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad)); - GST_DEBUG_CAPS ("srccaps", link->srccaps); - GST_DEBUG_CAPS ("sinkcaps", link->sinkcaps); - GST_DEBUG_CAPS ("filtercaps", link->filtercaps); + GST_DEBUG ("srccaps " GST_PTR_FORMAT, link->srccaps); + GST_DEBUG ("sinkcaps " GST_PTR_FORMAT, link->sinkcaps); + GST_DEBUG ("filtercaps " GST_PTR_FORMAT, link->filtercaps); pad_intersection = gst_caps_intersect (link->srccaps, link->sinkcaps); if (link->filtercaps) { - GST_DEBUG_CAPS ("unfiltered intersection", pad_intersection); + GST_DEBUG ("unfiltered intersection " GST_PTR_FORMAT, pad_intersection); link->caps = gst_caps_intersect (pad_intersection, link->filtercaps); gst_caps_free (pad_intersection); } else { link->caps = pad_intersection; } - GST_DEBUG_CAPS ("intersection", link->caps); + GST_DEBUG ("intersection " GST_PTR_FORMAT, link->caps); } static gboolean @@ -1098,7 +1095,7 @@ gst_pad_link_fixate (GstPadLink *link) g_return_if_fail (caps != NULL); g_return_if_fail (!gst_caps_is_empty(caps)); - GST_DEBUG_CAPS ("trying to fixate caps", caps); + GST_DEBUG ("trying to fixate caps " GST_PTR_FORMAT, caps); while (!gst_caps_is_fixed (caps)) { int i; @@ -1109,31 +1106,31 @@ gst_pad_link_fixate (GstPadLink *link) case 0: g_signal_emit (G_OBJECT (link->srcpad), gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps); - GST_DEBUG_CAPS ("app srcpad signal fixated to", newcaps); + GST_DEBUG ("app srcpad signal fixated to " GST_PTR_FORMAT, newcaps); break; case 1: g_signal_emit (G_OBJECT (link->sinkpad), gst_real_pad_signals[REAL_FIXATE], 0, caps, &newcaps); - GST_DEBUG_CAPS ("app sinkpad signal fixated to", newcaps); + GST_DEBUG ("app sinkpad signal fixated to " GST_PTR_FORMAT, newcaps); break; case 2: if (GST_RPAD_FIXATEFUNC(link->srcpad)) { newcaps = GST_RPAD_FIXATEFUNC(link->srcpad) ( GST_PAD (link->srcpad), caps); - GST_DEBUG_CAPS ("srcpad fixated to", newcaps); + GST_DEBUG ("srcpad fixated to " GST_PTR_FORMAT, newcaps); } break; case 3: if (GST_RPAD_FIXATEFUNC(link->sinkpad)) { newcaps = GST_RPAD_FIXATEFUNC(link->sinkpad) ( GST_PAD (link->sinkpad), caps); - GST_DEBUG_CAPS ("sinkpad fixated to", newcaps); + GST_DEBUG ("sinkpad fixated to " GST_PTR_FORMAT, newcaps); } break; case 4: newcaps = _gst_pad_default_fixate_func ( GST_PAD(link->srcpad), caps); - GST_DEBUG_CAPS ("core fixated to", newcaps); + GST_DEBUG ("core fixated to GST_PTR_FORMAT", newcaps); break; } if (newcaps) { @@ -1335,7 +1332,7 @@ gst_pad_try_set_caps (GstPad *pad, const GstCaps *caps) g_warning ("trying to set non fixed caps on pad %s:%s, not allowed", GST_DEBUG_PAD_NAME (pad)); - gst_caps_debug (caps, "unfixed caps"); + GST_DEBUG ("unfixed caps " GST_PTR_FORMAT, caps); return GST_PAD_LINK_REFUSED; } @@ -1542,9 +1539,12 @@ gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, if (filtercaps) link->filtercaps = gst_caps_copy (filtercaps); gst_pad_link_intersect (link); - if (gst_caps_is_empty (link->caps)) + if (gst_caps_is_empty (link->caps)) { + gst_pad_link_free (link); return FALSE; + } + gst_pad_link_free (link); return TRUE; } @@ -1938,7 +1938,7 @@ _gst_pad_default_fixate_func (GstPad *pad, const GstCaps *caps) } if (caps->structs->len > 1) { - return gst_caps_new_full (gst_caps_get_structure (caps, 0), NULL); + return gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (caps, 0)), NULL); } newcaps = gst_caps_copy (caps); @@ -2736,6 +2736,11 @@ gst_real_pad_dispose (GObject *object) gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad); } + if (GST_RPAD_EXPLICIT_CAPS (pad)) { + GST_ERROR_OBJECT (pad, "still explicit caps %"GST_PTR_FORMAT" set", GST_RPAD_EXPLICIT_CAPS (pad)); + g_warning ("pad %p has still explicit caps set", pad); + gst_caps_replace (&GST_RPAD_EXPLICIT_CAPS (pad), NULL); + } G_OBJECT_CLASS (real_pad_parent_class)->dispose (object); } diff --git a/gst/gststructure.c b/gst/gststructure.c index d593371..7e1cb0e 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -237,8 +237,6 @@ void gst_structure_free(GstStructure *structure) GstStructureField *field; int i; - return; - g_return_if_fail(structure != NULL); for(i=0;ifields->len;i++){ @@ -1337,9 +1335,8 @@ gst_structure_from_string (const gchar *string, gchar **end) char *w; char *r; char save; - GstStructure *structure; + GstStructure *structure = NULL; GstStructureField field = { 0 }; - gboolean res; g_return_val_if_fail(string != NULL, NULL); @@ -1347,11 +1344,11 @@ gst_structure_from_string (const gchar *string, gchar **end) r = copy; name = r; - res = _gst_structure_parse_string (r, &w, &r); - if (!res) return NULL; + if (!_gst_structure_parse_string (r, &w, &r)) + goto error; while (g_ascii_isspace(*r)) r++; - if(*r != 0 && *r != ';' && *r != ',') return NULL; + if(*r != 0 && *r != ';' && *r != ',') goto error; save = *w; *w = 0; @@ -1359,24 +1356,28 @@ gst_structure_from_string (const gchar *string, gchar **end) *w = save; while (*r && (*r != ';')){ - if(*r != ',') { - return NULL; - } + if(*r != ',') + goto error; r++; while (*r && g_ascii_isspace(*r)) r++; memset(&field,0,sizeof(field)); - res = _gst_structure_parse_field (r, &r, &field); - if (!res) { - gst_structure_free (structure); - return NULL; - } + if (!_gst_structure_parse_field (r, &r, &field)) + goto error; gst_structure_set_field(structure, &field); while (*r && g_ascii_isspace(*r)) r++; } if (end) *end = (char *)string + (r - copy); + + g_free (copy); return structure; + +error: + if (structure) + gst_structure_free (structure); + g_free (copy); + return NULL; } static void -- 2.7.4