mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 04:52:28 +00:00
rtsp-sdp: Parse width/height from caps and set SDP attribute
The SDP attribute and its format is described in RFC6064. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=700747
This commit is contained in:
parent
0951aa37e1
commit
5fd034ff1a
1 changed files with 17 additions and 0 deletions
|
@ -100,6 +100,7 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
|||
gboolean first;
|
||||
GString *fmtp;
|
||||
GstCaps *caps;
|
||||
gint width, height;
|
||||
|
||||
stream = gst_rtsp_media_get_stream (media, i);
|
||||
caps = gst_rtsp_stream_get_caps (stream);
|
||||
|
@ -150,6 +151,18 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
|||
g_free (tmp);
|
||||
}
|
||||
|
||||
/* create framesize SDP attribute */
|
||||
if (gst_structure_get_int (s, "width", &width) && width > 0 &&
|
||||
gst_structure_get_int (s, "height", &height) && height > 0) {
|
||||
tmp = g_strdup_printf ("%d %d-%d", caps_pt, width, height);
|
||||
gst_sdp_media_add_attribute (smedia, "framesize", tmp);
|
||||
g_free (tmp);
|
||||
|
||||
tmp = g_strdup_printf (" %d,%d", width, height);
|
||||
gst_sdp_media_add_attribute (smedia, "x-dimensions", tmp);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
/* the config uri */
|
||||
tmp = g_strdup_printf ("stream=%d", i);
|
||||
gst_sdp_media_add_attribute (smedia, "control", tmp);
|
||||
|
@ -182,6 +195,10 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
|||
continue;
|
||||
if (!strcmp (fname, "seqnum-base"))
|
||||
continue;
|
||||
if (!strcmp (fname, "width"))
|
||||
continue;
|
||||
if (!strcmp (fname, "height"))
|
||||
continue;
|
||||
|
||||
if ((fval = gst_structure_get_string (s, fname))) {
|
||||
g_string_append_printf (fmtp, "%s%s=%s", first ? "" : ";", fname, fval);
|
||||
|
|
Loading…
Reference in a new issue