summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2015-11-17 01:12:28 +1100
committerJan Schmidt <jan@centricular.com>2016-01-29 01:44:26 +1100
commit192a1eea3458bd5d678e0511a0cc1a69d8aa74fa (patch)
tree4090367d359809ee922181612d642014e4b8164c
parentfefc011dfbc0f727f212baa2759434e1591e1821 (diff)
rtsp-sdp: Add gst_rtsp_sdp_from_stream()
A new function that adds info from a GstRTSPStream into an SDP message. https://bugzilla.gnome.org/show_bug.cgi?id=758180
-rw-r--r--gst/rtsp-server/rtsp-sdp.c63
-rw-r--r--gst/rtsp-server/rtsp-sdp.h1
2 files changed, 41 insertions, 23 deletions
diff --git a/gst/rtsp-server/rtsp-sdp.c b/gst/rtsp-server/rtsp-sdp.c
index 74ea340..950a1eb 100644
--- a/gst/rtsp-server/rtsp-sdp.c
+++ b/gst/rtsp-server/rtsp-sdp.c
@@ -73,7 +73,7 @@ update_sdp_from_tags (GstRTSPStream * stream, GstSDPMedia * stream_media)
}
static void
-make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPMedia * media,
+make_media (GstSDPMessage * sdp, GstSDPInfo * info,
GstRTSPStream * stream, GstCaps * caps, GstRTSPProfile profile)
{
GstSDPMedia *smedia;
@@ -258,30 +258,9 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
for (i = 0; i < n_streams; i++) {
GstRTSPStream *stream;
- GstCaps *caps;
- GstRTSPProfile profiles;
- guint mask;
stream = gst_rtsp_media_get_stream (media, i);
- caps = gst_rtsp_stream_get_caps (stream);
-
- if (caps == NULL) {
- g_warning ("ignoring stream %d without media type", i);
- continue;
- }
-
- /* make a new media for each profile */
- profiles = gst_rtsp_stream_get_profiles (stream);
- mask = 1;
- while (profiles >= mask) {
- GstRTSPProfile prof = profiles & mask;
-
- if (prof)
- make_media (sdp, info, media, stream, caps, prof);
-
- mask <<= 1;
- }
- gst_caps_unref (caps);
+ gst_rtsp_sdp_from_stream (sdp, info, stream);
}
{
@@ -317,3 +296,41 @@ not_prepared:
return FALSE;
}
}
+
+/**
+ * gst_rtsp_sdp_from_stream:
+ * @sdp: a #GstSDPMessage
+ * @info: (transfer none): a #GstSDPInfo
+ * @stream: (transfer none): a #GstRTSPStream
+ *
+ * Add info from @stream to @sdp.
+ *
+ */
+void
+gst_rtsp_sdp_from_stream (GstSDPMessage * sdp, GstSDPInfo * info,
+ GstRTSPStream * stream)
+{
+ GstCaps *caps;
+ GstRTSPProfile profiles;
+ guint mask;
+
+ caps = gst_rtsp_stream_get_caps (stream);
+
+ if (caps == NULL) {
+ g_warning ("ignoring stream without caps");
+ return;
+ }
+
+ /* make a new media for each profile */
+ profiles = gst_rtsp_stream_get_profiles (stream);
+ mask = 1;
+ while (profiles >= mask) {
+ GstRTSPProfile prof = profiles & mask;
+
+ if (prof)
+ make_media (sdp, info, stream, caps, prof);
+
+ mask <<= 1;
+ }
+ gst_caps_unref (caps);
+}
diff --git a/gst/rtsp-server/rtsp-sdp.h b/gst/rtsp-server/rtsp-sdp.h
index 7732f36..4a47766 100644
--- a/gst/rtsp-server/rtsp-sdp.h
+++ b/gst/rtsp-server/rtsp-sdp.h
@@ -34,6 +34,7 @@ typedef struct {
/* creating SDP */
gboolean gst_rtsp_sdp_from_media (GstSDPMessage *sdp, GstSDPInfo *info, GstRTSPMedia * media);
+void gst_rtsp_sdp_from_stream (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPStream *stream);
G_END_DECLS