diff --git a/gst/gsttypefind.c b/gst/gsttypefind.c index 2cfb8d0cfa..24c4730292 100644 --- a/gst/gsttypefind.c +++ b/gst/gsttypefind.c @@ -145,8 +145,7 @@ gst_type_find_peek (GstTypeFind * find, gint64 offset, guint size) * It is up to the caller of the #GstTypeFindFunction to interpret these values. */ void -gst_type_find_suggest (GstTypeFind * find, guint probability, - const GstCaps * caps) +gst_type_find_suggest (GstTypeFind * find, guint probability, GstCaps * caps) { g_return_if_fail (find->suggest != NULL); g_return_if_fail (probability <= 100); diff --git a/gst/gsttypefind.h b/gst/gsttypefind.h index 31a0a2ec55..9e66b6d88c 100644 --- a/gst/gsttypefind.h +++ b/gst/gsttypefind.h @@ -80,7 +80,7 @@ struct _GstTypeFind { void (* suggest) (gpointer data, guint probability, - const GstCaps * caps); + GstCaps *caps); gpointer data; @@ -100,7 +100,7 @@ const guint8 * gst_type_find_peek (GstTypeFind * find, void gst_type_find_suggest (GstTypeFind * find, guint probability, - const GstCaps * caps); + GstCaps * caps); void gst_type_find_suggest_simple (GstTypeFind * find, guint probability, diff --git a/libs/gst/base/gsttypefindhelper.c b/libs/gst/base/gsttypefindhelper.c index 9cefb94734..903c96cc2e 100644 --- a/libs/gst/base/gsttypefindhelper.c +++ b/libs/gst/base/gsttypefindhelper.c @@ -43,7 +43,7 @@ /* ********************** typefinding in pull mode ************************ */ static void -helper_find_suggest (gpointer data, guint probability, const GstCaps * caps); +helper_find_suggest (gpointer data, guint probability, GstCaps * caps); typedef struct { @@ -201,7 +201,7 @@ error: */ static void helper_find_suggest (gpointer data, GstTypeFindProbability probability, - const GstCaps * caps) + GstCaps * caps) { GstTypeFindHelper *helper = (GstTypeFindHelper *) data; @@ -210,9 +210,7 @@ helper_find_suggest (gpointer data, GstTypeFindProbability probability, GST_OBJECT_NAME (helper->factory), probability, caps); if (probability > helper->best_probability) { - GstCaps *copy = gst_caps_copy (caps); - - gst_caps_take (&helper->caps, copy); + gst_caps_replace (&helper->caps, caps); helper->best_probability = probability; } } @@ -445,7 +443,7 @@ buf_helper_find_peek (gpointer data, gint64 off, guint size) */ static void buf_helper_find_suggest (gpointer data, GstTypeFindProbability probability, - const GstCaps * caps) + GstCaps * caps) { GstTypeFindBufHelper *helper = (GstTypeFindBufHelper *) data; @@ -455,10 +453,7 @@ buf_helper_find_suggest (gpointer data, GstTypeFindProbability probability, /* Note: not >= as we call typefinders in order of rank, highest first */ if (probability > helper->best_probability) { - GstCaps *copy = gst_caps_copy (caps); - - gst_caps_replace (&helper->caps, copy); - gst_caps_unref (copy); + gst_caps_replace (&helper->caps, caps); helper->best_probability = probability; } } diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 9a99d4c835..7db416bf74 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -175,10 +175,8 @@ static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 }; static void gst_type_find_element_have_type (GstTypeFindElement * typefind, - guint probability, const GstCaps * caps) + guint probability, GstCaps * caps) { - GstCaps *copy; - g_assert (caps != NULL); GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT ", probability=%u", @@ -187,12 +185,10 @@ gst_type_find_element_have_type (GstTypeFindElement * typefind, GST_OBJECT_LOCK (typefind); if (typefind->caps) gst_caps_unref (typefind->caps); - typefind->caps = gst_caps_copy (caps); - copy = gst_caps_ref (typefind->caps); + typefind->caps = gst_caps_ref (caps); GST_OBJECT_UNLOCK (typefind); - gst_pad_push_event (typefind->src, gst_event_new_caps (copy)); - gst_caps_unref (copy); + gst_pad_push_event (typefind->src, gst_event_new_caps (caps)); } static void diff --git a/plugins/elements/gsttypefindelement.h b/plugins/elements/gsttypefindelement.h index 4a363698b7..0242ec2beb 100644 --- a/plugins/elements/gsttypefindelement.h +++ b/plugins/elements/gsttypefindelement.h @@ -71,8 +71,8 @@ struct _GstTypeFindElementClass { /* signals */ void (*have_type) (GstTypeFindElement *element, - guint probability, - const GstCaps * caps); + guint probability, + GstCaps *caps); }; GType gst_type_find_element_get_type (void);