parsebin: Use pbutils utils to identify more stream types

Handles all cases provided they are identified in the pbutils descriptions
list.

Fixes #1081

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6153>
This commit is contained in:
Edward Hervey 2024-02-20 16:02:25 +01:00 committed by GStreamer Marge Bot
parent 34a1245905
commit 479c0c5bb4

View file

@ -3971,6 +3971,7 @@ guess_stream_type_from_caps (GstCaps * caps)
{
GstStructure *s;
const gchar *name;
GstPbUtilsCapsDescriptionFlags desc;
if (gst_caps_get_size (caps) < 1)
return GST_STREAM_TYPE_UNKNOWN;
@ -3993,8 +3994,20 @@ guess_stream_type_from_caps (GstCaps * caps)
g_str_has_prefix (name, "closedcaption/"))
return GST_STREAM_TYPE_TEXT;
/* Use information from pbutils. Note that we only care about elementary
* streams which is why we check flag equality */
desc = gst_pb_utils_get_caps_description_flags (caps);
switch (desc) {
case GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO:
return GST_STREAM_TYPE_AUDIO;
case GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO:
return GST_STREAM_TYPE_VIDEO;
case GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE:
return GST_STREAM_TYPE_TEXT;
default:
return GST_STREAM_TYPE_UNKNOWN;
}
}
static void
gst_parse_pad_update_caps (GstParsePad * parsepad, GstCaps * caps)