mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 17:52:29 +00:00
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
This commit is contained in:
parent
fefc011dfb
commit
192a1eea34
2 changed files with 41 additions and 23 deletions
|
@ -73,7 +73,7 @@ update_sdp_from_tags (GstRTSPStream * stream, GstSDPMedia * stream_media)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPMedia * media,
|
make_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
||||||
GstRTSPStream * stream, GstCaps * caps, GstRTSPProfile profile)
|
GstRTSPStream * stream, GstCaps * caps, GstRTSPProfile profile)
|
||||||
{
|
{
|
||||||
GstSDPMedia *smedia;
|
GstSDPMedia *smedia;
|
||||||
|
@ -258,30 +258,9 @@ gst_rtsp_sdp_from_media (GstSDPMessage * sdp, GstSDPInfo * info,
|
||||||
|
|
||||||
for (i = 0; i < n_streams; i++) {
|
for (i = 0; i < n_streams; i++) {
|
||||||
GstRTSPStream *stream;
|
GstRTSPStream *stream;
|
||||||
GstCaps *caps;
|
|
||||||
GstRTSPProfile profiles;
|
|
||||||
guint mask;
|
|
||||||
|
|
||||||
stream = gst_rtsp_media_get_stream (media, i);
|
stream = gst_rtsp_media_get_stream (media, i);
|
||||||
caps = gst_rtsp_stream_get_caps (stream);
|
gst_rtsp_sdp_from_stream (sdp, info, 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -317,3 +296,41 @@ not_prepared:
|
||||||
return FALSE;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ typedef struct {
|
||||||
|
|
||||||
/* creating SDP */
|
/* creating SDP */
|
||||||
gboolean gst_rtsp_sdp_from_media (GstSDPMessage *sdp, GstSDPInfo *info, GstRTSPMedia * media);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue