mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
sdpdemux: add "media" property to allow audio-only or video-only streaming
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3531>
This commit is contained in:
parent
7f2a9d738a
commit
beb4f4bff1
3 changed files with 47 additions and 0 deletions
|
@ -229367,6 +229367,18 @@
|
|||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"media": {
|
||||
"blurb": "Media to use, e.g. audio or video (NULL = all)",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "NULL",
|
||||
"mutable": "null",
|
||||
"readable": true,
|
||||
"type": "gchararray",
|
||||
"writable": true
|
||||
},
|
||||
"redirect": {
|
||||
"blurb": "Sends a redirection message instead of using a custom session element",
|
||||
"conditionally-available": false,
|
||||
|
|
|
@ -190,6 +190,18 @@ gst_sdp_demux_class_init (GstSDPDemuxClass * klass)
|
|||
DEFAULT_RTCP_MODE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GstSDPDemux:media:
|
||||
*
|
||||
* Media to use, e.g. audio or video (NULL=allow all).
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_MEDIA,
|
||||
g_param_spec_string ("media", "Media",
|
||||
"Media to use, e.g. audio or video (NULL = all)", DEFAULT_MEDIA,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &rtptemplate);
|
||||
|
||||
|
@ -266,6 +278,12 @@ gst_sdp_demux_set_property (GObject * object, guint prop_id,
|
|||
case PROP_RTCP_MODE:
|
||||
demux->rtcp_mode = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_MEDIA:
|
||||
GST_OBJECT_LOCK (demux);
|
||||
/* g_intern_string() is NULL-safe */
|
||||
demux->media = g_intern_string (g_value_get_string (value));
|
||||
GST_OBJECT_UNLOCK (demux);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -296,6 +314,11 @@ gst_sdp_demux_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
case PROP_RTCP_MODE:
|
||||
g_value_set_enum (value, demux->rtcp_mode);
|
||||
break;
|
||||
case PROP_MEDIA:
|
||||
GST_OBJECT_LOCK (demux);
|
||||
g_value_set_string (value, demux->media);
|
||||
GST_OBJECT_UNLOCK (demux);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -436,6 +459,7 @@ static GstSDPStream *
|
|||
gst_sdp_demux_create_stream (GstSDPDemux * demux, GstSDPMessage * sdp, gint idx)
|
||||
{
|
||||
GstSDPStream *stream;
|
||||
const gchar *media_filter;
|
||||
const gchar *payload;
|
||||
const GstSDPMedia *media;
|
||||
const GstSDPConnection *conn;
|
||||
|
@ -445,6 +469,16 @@ gst_sdp_demux_create_stream (GstSDPDemux * demux, GstSDPMessage * sdp, gint idx)
|
|||
if (media == NULL)
|
||||
return NULL;
|
||||
|
||||
GST_OBJECT_LOCK (demux);
|
||||
media_filter = demux->media;
|
||||
GST_OBJECT_UNLOCK (demux);
|
||||
|
||||
if (media_filter != NULL && !g_str_equal (media_filter, media->media)) {
|
||||
GST_INFO_OBJECT (demux, "Skipping media %s (filter: %s)", media->media,
|
||||
media_filter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream = g_new0 (GstSDPStream, 1);
|
||||
stream->parent = demux;
|
||||
/* we mark the pad as not linked, we will mark it as OK when we add the pad to
|
||||
|
|
|
@ -118,6 +118,7 @@ struct _GstSDPDemux {
|
|||
guint64 udp_timeout;
|
||||
guint latency;
|
||||
gboolean redirect;
|
||||
const gchar *media; /* if non-NULL only hook up these kinds of media (video/audio) */ /* interned string */
|
||||
GstSDPDemuxRTCPMode rtcp_mode;
|
||||
|
||||
/* session management */
|
||||
|
|
Loading…
Reference in a new issue