rtph264pay: Add unrestricted caps

If there are no profile restrictions downstream, return caps with
profile=constrained-baseline in the first structure and append
unrestricted caps as the last structure.

Fixes bug #672019
This commit is contained in:
Jonas Holmberg 2012-05-21 12:17:35 +02:00 committed by Wim Taymans
parent ff019d05f6
commit 7bf3a1bf95

View file

@ -273,6 +273,7 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
GstCaps *template_caps; GstCaps *template_caps;
GstCaps *allowed_caps; GstCaps *allowed_caps;
GstCaps *caps, *icaps; GstCaps *caps, *icaps;
gboolean append_unrestricted;
guint i; guint i;
allowed_caps = allowed_caps =
@ -296,6 +297,7 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
caps = gst_caps_new_empty (); caps = gst_caps_new_empty ();
append_unrestricted = FALSE;
for (i = 0; i < gst_caps_get_size (allowed_caps); i++) { for (i = 0; i < gst_caps_get_size (allowed_caps); i++) {
GstStructure *s = gst_caps_get_structure (allowed_caps, i); GstStructure *s = gst_caps_get_structure (allowed_caps, i);
GstStructure *new_s = gst_structure_new_empty ("video/x-h264"); GstStructure *new_s = gst_structure_new_empty ("video/x-h264");
@ -364,15 +366,20 @@ gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad,
"profile", G_TYPE_STRING, "constrained-baseline", NULL); "profile", G_TYPE_STRING, "constrained-baseline", NULL);
} }
} else { } else {
/* No profile-level-id also means baseline */ /* No profile-level-id means baseline or unrestricted */
gst_structure_set (new_s, gst_structure_set (new_s,
"profile", G_TYPE_STRING, "constrained-baseline", NULL); "profile", G_TYPE_STRING, "constrained-baseline", NULL);
append_unrestricted = TRUE;
} }
caps = gst_caps_merge_structure (caps, new_s); caps = gst_caps_merge_structure (caps, new_s);
} }
if (append_unrestricted) {
gst_caps_merge_structure (caps, gst_structure_new ("video/x-h264", NULL));
}
icaps = gst_caps_intersect (caps, template_caps); icaps = gst_caps_intersect (caps, template_caps);
gst_caps_unref (caps); gst_caps_unref (caps);
caps = icaps; caps = icaps;