mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 17:52:29 +00:00
typefind: fix for new getrange method signature
gst_type_find_helper_get_range_ext -> gst_type_find_helper_get_range
This commit is contained in:
parent
612b1fbb14
commit
cb54ab7d90
3 changed files with 18 additions and 43 deletions
|
@ -55,6 +55,7 @@ typedef struct
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstTypeFindFactory *factory; /* for logging */
|
GstTypeFindFactory *factory; /* for logging */
|
||||||
GstObject *obj; /* for logging */
|
GstObject *obj; /* for logging */
|
||||||
|
GstObject *parent;
|
||||||
} GstTypeFindHelper;
|
} GstTypeFindHelper;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -133,7 +134,9 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
|
||||||
* of the file is also not a problem here, we'll just get a truncated buffer
|
* of the file is also not a problem here, we'll just get a truncated buffer
|
||||||
* in that case (and we'll have to double-check the size we actually get
|
* in that case (and we'll have to double-check the size we actually get
|
||||||
* anyway, see below) */
|
* anyway, see below) */
|
||||||
ret = helper->func (helper->obj, offset, MAX (size, 4096), &buffer);
|
ret =
|
||||||
|
helper->func (helper->obj, helper->parent, offset, MAX (size, 4096),
|
||||||
|
&buffer);
|
||||||
|
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -226,8 +229,9 @@ helper_find_get_length (gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_type_find_helper_get_range_ext:
|
* gst_type_find_helper_get_range:
|
||||||
* @obj: A #GstObject that will be passed as first argument to @func
|
* @obj: A #GstObject that will be passed as first argument to @func
|
||||||
|
* @parent: the parent of @obj or NULL
|
||||||
* @func: (scope call): A generic #GstTypeFindHelperGetRangeFunction that will
|
* @func: (scope call): A generic #GstTypeFindHelperGetRangeFunction that will
|
||||||
* be used to access data at random offsets when doing the typefinding
|
* be used to access data at random offsets when doing the typefinding
|
||||||
* @size: The length in bytes
|
* @size: The length in bytes
|
||||||
|
@ -256,7 +260,7 @@ helper_find_get_length (gpointer data)
|
||||||
* Since: 0.10.26
|
* Since: 0.10.26
|
||||||
*/
|
*/
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_type_find_helper_get_range_ext (GstObject * obj,
|
gst_type_find_helper_get_range (GstObject * obj, GstObject * parent,
|
||||||
GstTypeFindHelperGetRangeFunction func, guint64 size,
|
GstTypeFindHelperGetRangeFunction func, guint64 size,
|
||||||
const gchar * extension, GstTypeFindProbability * prob)
|
const gchar * extension, GstTypeFindProbability * prob)
|
||||||
{
|
{
|
||||||
|
@ -277,6 +281,7 @@ gst_type_find_helper_get_range_ext (GstObject * obj,
|
||||||
helper.best_probability = GST_TYPE_FIND_NONE;
|
helper.best_probability = GST_TYPE_FIND_NONE;
|
||||||
helper.caps = NULL;
|
helper.caps = NULL;
|
||||||
helper.obj = obj;
|
helper.obj = obj;
|
||||||
|
helper.parent = parent;
|
||||||
|
|
||||||
find.data = &helper;
|
find.data = &helper;
|
||||||
find.peek = helper_find_peek;
|
find.peek = helper_find_peek;
|
||||||
|
@ -356,37 +361,6 @@ gst_type_find_helper_get_range_ext (GstObject * obj,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_type_find_helper_get_range:
|
|
||||||
* @obj: A #GstObject that will be passed as first argument to @func
|
|
||||||
* @func: (scope call): A generic #GstTypeFindHelperGetRangeFunction that will
|
|
||||||
* be used to access data at random offsets when doing the typefinding
|
|
||||||
* @size: The length in bytes
|
|
||||||
* @prob: (out) (allow-none): location to store the probability of the found
|
|
||||||
* caps, or #NULL
|
|
||||||
*
|
|
||||||
* Utility function to do pull-based typefinding. Unlike gst_type_find_helper()
|
|
||||||
* however, this function will use the specified function @func to obtain the
|
|
||||||
* data needed by the typefind functions, rather than operating on a given
|
|
||||||
* source pad. This is useful mostly for elements like tag demuxers which
|
|
||||||
* strip off data at the beginning and/or end of a file and want to typefind
|
|
||||||
* the stripped data stream before adding their own source pad (the specified
|
|
||||||
* callback can then call the upstream peer pad with offsets adjusted for the
|
|
||||||
* tag size, for example).
|
|
||||||
*
|
|
||||||
* Free-function: gst_caps_unref
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): the #GstCaps corresponding to the data stream.
|
|
||||||
* Returns #NULL if no #GstCaps matches the data stream.
|
|
||||||
*/
|
|
||||||
GstCaps *
|
|
||||||
gst_type_find_helper_get_range (GstObject * obj,
|
|
||||||
GstTypeFindHelperGetRangeFunction func, guint64 size,
|
|
||||||
GstTypeFindProbability * prob)
|
|
||||||
{
|
|
||||||
return gst_type_find_helper_get_range_ext (obj, func, size, NULL, prob);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_type_find_helper:
|
* gst_type_find_helper:
|
||||||
* @src: A source #GstPad
|
* @src: A source #GstPad
|
||||||
|
@ -410,7 +384,8 @@ gst_type_find_helper (GstPad * src, guint64 size)
|
||||||
|
|
||||||
func = (GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (src));
|
func = (GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (src));
|
||||||
|
|
||||||
return gst_type_find_helper_get_range (GST_OBJECT (src), func, size, NULL);
|
return gst_type_find_helper_get_range (GST_OBJECT (src),
|
||||||
|
GST_OBJECT_PARENT (src), func, size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************** typefinding for buffers ************************* */
|
/* ********************** typefinding for buffers ************************* */
|
||||||
|
|
|
@ -44,6 +44,7 @@ GstCaps * gst_type_find_helper_for_extension (GstObject * obj,
|
||||||
/**
|
/**
|
||||||
* GstTypeFindHelperGetRangeFunction:
|
* GstTypeFindHelperGetRangeFunction:
|
||||||
* @obj: a #GstObject that will handle the getrange request
|
* @obj: a #GstObject that will handle the getrange request
|
||||||
|
* @parent: the parent of @obj or NULL
|
||||||
* @offset: the offset of the range
|
* @offset: the offset of the range
|
||||||
* @length: the length of the range
|
* @length: the length of the range
|
||||||
* @buffer: a memory location to hold the result buffer
|
* @buffer: a memory location to hold the result buffer
|
||||||
|
@ -59,16 +60,13 @@ GstCaps * gst_type_find_helper_for_extension (GstObject * obj,
|
||||||
* Returns: GST_FLOW_OK for success
|
* Returns: GST_FLOW_OK for success
|
||||||
*/
|
*/
|
||||||
typedef GstFlowReturn (*GstTypeFindHelperGetRangeFunction) (GstObject *obj,
|
typedef GstFlowReturn (*GstTypeFindHelperGetRangeFunction) (GstObject *obj,
|
||||||
|
GstObject *parent,
|
||||||
guint64 offset,
|
guint64 offset,
|
||||||
guint length,
|
guint length,
|
||||||
GstBuffer **buffer);
|
GstBuffer **buffer);
|
||||||
|
|
||||||
GstCaps * gst_type_find_helper_get_range (GstObject *obj,
|
GstCaps * gst_type_find_helper_get_range (GstObject *obj,
|
||||||
GstTypeFindHelperGetRangeFunction func,
|
GstObject *parent,
|
||||||
guint64 size,
|
|
||||||
GstTypeFindProbability *prob);
|
|
||||||
|
|
||||||
GstCaps * gst_type_find_helper_get_range_ext (GstObject * obj,
|
|
||||||
GstTypeFindHelperGetRangeFunction func,
|
GstTypeFindHelperGetRangeFunction func,
|
||||||
guint64 size,
|
guint64 size,
|
||||||
const gchar *extension,
|
const gchar *extension,
|
||||||
|
|
|
@ -959,7 +959,9 @@ gst_type_find_element_activate (GstPad * pad)
|
||||||
}
|
}
|
||||||
ext = gst_type_find_get_extension (typefind, pad);
|
ext = gst_type_find_get_extension (typefind, pad);
|
||||||
|
|
||||||
found_caps = gst_type_find_helper_get_range_ext (GST_OBJECT_CAST (peer),
|
found_caps =
|
||||||
|
gst_type_find_helper_get_range (GST_OBJECT_CAST (peer),
|
||||||
|
GST_OBJECT_PARENT (peer),
|
||||||
(GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (peer)),
|
(GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (peer)),
|
||||||
(guint64) size, ext, &probability);
|
(guint64) size, ext, &probability);
|
||||||
g_free (ext);
|
g_free (ext);
|
||||||
|
|
Loading…
Reference in a new issue