Commit fe5fe438 authored by Wim Taymans's avatar Wim Taymans
Browse files

typefind: remove const from refcounted GstCaps

Having const on refcounted objects require us to make copies instead of simply
taking a ref, don't do that.
parent 6426145f
......@@ -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);
......
......@@ -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,
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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);
......
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