Commit d4b11055 authored by Pierre Ynard's avatar Pierre Ynard

rtsp: Basic authentication

parent c1e371c8
...@@ -175,6 +175,13 @@ static const char *const ppsz_protocols[] = { ...@@ -175,6 +175,13 @@ static const char *const ppsz_protocols[] = {
"negative value or zero disables timeouts. The default is 60 (one " \ "negative value or zero disables timeouts. The default is 60 (one " \
"minute)." ) "minute)." )
#define RTSP_USER_TEXT N_("Username")
#define RTSP_USER_LONGTEXT N_("User name that will be " \
"requested to access the stream." )
#define RTSP_PASS_TEXT N_("Password")
#define RTSP_PASS_LONGTEXT N_("Password that will be " \
"requested to access the stream." )
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close( vlc_object_t * ); static void Close( vlc_object_t * );
...@@ -250,6 +257,10 @@ vlc_module_begin () ...@@ -250,6 +257,10 @@ vlc_module_begin ()
RTSP_HOST_LONGTEXT, true ) RTSP_HOST_LONGTEXT, true )
add_integer( "rtsp-timeout", 60, RTSP_TIMEOUT_TEXT, add_integer( "rtsp-timeout", 60, RTSP_TIMEOUT_TEXT,
RTSP_TIMEOUT_LONGTEXT, true ) RTSP_TIMEOUT_LONGTEXT, true )
add_string( SOUT_CFG_PREFIX "user", "",
RTSP_USER_TEXT, RTSP_USER_LONGTEXT, true )
add_password( SOUT_CFG_PREFIX "pwd", "",
RTSP_PASS_TEXT, RTSP_PASS_LONGTEXT, true )
vlc_module_end () vlc_module_end ()
......
...@@ -121,8 +121,13 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media, ...@@ -121,8 +121,13 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
if( rtsp->host == NULL ) if( rtsp->host == NULL )
goto error; goto error;
char *user = var_InheritString(owner, "rtsp-user");
char *pwd = var_InheritString(owner, "rtsp-pwd");
rtsp->url = httpd_UrlNewUnique( rtsp->host, rtsp->psz_path, rtsp->url = httpd_UrlNewUnique( rtsp->host, rtsp->psz_path,
NULL, NULL, NULL ); user, pwd, NULL );
free(user);
free(pwd);
if( rtsp->url == NULL ) if( rtsp->url == NULL )
goto error; goto error;
...@@ -248,7 +253,13 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid, ...@@ -248,7 +253,13 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
} }
msg_Dbg( rtsp->owner, "RTSP: adding %s", urlbuf ); msg_Dbg( rtsp->owner, "RTSP: adding %s", urlbuf );
url = id->url = httpd_UrlNewUnique( rtsp->host, urlbuf, NULL, NULL, NULL );
char *user = var_InheritString(rtsp->owner, "rtsp-user");
char *pwd = var_InheritString(rtsp->owner, "rtsp-pwd");
url = id->url = httpd_UrlNewUnique( rtsp->host, urlbuf, user, pwd, NULL );
free( user );
free( pwd );
free( urlbuf ); free( urlbuf );
if( url == NULL ) if( url == NULL )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment