[vlc-commits] Use separate functions for RTSP and HTTP hosts
Rémi Denis-Courmont
git at videolan.org
Tue Aug 2 18:19:24 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 2 18:37:19 2011 +0300| [e5c2a63d04075e767924ee7cbf9cc0b1538fb329] | committer: Rémi Denis-Courmont
Use separate functions for RTSP and HTTP hosts
Also prefix with vlc_ for namespace cleanliness.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5c2a63d04075e767924ee7cbf9cc0b1538fb329
---
include/vlc_httpd.h | 5 +++--
modules/access/dvb/http.c | 4 ++--
modules/access_output/http.c | 8 ++++----
modules/lua/libs/httpd.c | 2 +-
modules/misc/rtsp.c | 2 +-
modules/stream_out/rtp.c | 2 +-
modules/stream_out/rtsp.c | 4 ++--
src/libvlccore.sym | 5 +++--
src/missing.c | 13 ++++++++++---
src/network/httpd.c | 12 +++++++++---
10 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/include/vlc_httpd.h b/include/vlc_httpd.h
index f636ca2..32c7c25 100644
--- a/include/vlc_httpd.h
+++ b/include/vlc_httpd.h
@@ -99,8 +99,9 @@ struct httpd_message_t
};
/* create a new host */
-VLC_API httpd_host_t * httpd_HostNew( vlc_object_t *, const char *psz_host, int i_port ) VLC_USED;
-VLC_API httpd_host_t * httpd_TLSHostNew( vlc_object_t *, const char *, int ) VLC_USED;
+VLC_API httpd_host_t *vlc_http_HostNew( vlc_object_t *, const char *psz_host, int i_port ) VLC_USED;
+VLC_API httpd_host_t *vlc_https_HostNew( vlc_object_t *, const char *, int ) VLC_USED;
+VLC_API httpd_host_t *vlc_rtsp_HostNew( vlc_object_t *, const char *, int ) VLC_USED;
/* delete a host */
VLC_API void httpd_HostDelete( httpd_host_t * );
diff --git a/modules/access/dvb/http.c b/modules/access/dvb/http.c
index c30a718..dd00a48 100644
--- a/modules/access/dvb/http.c
+++ b/modules/access/dvb/http.c
@@ -96,8 +96,8 @@ int HTTPOpen( access_t *p_access )
msg_Dbg( p_access, "base %s:%d", psz_address, i_port );
- p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_access), psz_address,
- i_port );
+ p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_access), psz_address,
+ i_port );
if ( p_sys->p_httpd_host == NULL )
{
msg_Err( p_access, "cannot listen on %s:%d", psz_address, i_port );
diff --git a/modules/access_output/http.c b/modules/access_output/http.c
index 226d775..ec8fcce 100644
--- a/modules/access_output/http.c
+++ b/modules/access_output/http.c
@@ -190,15 +190,15 @@ static int Open( vlc_object_t *p_this )
{
if( i_bind_port <= 0 )
i_bind_port = DEFAULT_SSL_PORT;
- p_sys->p_httpd_host = httpd_TLSHostNew( VLC_OBJECT(p_access),
- psz_bind_addr, i_bind_port );
+ p_sys->p_httpd_host = vlc_https_HostNew( VLC_OBJECT(p_access),
+ psz_bind_addr, i_bind_port );
}
else
{
if( i_bind_port <= 0 )
i_bind_port = DEFAULT_PORT;
- p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_access),
- psz_bind_addr, i_bind_port );
+ p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_access),
+ psz_bind_addr, i_bind_port );
}
if( p_sys->p_httpd_host == NULL )
diff --git a/modules/lua/libs/httpd.c b/modules/lua/libs/httpd.c
index 70430a3..e502719 100644
--- a/modules/lua/libs/httpd.c
+++ b/modules/lua/libs/httpd.c
@@ -70,7 +70,7 @@ static int vlclua_httpd_tls_host_new( lua_State *L )
vlc_object_t *p_this = vlclua_get_this( L );
const char *psz_host = luaL_checkstring( L, 1 );
int i_port = luaL_checkint( L, 2 );
- httpd_host_t *p_host = httpd_HostNew( p_this, psz_host, i_port );
+ httpd_host_t *p_host = vlc_http_HostNew( p_this, psz_host, i_port );
if( !p_host )
return luaL_error( L, "Failed to create HTTP host \"%s:%d\" ",
psz_host, i_port );
diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c
index 1ba5aea..8157785 100644
--- a/modules/misc/rtsp.c
+++ b/modules/misc/rtsp.c
@@ -282,7 +282,7 @@ static int Open( vlc_object_t *p_this )
p_sys->psz_raw_mux = var_CreateGetString( p_this, "rtsp-raw-mux" );
p_sys->p_rtsp_host =
- httpd_HostNew( VLC_OBJECT(p_vod), url.psz_host, url.i_port );
+ vlc_rtsp_HostNew( VLC_OBJECT(p_vod), url.psz_host, url.i_port );
if( !p_sys->p_rtsp_host )
{
msg_Err( p_vod, "cannot create RTSP server (%s:%i)",
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index b12b34e..cc8b62b 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1320,7 +1320,7 @@ static int HttpSetup( sout_stream_t *p_stream, const vlc_url_t *url)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- p_sys->p_httpd_host = httpd_HostNew( VLC_OBJECT(p_stream), url->psz_host,
+ p_sys->p_httpd_host = vlc_http_HostNew( VLC_OBJECT(p_stream), url->psz_host,
url->i_port > 0 ? url->i_port : 80 );
if( p_sys->p_httpd_host )
{
diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 6a8534a..1ab9ad5 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -120,8 +120,8 @@ rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
msg_Dbg( owner, "RTSP stream: host %s port %d at %s",
url->psz_host, rtsp->port, rtsp->psz_path );
- rtsp->host = httpd_HostNew( VLC_OBJECT(owner), url->psz_host,
- rtsp->port );
+ rtsp->host = vlc_rtsp_HostNew( VLC_OBJECT(owner), url->psz_host,
+ rtsp->port );
if( rtsp->host == NULL )
goto error;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 2a75e79..a7673aa 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -159,7 +159,9 @@ httpd_FileNew
httpd_HandlerDelete
httpd_HandlerNew
httpd_HostDelete
-httpd_HostNew
+vlc_http_HostNew
+vlc_https_HostNew
+vlc_rtsp_HostNew
httpd_MsgAdd
httpd_MsgGet
httpd_RedirectDelete
@@ -169,7 +171,6 @@ httpd_StreamDelete
httpd_StreamHeader
httpd_StreamNew
httpd_StreamSend
-httpd_TLSHostNew
httpd_UrlCatch
httpd_UrlDelete
httpd_UrlNew
diff --git a/src/missing.c b/src/missing.c
index ce318c5..a2832d1 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -93,18 +93,25 @@ void httpd_HostDelete (httpd_host_t *h)
assert (0);
}
-httpd_host_t *httpd_HostNew (vlc_object_t *obj, const char *host, int port)
+httpd_host_t *vlc_http_HostNew (vlc_object_t *obj, const char *host, int port)
{
(void) host; (void) port;
- msg_Err (obj, "VLC httpd support not compiled-in!");
+ msg_Err (obj, "HTTP server not compiled-in!");
return NULL;
}
-httpd_host_t *httpd_TLSHostNew (vlc_object_t *obj, const char *host, int port)
+httpd_host_t *vlc_https_HostNew (vlc_object_t *obj, const char *host, int port)
{
return httpd_HostNew (obj, host, port);
}
+httpd_host_t *vlc_rtsp_HostNew (vlc_object_t *obj, const char *host, int port)
+{
+ (void) host; (void) port;
+ msg_Err (obj, "RTSP server not compiled-in!");
+ return NULL;
+}
+
void httpd_MsgAdd (httpd_message_t *m, const char *name, const char *fmt, ...)
{
(void) m; (void) name; (void) fmt;
diff --git a/src/network/httpd.c b/src/network/httpd.c
index fa495b7..1cafa7a 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -968,13 +968,13 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *, const char *, int,
vlc_tls_creds_t * );
/* create a new host */
-httpd_host_t *httpd_HostNew( vlc_object_t *p_this, const char *psz_host,
- int i_port )
+httpd_host_t *vlc_http_HostNew( vlc_object_t *p_this, const char *psz_host,
+ int i_port )
{
return httpd_HostCreate( p_this, psz_host, i_port, NULL );
}
-httpd_host_t *httpd_TLSHostNew( vlc_object_t *obj, const char *host, int port )
+httpd_host_t *vlc_https_HostNew( vlc_object_t *obj, const char *host, int port )
{
char *cert = var_InheritString( obj, "http-cert" );
if( cert == NULL )
@@ -1028,6 +1028,12 @@ error:
return NULL;
}
+httpd_host_t *vlc_rtsp_HostNew( vlc_object_t *p_this, const char *psz_host,
+ int i_port )
+{
+ return httpd_HostCreate( p_this, psz_host, i_port, NULL );
+}
+
static vlc_mutex_t httpd_mutex = VLC_STATIC_MUTEX;
static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
More information about the vlc-commits
mailing list