mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 18:51:11 +00:00
media-factory: add protocols property
Add a property to configure the allowed protocols in the media created from the factory.
This commit is contained in:
parent
85e2013ca4
commit
4c8f3696d0
2 changed files with 73 additions and 12 deletions
|
@ -22,6 +22,7 @@
|
||||||
#define DEFAULT_LAUNCH NULL
|
#define DEFAULT_LAUNCH NULL
|
||||||
#define DEFAULT_SHARED FALSE
|
#define DEFAULT_SHARED FALSE
|
||||||
#define DEFAULT_EOS_SHUTDOWN FALSE
|
#define DEFAULT_EOS_SHUTDOWN FALSE
|
||||||
|
#define DEFAULT_PROTOCOLS GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_TCP
|
||||||
#define DEFAULT_BUFFER_SIZE 0x80000
|
#define DEFAULT_BUFFER_SIZE 0x80000
|
||||||
#define DEFAULT_MULTICAST_GROUP "224.2.0.1"
|
#define DEFAULT_MULTICAST_GROUP "224.2.0.1"
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ enum
|
||||||
PROP_LAUNCH,
|
PROP_LAUNCH,
|
||||||
PROP_SHARED,
|
PROP_SHARED,
|
||||||
PROP_EOS_SHUTDOWN,
|
PROP_EOS_SHUTDOWN,
|
||||||
|
PROP_PROTOCOLS,
|
||||||
PROP_BUFFER_SIZE,
|
PROP_BUFFER_SIZE,
|
||||||
PROP_MULTICAST_GROUP,
|
PROP_MULTICAST_GROUP,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
|
@ -109,6 +111,11 @@ gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
|
||||||
"Send EOS down the pipeline before shutting down",
|
"Send EOS down the pipeline before shutting down",
|
||||||
DEFAULT_EOS_SHUTDOWN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
DEFAULT_EOS_SHUTDOWN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_PROTOCOLS,
|
||||||
|
g_param_spec_flags ("protocols", "Protocols",
|
||||||
|
"Allowed lower transport protocols", GST_TYPE_RTSP_LOWER_TRANS,
|
||||||
|
DEFAULT_PROTOCOLS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE,
|
g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE,
|
||||||
g_param_spec_uint ("buffer-size", "Buffer Size",
|
g_param_spec_uint ("buffer-size", "Buffer Size",
|
||||||
"The kernel UDP buffer size to use", 0, G_MAXUINT,
|
"The kernel UDP buffer size to use", 0, G_MAXUINT,
|
||||||
|
@ -147,6 +154,7 @@ gst_rtsp_media_factory_init (GstRTSPMediaFactory * factory)
|
||||||
factory->launch = g_strdup (DEFAULT_LAUNCH);
|
factory->launch = g_strdup (DEFAULT_LAUNCH);
|
||||||
factory->shared = DEFAULT_SHARED;
|
factory->shared = DEFAULT_SHARED;
|
||||||
factory->eos_shutdown = DEFAULT_EOS_SHUTDOWN;
|
factory->eos_shutdown = DEFAULT_EOS_SHUTDOWN;
|
||||||
|
factory->protocols = DEFAULT_PROTOCOLS;
|
||||||
factory->buffer_size = DEFAULT_BUFFER_SIZE;
|
factory->buffer_size = DEFAULT_BUFFER_SIZE;
|
||||||
factory->multicast_group = g_strdup (DEFAULT_MULTICAST_GROUP);
|
factory->multicast_group = g_strdup (DEFAULT_MULTICAST_GROUP);
|
||||||
|
|
||||||
|
@ -189,6 +197,9 @@ gst_rtsp_media_factory_get_property (GObject * object, guint propid,
|
||||||
g_value_set_boolean (value,
|
g_value_set_boolean (value,
|
||||||
gst_rtsp_media_factory_is_eos_shutdown (factory));
|
gst_rtsp_media_factory_is_eos_shutdown (factory));
|
||||||
break;
|
break;
|
||||||
|
case PROP_PROTOCOLS:
|
||||||
|
g_value_set_flags (value, gst_rtsp_media_factory_get_protocols (factory));
|
||||||
|
break;
|
||||||
case PROP_BUFFER_SIZE:
|
case PROP_BUFFER_SIZE:
|
||||||
g_value_set_uint (value,
|
g_value_set_uint (value,
|
||||||
gst_rtsp_media_factory_get_buffer_size (factory));
|
gst_rtsp_media_factory_get_buffer_size (factory));
|
||||||
|
@ -219,6 +230,9 @@ gst_rtsp_media_factory_set_property (GObject * object, guint propid,
|
||||||
gst_rtsp_media_factory_set_eos_shutdown (factory,
|
gst_rtsp_media_factory_set_eos_shutdown (factory,
|
||||||
g_value_get_boolean (value));
|
g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_PROTOCOLS:
|
||||||
|
gst_rtsp_media_factory_set_protocols (factory, g_value_get_flags (value));
|
||||||
|
break;
|
||||||
case PROP_BUFFER_SIZE:
|
case PROP_BUFFER_SIZE:
|
||||||
gst_rtsp_media_factory_set_buffer_size (factory,
|
gst_rtsp_media_factory_set_buffer_size (factory,
|
||||||
g_value_get_uint (value));
|
g_value_get_uint (value));
|
||||||
|
@ -512,6 +526,39 @@ gst_rtsp_media_factory_get_auth (GstRTSPMediaFactory * factory)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_media_factory_set_protocols:
|
||||||
|
* @factory: a #GstRTSPMediaFactory
|
||||||
|
* @protocols: the new flags
|
||||||
|
*
|
||||||
|
* Configure the allowed lower transport for @factory.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory * factory,
|
||||||
|
GstRTSPLowerTrans protocols)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory));
|
||||||
|
|
||||||
|
factory->protocols = protocols;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_media_factory_get_protocols:
|
||||||
|
* @factory: a #GstRTSPMediaFactory
|
||||||
|
*
|
||||||
|
* Get the allowed protocols of @factory.
|
||||||
|
*
|
||||||
|
* Returns: a #GstRTSPLowerTrans
|
||||||
|
*/
|
||||||
|
GstRTSPLowerTrans
|
||||||
|
gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory * factory)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory),
|
||||||
|
GST_RTSP_LOWER_TRANS_UNKNOWN);
|
||||||
|
|
||||||
|
return factory->protocols;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
compare_media (gpointer key, GstRTSPMedia * media1, GstRTSPMedia * media2)
|
compare_media (gpointer key, GstRTSPMedia * media1, GstRTSPMedia * media2)
|
||||||
{
|
{
|
||||||
|
@ -804,6 +851,7 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
|
||||||
gboolean shared, eos_shutdown;
|
gboolean shared, eos_shutdown;
|
||||||
guint size;
|
guint size;
|
||||||
GstRTSPAuth *auth;
|
GstRTSPAuth *auth;
|
||||||
|
GstRTSPLowerTrans protocols;
|
||||||
gchar *mc;
|
gchar *mc;
|
||||||
|
|
||||||
/* configure the sharedness */
|
/* configure the sharedness */
|
||||||
|
@ -811,11 +859,13 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
|
||||||
shared = factory->shared;
|
shared = factory->shared;
|
||||||
eos_shutdown = factory->eos_shutdown;
|
eos_shutdown = factory->eos_shutdown;
|
||||||
size = factory->buffer_size;
|
size = factory->buffer_size;
|
||||||
|
protocols = factory->protocols;
|
||||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
||||||
|
|
||||||
gst_rtsp_media_set_shared (media, shared);
|
gst_rtsp_media_set_shared (media, shared);
|
||||||
gst_rtsp_media_set_eos_shutdown (media, eos_shutdown);
|
gst_rtsp_media_set_eos_shutdown (media, eos_shutdown);
|
||||||
gst_rtsp_media_set_buffer_size (media, size);
|
gst_rtsp_media_set_buffer_size (media, size);
|
||||||
|
gst_rtsp_media_set_protocols (media, protocols);
|
||||||
|
|
||||||
if ((auth = gst_rtsp_media_factory_get_auth (factory))) {
|
if ((auth = gst_rtsp_media_factory_get_auth (factory))) {
|
||||||
gst_rtsp_media_set_auth (media, auth);
|
gst_rtsp_media_set_auth (media, auth);
|
||||||
|
|
|
@ -50,8 +50,13 @@ typedef struct _GstRTSPMediaFactoryClass GstRTSPMediaFactoryClass;
|
||||||
* @lock: mutex protecting the datastructure.
|
* @lock: mutex protecting the datastructure.
|
||||||
* @launch: the launch description
|
* @launch: the launch description
|
||||||
* @shared: if media from this factory can be shared between clients
|
* @shared: if media from this factory can be shared between clients
|
||||||
* @media_lock: mutex protecting the medias.
|
* @eos_shutdown: if shutdown should first send EOS to the pipeline
|
||||||
* @media: hashtable of shared media
|
* @protocols: allowed transport protocols
|
||||||
|
* @auth: the authentication manager
|
||||||
|
* @buffer_size: the kernel udp buffer size
|
||||||
|
* @multicast_group: the multicast group to send to
|
||||||
|
* @medias_lock: mutex protecting the medias.
|
||||||
|
* @medias: hashtable of shared media
|
||||||
*
|
*
|
||||||
* The definition and logic for constructing the pipeline for a media. The media
|
* The definition and logic for constructing the pipeline for a media. The media
|
||||||
* can contain multiple streams like audio and video.
|
* can contain multiple streams like audio and video.
|
||||||
|
@ -63,6 +68,7 @@ struct _GstRTSPMediaFactory {
|
||||||
gchar *launch;
|
gchar *launch;
|
||||||
gboolean shared;
|
gboolean shared;
|
||||||
gboolean eos_shutdown;
|
gboolean eos_shutdown;
|
||||||
|
GstRTSPLowerTrans protocols;
|
||||||
GstRTSPAuth *auth;
|
GstRTSPAuth *auth;
|
||||||
guint buffer_size;
|
guint buffer_size;
|
||||||
gchar *multicast_group;
|
gchar *multicast_group;
|
||||||
|
@ -88,6 +94,8 @@ struct _GstRTSPMediaFactory {
|
||||||
* implementation will configure the 'shared' property of the media.
|
* implementation will configure the 'shared' property of the media.
|
||||||
* @create_pipeline: create a new pipeline or re-use an existing one and
|
* @create_pipeline: create a new pipeline or re-use an existing one and
|
||||||
* add the #GstRTSPMedia's element created by @construct to the pipeline.
|
* add the #GstRTSPMedia's element created by @construct to the pipeline.
|
||||||
|
* @media_constructed: signal emited when a media was cunstructed
|
||||||
|
* @media_configure: signal emited when a media should be configured
|
||||||
*
|
*
|
||||||
* The #GstRTSPMediaFactory class structure.
|
* The #GstRTSPMediaFactory class structure.
|
||||||
*/
|
*/
|
||||||
|
@ -124,6 +132,9 @@ void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFac
|
||||||
gboolean eos_shutdown);
|
gboolean eos_shutdown);
|
||||||
gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
|
gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory);
|
||||||
|
|
||||||
|
void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory, GstRTSPLowerTrans protocols);
|
||||||
|
GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);
|
||||||
|
|
||||||
void gst_rtsp_media_factory_set_auth (GstRTSPMediaFactory *factory, GstRTSPAuth *auth);
|
void gst_rtsp_media_factory_set_auth (GstRTSPMediaFactory *factory, GstRTSPAuth *auth);
|
||||||
GstRTSPAuth * gst_rtsp_media_factory_get_auth (GstRTSPMediaFactory *factory);
|
GstRTSPAuth * gst_rtsp_media_factory_get_auth (GstRTSPMediaFactory *factory);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue