}
static void
-make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPMedia * media,
+make_media (GstSDPMessage * sdp, GstSDPInfo * info,
GstRTSPStream * stream, GstCaps * caps, GstRTSPProfile profile)
{
GstSDPMedia *smedia;
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);
}
{
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);
+}