mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
pbutils: allow describing unfixed caps if they share the same media type
Caps description and missing plugin code does not really need caps to be fixed, and indeed they may not be if giving encodebin unfixed caps that correspond to an unknown encoder or muxer. So we relax the check, and allow unfixed caps if all the structures refer to the same media type.
This commit is contained in:
parent
a00f4f239a
commit
065f1603b0
3 changed files with 24 additions and 4 deletions
|
@ -839,7 +839,7 @@ gst_pb_utils_get_decoder_description (const GstCaps * caps)
|
|||
|
||||
tmp = copy_and_clean_caps (caps);
|
||||
|
||||
g_return_val_if_fail (gst_caps_is_fixed (tmp), NULL);
|
||||
g_return_val_if_fail (has_single_media_type (tmp), NULL);
|
||||
|
||||
/* special-case RTP caps */
|
||||
if (caps_are_rtp_caps (tmp, "video", &str)) {
|
||||
|
@ -890,7 +890,7 @@ gst_pb_utils_get_encoder_description (const GstCaps * caps)
|
|||
g_return_val_if_fail (caps != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
|
||||
tmp = copy_and_clean_caps (caps);
|
||||
g_return_val_if_fail (gst_caps_is_fixed (tmp), NULL);
|
||||
g_return_val_if_fail (has_single_media_type (tmp), NULL);
|
||||
|
||||
/* special-case RTP caps */
|
||||
if (caps_are_rtp_caps (tmp, "video", &str)) {
|
||||
|
@ -1021,7 +1021,7 @@ gst_pb_utils_get_codec_description (const GstCaps * caps)
|
|||
g_return_val_if_fail (caps != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
|
||||
tmp = copy_and_clean_caps (caps);
|
||||
g_return_val_if_fail (gst_caps_is_fixed (tmp), NULL);
|
||||
g_return_val_if_fail (has_single_media_type (tmp), NULL);
|
||||
|
||||
info = find_format_info (tmp);
|
||||
|
||||
|
|
|
@ -156,6 +156,25 @@ copy_and_clean_caps (const GstCaps * caps)
|
|||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
has_single_media_type (const GstCaps * caps)
|
||||
{
|
||||
guint n, ns;
|
||||
const char *name0, *namen;
|
||||
|
||||
g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
|
||||
|
||||
name0 = gst_structure_get_name (gst_caps_get_structure (caps, 0));
|
||||
ns = gst_caps_get_size (caps);
|
||||
for (n = 1; n < ns; ++n) {
|
||||
namen = gst_structure_get_name (gst_caps_get_structure (caps, n));
|
||||
if (strcmp (name0, namen)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_missing_uri_source_message_new:
|
||||
* @element: the #GstElement posting the message
|
||||
|
@ -319,7 +338,7 @@ gst_missing_encoder_message_new (GstElement * element,
|
|||
g_return_val_if_fail (GST_IS_CAPS (encode_caps), NULL);
|
||||
g_return_val_if_fail (!gst_caps_is_any (encode_caps), NULL);
|
||||
g_return_val_if_fail (!gst_caps_is_empty (encode_caps), NULL);
|
||||
g_return_val_if_fail (gst_caps_is_fixed (encode_caps), NULL);
|
||||
g_return_val_if_fail (has_single_media_type (encode_caps), NULL);
|
||||
|
||||
description = gst_pb_utils_get_encoder_description (encode_caps);
|
||||
caps = copy_and_clean_caps (encode_caps);
|
||||
|
|
|
@ -107,3 +107,4 @@ struct _GstDiscovererInfo {
|
|||
/* missing-plugins.c */
|
||||
|
||||
GstCaps *copy_and_clean_caps (const GstCaps * caps);
|
||||
gboolean has_single_media_type (const GstCaps * caps);
|
||||
|
|
Loading…
Reference in a new issue