mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 12:41:05 +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
2 changed files with 38 additions and 1 deletions
|
@ -148,6 +148,38 @@ gst_type_find_suggest (GstTypeFind * find, guint probability, GstCaps * 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:
|
||||
* @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
|
||||
* @...: additional arguments to the suggested caps in the same format as the
|
||||
* 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
|
||||
* given probability. A #GstTypeFindFunction may supply different suggestions
|
||||
|
|
|
@ -193,6 +193,10 @@ void gst_type_find_suggest (GstTypeFind * find,
|
|||
guint probability,
|
||||
GstCaps * caps);
|
||||
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,
|
||||
guint probability,
|
||||
const char * media_type,
|
||||
|
|
Loading…
Reference in a new issue