typefindhelper: implement get_length on GstTypeFindBufHelper

Some typefind code may rely on gst_type_find_get_length() which was not
working when using the helper.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6937>
This commit is contained in:
Guillaume Desmottes 2024-05-27 15:32:10 +02:00
parent 9e3b1cfc49
commit e2b1730398

View file

@ -579,6 +579,14 @@ buf_helper_find_suggest (gpointer data, guint probability, GstCaps * caps)
} }
} }
static guint64
buf_helper_get_length (gpointer data)
{
GstTypeFindBufHelper *helper = (GstTypeFindBufHelper *) data;
return helper->size;
}
/** /**
* gst_type_find_helper_for_data: * gst_type_find_helper_for_data:
* @obj: (nullable): object doing the typefinding, or %NULL (used for logging) * @obj: (nullable): object doing the typefinding, or %NULL (used for logging)
@ -670,7 +678,7 @@ gst_type_find_helper_for_data_with_extension (GstObject * obj,
find.data = &helper; find.data = &helper;
find.peek = buf_helper_find_peek; find.peek = buf_helper_find_peek;
find.suggest = buf_helper_find_suggest; find.suggest = buf_helper_find_suggest;
find.get_length = NULL; find.get_length = buf_helper_get_length;
type_list = gst_type_find_factory_get_list (); type_list = gst_type_find_factory_get_list ();
type_list = prioritize_extension (obj, type_list, extension); type_list = prioritize_extension (obj, type_list, extension);