Commit 3fdae13f authored by Aleix Conchillo Flaqué's avatar Aleix Conchillo Flaqué Committed by Wim Taymans

media: add setup_sdp vmethod

gst/rtsp-server/rtsp-media.[ch]: added setup_sdp vmethod and public
gst_rtsp_media_setup_sdp.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720155
parent cdd72905
......@@ -1719,7 +1719,7 @@ create_sdp (GstRTSPClient * client, GstRTSPMedia * media)
info.server_ip = priv->server_ip;
/* create an SDP for the media object */
if (!gst_rtsp_sdp_from_media (sdp, &info, media))
if (!gst_rtsp_media_setup_sdp (media, sdp, &info))
goto no_sdp;
return sdp;
......
......@@ -177,6 +177,8 @@ static gboolean default_query_position (GstRTSPMedia * media,
gint64 * position);
static gboolean default_query_stop (GstRTSPMedia * media, gint64 * stop);
static GstElement *default_create_rtpbin (GstRTSPMedia * media);
static gboolean default_setup_sdp (GstRTSPMedia * media, GstSDPMessage * sdp,
GstSDPInfo * info);
static gboolean wait_preroll (GstRTSPMedia * media);
......@@ -294,6 +296,7 @@ gst_rtsp_media_class_init (GstRTSPMediaClass * klass)
klass->query_position = default_query_position;
klass->query_stop = default_query_stop;
klass->create_rtpbin = default_create_rtpbin;
klass->setup_sdp = default_setup_sdp;
}
static void
......@@ -2395,6 +2398,60 @@ gst_rtsp_media_get_time_provider (GstRTSPMedia * media, const gchar * address,
return provider;
}
static gboolean
default_setup_sdp (GstRTSPMedia * media, GstSDPMessage * sdp, GstSDPInfo * info)
{
return gst_rtsp_sdp_from_media (sdp, info, media);
}
/**
* gst_rtsp_media_setup_sdp:
* @sdp: a #GstSDPMessage
* @info: info
* @media: a #GstRTSPMedia
*
* Add @media specific info to @sdp. @info is used to configure the connection
* information in the SDP.
*
* Returns: TRUE on success.
*/
gboolean
gst_rtsp_media_setup_sdp (GstRTSPMedia * media, GstSDPMessage * sdp,
GstSDPInfo * info)
{
GstRTSPMediaPrivate *priv;
GstRTSPMediaClass *klass;
gboolean res;
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), FALSE);
g_return_val_if_fail (sdp != NULL, FALSE);
g_return_val_if_fail (info != NULL, FALSE);
priv = media->priv;
g_rec_mutex_lock (&priv->state_lock);
klass = GST_RTSP_MEDIA_GET_CLASS (media);
if (!klass->setup_sdp)
goto no_setup_sdp;
res = klass->setup_sdp (media, sdp, info);
g_rec_mutex_unlock (&priv->state_lock);
return res;
/* ERRORS */
no_setup_sdp:
{
g_rec_mutex_unlock (&priv->state_lock);
GST_ERROR ("no setup_sdp function");
g_critical ("no setup_sdp vmethod function set");
return FALSE;
}
}
/**
* gst_rtsp_media_suspend:
* @media: a #GstRTSPMedia
......
......@@ -84,6 +84,7 @@ GType gst_rtsp_suspend_mode_get_type (void);
#include "rtsp-thread-pool.h"
#include "rtsp-permissions.h"
#include "rtsp-address-pool.h"
#include "rtsp-sdp.h"
/**
* GstRTSPMedia:
......@@ -124,6 +125,7 @@ struct _GstRTSPMediaClass {
gboolean (*query_stop) (GstRTSPMedia *media, gint64 *stop);
GstElement * (*create_rtpbin) (GstRTSPMedia *media);
gboolean (*setup_rtpbin) (GstRTSPMedia *media, GstElement *rtpbin);
gboolean (*setup_sdp) (GstRTSPMedia *media, GstSDPMessage *sdp, GstSDPInfo *info);
/* signals */
void (*new_stream) (GstRTSPMedia *media, GstRTSPStream * stream);
......@@ -185,6 +187,9 @@ GstRTSPSuspendMode gst_rtsp_media_get_suspend_mode (GstRTSPMedia *media);
gboolean gst_rtsp_media_suspend (GstRTSPMedia *media);
gboolean gst_rtsp_media_unsuspend (GstRTSPMedia *media);
gboolean gst_rtsp_media_setup_sdp (GstRTSPMedia * media, GstSDPMessage * sdp,
GstSDPInfo * info);
/* creating streams */
void gst_rtsp_media_collect_streams (GstRTSPMedia *media);
GstRTSPStream * gst_rtsp_media_create_stream (GstRTSPMedia *media,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment