From: Wim Taymans Date: Wed, 12 Jan 2011 11:07:40 +0000 (+0100) Subject: media-factory: add methods to configure authorisation X-Git-Tag: 1.19.3~495^2~1387^2~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ea0346d97e6cc19c57783c1a55eb74094ca0084;p=platform%2Fupstream%2Fgstreamer.git media-factory: add methods to configure authorisation --- diff --git a/gst/rtsp-server/rtsp-media-factory.c b/gst/rtsp-server/rtsp-media-factory.c index d5c63bc..dd0ef79 100644 --- a/gst/rtsp-server/rtsp-media-factory.c +++ b/gst/rtsp-server/rtsp-media-factory.c @@ -127,6 +127,8 @@ gst_rtsp_media_factory_finalize (GObject * obj) g_mutex_free (factory->medias_lock); g_free (factory->launch); g_mutex_free (factory->lock); + if (factory->auth) + g_object_unref (factory->auth); G_OBJECT_CLASS (gst_rtsp_media_factory_parent_class)->finalize (obj); } @@ -326,6 +328,56 @@ gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory * factory) return result; } +/** + * gst_rtsp_media_factory_set_auth: + * @factory: a #GstRTSPMediaFactory + * @auth: a #GstRTSPAuth + * + * configure @auth to be used as the authentication manager of @factory. + */ +void +gst_rtsp_media_factory_set_auth (GstRTSPMediaFactory * factory, + GstRTSPAuth * auth) +{ + GstRTSPAuth *old; + + g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory)); + + old = factory->auth; + + if (old != auth) { + if (auth) + g_object_ref (auth); + factory->auth = auth; + if (old) + g_object_unref (old); + } +} + + +/** + * gst_rtsp_media_factory_get_auth: + * @factory: a #GstRTSPMediaFactory + * + * Get the #GstRTSPAuth used as the authentication manager of @factory. + * + * Returns: the #GstRTSPAuth of @factory. g_object_unref() after + * usage. + */ +GstRTSPAuth * +gst_rtsp_factory_get_auth (GstRTSPMediaFactory * factory) +{ + GstRTSPAuth *result; + + g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), NULL); + + if ((result = factory->auth)) + g_object_ref (result); + + return result; +} + + static gboolean compare_media (gpointer key, GstRTSPMedia * media1, GstRTSPMedia * media2) { diff --git a/gst/rtsp-server/rtsp-media-factory.h b/gst/rtsp-server/rtsp-media-factory.h index 4d64876..a06a48d 100644 --- a/gst/rtsp-server/rtsp-media-factory.h +++ b/gst/rtsp-server/rtsp-media-factory.h @@ -21,6 +21,7 @@ #include #include "rtsp-media.h" +#include "rtsp-auth.h" #ifndef __GST_RTSP_MEDIA_FACTORY_H__ #define __GST_RTSP_MEDIA_FACTORY_H__ @@ -62,6 +63,7 @@ struct _GstRTSPMediaFactory { gchar *launch; gboolean shared; gboolean eos_shutdown; + GstRTSPAuth *auth; GMutex *medias_lock; GHashTable *medias; @@ -116,6 +118,10 @@ void gst_rtsp_media_factory_set_eos_shutdown (GstRTSPMediaFac gboolean eos_shutdown); gboolean gst_rtsp_media_factory_is_eos_shutdown (GstRTSPMediaFactory *factory); +void gst_rtsp_media_factory_set_auth (GstRTSPMediaFactory *factory, GstRTSPAuth *auth); +GstRTSPAuth * gst_rtsp_media_factory_get_auth (GstRTSPMediaFactory *factory); + + /* creating the media from the factory and a url */ GstRTSPMedia * gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);