mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
rtsp-sdp: Parse framerate caps field and set SDP attribute
The SDP attribute and its format is described in RFC4566. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=700747
This commit is contained in:
parent
5fd034ff1a
commit
d6a4dee036
1 changed files with 13 additions and 0 deletions
|
@ -101,6 +101,7 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
|||
GString *fmtp;
|
||||
GstCaps *caps;
|
||||
gint width, height;
|
||||
gint num = 0, denom = 1;
|
||||
|
||||
stream = gst_rtsp_media_get_stream (media, i);
|
||||
caps = gst_rtsp_stream_get_caps (stream);
|
||||
|
@ -163,6 +164,16 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
|||
g_free (tmp);
|
||||
}
|
||||
|
||||
/* create framerate SDP attribute if frame is not zero */
|
||||
if (gst_structure_get_fraction (s, "framerate", &num, &denom) && num > 0) {
|
||||
gdouble rate;
|
||||
gchar framerate [G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
gst_util_fraction_to_double (num, denom, &rate);
|
||||
g_ascii_formatd (framerate, sizeof (framerate), " %.17g", rate);
|
||||
gst_sdp_media_add_attribute (smedia, "framerate", framerate);
|
||||
}
|
||||
|
||||
/* the config uri */
|
||||
tmp = g_strdup_printf ("stream=%d", i);
|
||||
gst_sdp_media_add_attribute (smedia, "control", tmp);
|
||||
|
@ -199,6 +210,8 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
|||
continue;
|
||||
if (!strcmp (fname, "height"))
|
||||
continue;
|
||||
if (!strcmp (fname, "framerate"))
|
||||
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