From e506b8b90ff90e8ddf2519ab70ccb8ab6fbb5883 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Nov 30 2009 15:08:37 +0000 Subject: - Add support for authenticating RTSP sources --- diff --git a/0001-Add-user-id-and-user-pw-properties.patch b/0001-Add-user-id-and-user-pw-properties.patch new file mode 100644 index 0000000..8c209f0 --- /dev/null +++ b/0001-Add-user-id-and-user-pw-properties.patch @@ -0,0 +1,119 @@ +From efc611e42021de4ddfb603288b8eb3e8a3d5e66b Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Thu, 12 Nov 2009 19:11:18 +0000 +Subject: [PATCH 01/42] Add user-id and user-pw properties + +So that one doesn't need to modify the URL to have access +to authenticated RTSP streams. + +fixes #601728 +--- + gst/rtsp/gstrtspsrc.c | 38 +++++++++++++++++++++++++++++++++++++- + gst/rtsp/gstrtspsrc.h | 2 ++ + 2 files changed, 39 insertions(+), 1 deletions(-) + +diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c +index 0ed3215..fb939b6 100644 +--- a/gst/rtsp/gstrtspsrc.c ++++ b/gst/rtsp/gstrtspsrc.c +@@ -166,6 +166,8 @@ enum + PROP_DO_RTCP, + PROP_PROXY, + PROP_RTP_BLOCKSIZE, ++ PROP_USER_ID, ++ PROP_USER_PW, + PROP_LAST + }; + +@@ -387,6 +389,16 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass) + 0, 65536, DEFAULT_RTP_BLOCKSIZE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + ++ g_object_class_install_property (gobject_class, ++ PROP_USER_ID, ++ g_param_spec_string ("user-id", "user-id", ++ "RTSP location URI user id for authentication", NULL, ++ G_PARAM_READWRITE)); ++ g_object_class_install_property (gobject_class, PROP_USER_PW, ++ g_param_spec_string ("user-pw", "user-pw", ++ "RTSP location URI user password for authentication", NULL, ++ G_PARAM_READWRITE)); ++ + gstelement_class->change_state = gst_rtspsrc_change_state; + + gstbin_class->handle_message = gst_rtspsrc_handle_message; +@@ -442,6 +454,8 @@ gst_rtspsrc_finalize (GObject * object) + g_free (rtspsrc->location); + g_free (rtspsrc->req_location); + gst_rtsp_url_free (rtspsrc->url); ++ g_free (rtspsrc->user_id); ++ g_free (rtspsrc->user_pw); + + /* free locks */ + g_static_rec_mutex_free (rtspsrc->stream_rec_lock); +@@ -565,6 +579,16 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value, + case PROP_RTP_BLOCKSIZE: + rtspsrc->rtp_blocksize = g_value_get_uint (value); + break; ++ case PROP_USER_ID: ++ if (rtspsrc->user_id) ++ g_free (rtspsrc->user_id); ++ rtspsrc->user_id = g_value_dup_string (value); ++ break; ++ case PROP_USER_PW: ++ if (rtspsrc->user_pw) ++ g_free (rtspsrc->user_pw); ++ rtspsrc->user_pw = g_value_dup_string (value); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -632,6 +656,12 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value, + case PROP_RTP_BLOCKSIZE: + g_value_set_uint (value, rtspsrc->rtp_blocksize); + break; ++ case PROP_USER_ID: ++ g_value_set_string (value, rtspsrc->user_id); ++ break; ++ case PROP_USER_PW: ++ g_value_set_string (value, rtspsrc->user_pw); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -3601,12 +3631,18 @@ gst_rtspsrc_setup_auth (GstRTSPSrc * src, GstRTSPMessage * response) + url = gst_rtsp_connection_get_url (src->connection); + + /* Do we have username and password available? */ +- if (url != NULL && !src->tried_url_auth) { ++ if (url != NULL && !src->tried_url_auth && url->user != NULL ++ && url->passwd != NULL) { + user = url->user; + pass = url->passwd; + src->tried_url_auth = TRUE; + GST_DEBUG_OBJECT (src, + "Attempting authentication using credentials from the URL"); ++ } else { ++ user = src->user_id; ++ pass = src->user_pw; ++ GST_DEBUG_OBJECT (src, ++ "Attempting authentication using credentials from the properties"); + } + + /* FIXME: If the url didn't contain username and password or we tried them +diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h +index b4ed06b..18646c3 100644 +--- a/gst/rtsp/gstrtspsrc.h ++++ b/gst/rtsp/gstrtspsrc.h +@@ -194,6 +194,8 @@ struct _GstRTSPSrc { + gchar *proxy_user; + gchar *proxy_passwd; + guint rtp_blocksize; ++ gchar *user_id; ++ gchar *user_pw; + + /* state */ + GstRTSPState state; +-- +1.6.5.2 + diff --git a/gstreamer-plugins-good.spec b/gstreamer-plugins-good.spec index b8b70bf..3d1f00b 100644 --- a/gstreamer-plugins-good.spec +++ b/gstreamer-plugins-good.spec @@ -6,7 +6,7 @@ Name: %{gstreamer}-plugins-good Version: 0.10.17 -Release: 1%{?dist} +Release: 2%{?dist} Summary: GStreamer plug-ins with good code and licensing Group: Applications/Multimedia @@ -72,6 +72,9 @@ BuildRequires: automake autoconf libtool Provides: gstreamer-plugins-farsight = 0.12.12-1 Obsoletes: gstreamer-plugins-farsight < 0.12.12 +# https://bugzilla.gnome.org/show_bug.cgi?id=601728 +Patch1: 0001-Add-user-id-and-user-pw-properties.patch + %description GStreamer is a streaming media framework, based on graphs of filters which operate on media data. Applications using this library can do anything @@ -109,6 +112,7 @@ This is a dummy package to make gstreamer-plugins-good multilib. %patch0 -p1 -b .farsight libtoolize -f autoreconf +%patch1 -p1 -b .rtsp-auth %build @@ -272,6 +276,9 @@ export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/gstreamer-%{majorminor}.schemas > /dev/null || : %changelog +* Mon Nov 30 2009 Bastien Nocera 0.10.17-2 +- Add support for authenticating RTSP sources + * Tue Nov 17 2009 Bastien Nocera 0.10.17-1 - Update to 0.10.17