mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-26 01:40:38 +00:00
typefind: add gst_type_find_suggest_empty_simple()
For cases where you only need a media type and no other fields. https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774#note_848664 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
This commit is contained in:
parent
a38d06cb1c
commit
7954eaaf25
|
@ -148,6 +148,38 @@ gst_type_find_suggest (GstTypeFind * find, guint probability, GstCaps * caps)
|
||||||
find->suggest (find->data, probability, caps);
|
find->suggest (find->data, probability, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_type_find_suggest_empty_simple:
|
||||||
|
* @find: The #GstTypeFind object the function was called with
|
||||||
|
* @probability: The probability in percent that the suggestion is right
|
||||||
|
* @media_type: the media type of the suggested caps
|
||||||
|
*
|
||||||
|
* If a #GstTypeFindFunction calls this function it suggests caps of the
|
||||||
|
* given @media_type with the given @probability.
|
||||||
|
*
|
||||||
|
* This function is similar to gst_type_find_suggest_simple(), but uses
|
||||||
|
* a #GstCaps with no fields.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_type_find_suggest_empty_simple (GstTypeFind * find,
|
||||||
|
guint probability, const char *media_type)
|
||||||
|
{
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
g_return_if_fail (find->suggest != NULL);
|
||||||
|
g_return_if_fail (probability <= 100);
|
||||||
|
g_return_if_fail (media_type != NULL);
|
||||||
|
|
||||||
|
caps = gst_caps_new_empty_simple (media_type);
|
||||||
|
|
||||||
|
g_return_if_fail (gst_caps_is_fixed (caps));
|
||||||
|
|
||||||
|
find->suggest (find->data, probability, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_type_find_suggest_simple:
|
* gst_type_find_suggest_simple:
|
||||||
* @find: The #GstTypeFind object the function was called with
|
* @find: The #GstTypeFind object the function was called with
|
||||||
|
@ -156,7 +188,8 @@ gst_type_find_suggest (GstTypeFind * find, guint probability, GstCaps * caps)
|
||||||
* @fieldname: (allow-none): first field of the suggested caps, or %NULL
|
* @fieldname: (allow-none): first field of the suggested caps, or %NULL
|
||||||
* @...: additional arguments to the suggested caps in the same format as the
|
* @...: additional arguments to the suggested caps in the same format as the
|
||||||
* arguments passed to gst_structure_new() (ie. triplets of field name,
|
* arguments passed to gst_structure_new() (ie. triplets of field name,
|
||||||
* field GType and field value)
|
* field GType and field value). If @fieldname is %NULL, this list
|
||||||
|
* must be exactly one %NULL.
|
||||||
*
|
*
|
||||||
* If a #GstTypeFindFunction calls this function it suggests the caps with the
|
* If a #GstTypeFindFunction calls this function it suggests the caps with the
|
||||||
* given probability. A #GstTypeFindFunction may supply different suggestions
|
* given probability. A #GstTypeFindFunction may supply different suggestions
|
||||||
|
|
|
@ -193,6 +193,10 @@ void gst_type_find_suggest (GstTypeFind * find,
|
||||||
guint probability,
|
guint probability,
|
||||||
GstCaps * caps);
|
GstCaps * caps);
|
||||||
GST_API
|
GST_API
|
||||||
|
void gst_type_find_suggest_empty_simple (GstTypeFind * find,
|
||||||
|
guint probability,
|
||||||
|
const char * media_type);
|
||||||
|
GST_API
|
||||||
void gst_type_find_suggest_simple (GstTypeFind * find,
|
void gst_type_find_suggest_simple (GstTypeFind * find,
|
||||||
guint probability,
|
guint probability,
|
||||||
const char * media_type,
|
const char * media_type,
|
||||||
|
|
Loading…
Reference in a new issue