factory: add profile property and pass to media and streams

This commit is contained in:
Wim Taymans 2014-03-03 16:55:48 +01:00
parent 2bd90b539c
commit 4b74afcc78
3 changed files with 75 additions and 0 deletions

View file

@ -53,6 +53,7 @@ struct _GstRTSPMediaFactoryPrivate
gboolean shared; gboolean shared;
GstRTSPSuspendMode suspend_mode; GstRTSPSuspendMode suspend_mode;
gboolean eos_shutdown; gboolean eos_shutdown;
GstRTSPProfile profiles;
GstRTSPLowerTrans protocols; GstRTSPLowerTrans protocols;
guint buffer_size; guint buffer_size;
GstRTSPAddressPool *pool; GstRTSPAddressPool *pool;
@ -65,6 +66,7 @@ struct _GstRTSPMediaFactoryPrivate
#define DEFAULT_SHARED FALSE #define DEFAULT_SHARED FALSE
#define DEFAULT_SUSPEND_MODE GST_RTSP_SUSPEND_MODE_NONE #define DEFAULT_SUSPEND_MODE GST_RTSP_SUSPEND_MODE_NONE
#define DEFAULT_EOS_SHUTDOWN FALSE #define DEFAULT_EOS_SHUTDOWN FALSE
#define DEFAULT_PROFILES GST_RTSP_PROFILE_AVP
#define DEFAULT_PROTOCOLS GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | \ #define DEFAULT_PROTOCOLS GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | \
GST_RTSP_LOWER_TRANS_TCP GST_RTSP_LOWER_TRANS_TCP
#define DEFAULT_BUFFER_SIZE 0x80000 #define DEFAULT_BUFFER_SIZE 0x80000
@ -76,6 +78,7 @@ enum
PROP_SHARED, PROP_SHARED,
PROP_SUSPEND_MODE, PROP_SUSPEND_MODE,
PROP_EOS_SHUTDOWN, PROP_EOS_SHUTDOWN,
PROP_PROFILES,
PROP_PROTOCOLS, PROP_PROTOCOLS,
PROP_BUFFER_SIZE, PROP_BUFFER_SIZE,
PROP_LAST PROP_LAST
@ -161,6 +164,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_PROFILES,
g_param_spec_flags ("profiles", "Profiles",
"Allowed transfer profiles", GST_TYPE_RTSP_PROFILE,
DEFAULT_PROFILES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROTOCOLS, g_object_class_install_property (gobject_class, PROP_PROTOCOLS,
g_param_spec_flags ("protocols", "Protocols", g_param_spec_flags ("protocols", "Protocols",
"Allowed lower transport protocols", GST_TYPE_RTSP_LOWER_TRANS, "Allowed lower transport protocols", GST_TYPE_RTSP_LOWER_TRANS,
@ -204,6 +212,7 @@ gst_rtsp_media_factory_init (GstRTSPMediaFactory * factory)
priv->shared = DEFAULT_SHARED; priv->shared = DEFAULT_SHARED;
priv->suspend_mode = DEFAULT_SUSPEND_MODE; priv->suspend_mode = DEFAULT_SUSPEND_MODE;
priv->eos_shutdown = DEFAULT_EOS_SHUTDOWN; priv->eos_shutdown = DEFAULT_EOS_SHUTDOWN;
priv->profiles = DEFAULT_PROFILES;
priv->protocols = DEFAULT_PROTOCOLS; priv->protocols = DEFAULT_PROTOCOLS;
priv->buffer_size = DEFAULT_BUFFER_SIZE; priv->buffer_size = DEFAULT_BUFFER_SIZE;
@ -252,6 +261,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_PROFILES:
g_value_set_flags (value, gst_rtsp_media_factory_get_profiles (factory));
break;
case PROP_PROTOCOLS: case PROP_PROTOCOLS:
g_value_set_flags (value, gst_rtsp_media_factory_get_protocols (factory)); g_value_set_flags (value, gst_rtsp_media_factory_get_protocols (factory));
break; break;
@ -285,6 +297,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_PROFILES:
gst_rtsp_media_factory_set_profiles (factory, g_value_get_flags (value));
break;
case PROP_PROTOCOLS: case PROP_PROTOCOLS:
gst_rtsp_media_factory_set_protocols (factory, g_value_get_flags (value)); gst_rtsp_media_factory_set_protocols (factory, g_value_get_flags (value));
break; break;
@ -706,6 +721,56 @@ gst_rtsp_media_factory_get_address_pool (GstRTSPMediaFactory * factory)
return result; return result;
} }
/**
* gst_rtsp_media_factory_set_profiles:
* @factory: a #GstRTSPMediaFactory
* @profiles: the new flags
*
* Configure the allowed profiles for @factory.
*/
void
gst_rtsp_media_factory_set_profiles (GstRTSPMediaFactory * factory,
GstRTSPProfile profiles)
{
GstRTSPMediaFactoryPrivate *priv;
g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory));
priv = factory->priv;
GST_DEBUG_OBJECT (factory, "profiles %d", profiles);
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
priv->profiles = profiles;
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
}
/**
* gst_rtsp_media_factory_get_profiles:
* @factory: a #GstRTSPMediaFactory
*
* Get the allowed profiles of @factory.
*
* Returns: a #GstRTSPProfile
*/
GstRTSPProfile
gst_rtsp_media_factory_get_profiles (GstRTSPMediaFactory * factory)
{
GstRTSPMediaFactoryPrivate *priv;
GstRTSPProfile res;
g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory),
GST_RTSP_PROFILE_UNKNOWN);
priv = factory->priv;
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
res = priv->profiles;
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
return res;
}
/** /**
* gst_rtsp_media_factory_set_protocols: * gst_rtsp_media_factory_set_protocols:
* @factory: a #GstRTSPMediaFactory * @factory: a #GstRTSPMediaFactory
@ -723,6 +788,8 @@ gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory * factory,
priv = factory->priv; priv = factory->priv;
GST_DEBUG_OBJECT (factory, "protocols %d", protocols);
GST_RTSP_MEDIA_FACTORY_LOCK (factory); GST_RTSP_MEDIA_FACTORY_LOCK (factory);
priv->protocols = protocols; priv->protocols = protocols;
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory); GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
@ -1012,6 +1079,7 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
gboolean shared, eos_shutdown; gboolean shared, eos_shutdown;
guint size; guint size;
GstRTSPSuspendMode suspend_mode; GstRTSPSuspendMode suspend_mode;
GstRTSPProfile profiles;
GstRTSPLowerTrans protocols; GstRTSPLowerTrans protocols;
GstRTSPAddressPool *pool; GstRTSPAddressPool *pool;
GstRTSPPermissions *perms; GstRTSPPermissions *perms;
@ -1022,6 +1090,7 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
shared = priv->shared; shared = priv->shared;
eos_shutdown = priv->eos_shutdown; eos_shutdown = priv->eos_shutdown;
size = priv->buffer_size; size = priv->buffer_size;
profiles = priv->profiles;
protocols = priv->protocols; protocols = priv->protocols;
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory); GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
@ -1029,6 +1098,7 @@ default_configure (GstRTSPMediaFactory * factory, GstRTSPMedia * media)
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_profiles (media, profiles);
gst_rtsp_media_set_protocols (media, protocols); gst_rtsp_media_set_protocols (media, protocols);
if ((pool = gst_rtsp_media_factory_get_address_pool (factory))) { if ((pool = gst_rtsp_media_factory_get_address_pool (factory))) {

View file

@ -126,6 +126,10 @@ void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFacto
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_profiles (GstRTSPMediaFactory *factory,
GstRTSPProfile profiles);
GstRTSPProfile gst_rtsp_media_factory_get_profiles (GstRTSPMediaFactory *factory);
void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory, void gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory,
GstRTSPLowerTrans protocols); GstRTSPLowerTrans protocols);
GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory); GstRTSPLowerTrans gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);

View file

@ -1250,6 +1250,7 @@ gst_rtsp_media_create_stream (GstRTSPMedia * media, GstElement * payloader,
stream = gst_rtsp_stream_new (idx, payloader, srcpad); stream = gst_rtsp_stream_new (idx, payloader, srcpad);
if (priv->pool) if (priv->pool)
gst_rtsp_stream_set_address_pool (stream, priv->pool); gst_rtsp_stream_set_address_pool (stream, priv->pool);
gst_rtsp_stream_set_profiles (stream, priv->profiles);
gst_rtsp_stream_set_protocols (stream, priv->protocols); gst_rtsp_stream_set_protocols (stream, priv->protocols);
g_ptr_array_add (priv->streams, stream); g_ptr_array_add (priv->streams, stream);