Commit 1ff5e726 authored by Gildas Bazin's avatar Gildas Bazin

* configure.ac: added an --enable-httpd and --enable-vlm option

* src/misc/httpd.c: use dummy wrapper if httpd is disabled.
* src/misc/vlm.c: use dummy wrapper if vlm is disabled.
* modules/control/http.c, telnet.c: properly handle cases where http/vlm is not available.
parent bb1ef14f
......@@ -1185,9 +1185,28 @@ then
VLC_ADD_PLUGINS([stream_out_duplicate stream_out_gather stream_out_display stream_out_transcode])
# VLC_ADD_PLUGINS([stream_out_transrate])
dnl Ogg and vorbis are handled in their respective section
AC_DEFINE(ENABLE_SOUT, 1, Define if you want the stream output support)
fi
dnl
dnl HTTP daemon
dnl
AC_ARG_ENABLE(httpd,
[ --enable-httpd HTTP daemon (default enabled)])
if test "${enable_httpd}" != "no"
then
AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP dameon support)
fi
dnl
dnl VideoLAN manager
dnl
AC_ARG_ENABLE(vlm,
[ --enable-vlm VideoLAN manager (default enabled)])
if test "${enable_vlm}" != "no"
then
AC_DEFINE(ENABLE_VLM, 1, Define if you want the VideoLAN manager support)
fi
dnl
dnl Input plugins
......@@ -1630,7 +1649,7 @@ dnl
dnl Screen capture module
dnl
AC_ARG_ENABLE(screen,
[ --enable-screen Screen capture support (default enabled)])
[ --enable-screen Screen capture support (default enabled)])
if test "${enable_screen}" != "no"; then
if test "${SYS}" = "darwin"; then
AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
......@@ -2000,7 +2019,7 @@ dnl
dnl toolame encoder plugin
dnl
AC_ARG_ENABLE(toolame,
[ --enable-toolame toolame codec (default disabled)])
[ --enable-toolame toolame codec (default disabled)])
if test "${enable_toolame}" = "yes"
then
AC_ARG_WITH(toolame-tree,
......@@ -2661,7 +2680,7 @@ dnl OpenGL module
dnl (enabled by default except on beos)
dnl
AC_ARG_ENABLE(opengl,
[ --enable-opengl OpenGL support (default enabled)])
[ --enable-opengl OpenGL support (default enabled)])
if test "${enable_opengl}" != "no" && test "${SYS}" != "beos"; then
if test "${SYS}" != "darwin"; then
AC_CHECK_HEADERS(GL/gl.h, [
......
......@@ -1124,8 +1124,8 @@ static mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm )
int i;
/* fprintf( stderr," mvar_VlmSetNew: name=`%s'\n", name ); */
if( vlm == NULL )
return s;
if( vlm == NULL ) return s;
if( vlm_ExecuteCommand( vlm, "show", &msg ) )
{
return s;
......@@ -1974,6 +1974,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
if( p_intf->p_sys->p_vlm == NULL ) break;
uri_extract_value( p_request, "name", name, 512 );
if( StrToMacroType( control ) == MVLC_VLM_NEW )
{
......@@ -2031,6 +2033,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
if( p_intf->p_sys->p_vlm == NULL ) break;
uri_extract_value( p_request, "name", name, 512 );
sprintf( psz, "del %s", name );
......@@ -2051,6 +2055,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
if( p_intf->p_sys->p_vlm == NULL ) break;
uri_extract_value( p_request, "name", name, 512 );
if( StrToMacroType( control ) == MVLC_VLM_PLAY )
sprintf( psz, "control %s play", name );
......@@ -2080,6 +2086,8 @@ static void MacroDo( httpd_file_sys_t *p_args,
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
if( p_intf->p_sys->p_vlm == NULL ) break;
uri_extract_value( p_request, "file", file, 512 );
uri_decode_url_encoded( file );
......@@ -2370,9 +2378,7 @@ static void Execute( httpd_file_sys_t *p_args,
else if( !strcmp( m.param2, "vlm" ) )
{
if( p_intf->p_sys->p_vlm == NULL )
{
p_intf->p_sys->p_vlm = vlm_New( p_intf );
}
index = mvar_VlmSetNew( m.param1, p_intf->p_sys->p_vlm );
}
#if 0
......
......@@ -116,7 +116,7 @@ struct intf_sys_t
telnet_client_t **clients;
int i_clients;
int fd;
vlm_t *mediatheque;
vlm_t *mediatheque;
};
/*****************************************************************************
......@@ -125,20 +125,18 @@ struct intf_sys_t
static int Open( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*) p_this;
vlm_t *mediatheque;
int i_telnetport;
i_telnetport = config_GetInt( p_intf, "telnet-port" );
#ifdef WIN32
vlc_bool_t b_quiet;
b_quiet = config_GetInt( p_intf, "dummy-quiet" );
if( !b_quiet )
CONSOLE_INTRO_MSG;
#endif
if( !(mediatheque = vlm_New( p_intf )) )
{
msg_Err( p_intf, "cannot start VLM" );
return VLC_EGENERIC;
}
msg_Info( p_intf, _("Using the VLM interface plugin...") );
p_intf->pf_run = Run;
i_telnetport = config_GetInt( p_intf, "telnet-port" );
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( ( p_intf->p_sys->fd = net_ListenTCP( p_intf , "", i_telnetport ) ) < 0 )
......@@ -151,7 +149,8 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->i_clients = 0;
p_intf->p_sys->clients = NULL;
p_intf->p_sys->mediatheque = vlm_New( p_intf );
p_intf->p_sys->mediatheque = mediatheque;
p_intf->pf_run = Run;
return VLC_SUCCESS;
}
......
......@@ -25,6 +25,8 @@
#include <stdlib.h>
#include <vlc/vlc.h>
#ifdef ENABLE_HTTPD
#include "vlc_httpd.h"
#include "network.h"
......@@ -376,6 +378,7 @@ static struct
{ ".jpg", "image/jpeg" },
{ ".jpeg", "image/jpeg" },
{ ".png", "image/png" },
{ ".mpjpeg","multipart/x-mixed-replace; boundary=This Random String" },
/* media mime */
{ ".avi", "video/avi" },
......@@ -2471,3 +2474,45 @@ static int GetAddrPort( const struct sockaddr_storage *p_ss )
return ntohs( i_port );
}
#else /* ENABLE_HTTPD */
/* We just define an empty wrapper */
httpd_host_t *httpd_HostNew( vlc_object_t *a, char *b, int c )
{
msg_Err( a, "HTTP daemon support is disabled" );
return 0;
}
void httpd_HostDelete( httpd_host_t *a ){}
httpd_url_t *httpd_UrlNew( httpd_host_t *a, char *b ){ return 0; }
httpd_url_t *httpd_UrlNewUnique( httpd_host_t *a, char *b, char *c,
char *d ){ return 0; }
int httpd_UrlCatch( httpd_url_t *a, int b, httpd_callback_t c,
httpd_callback_sys_t *d ){ return 0; }
void httpd_UrlDelete( httpd_url_t *a ){}
char *httpd_ClientIP( httpd_client_t *a ){ return 0; }
void httpd_ClientModeStream( httpd_client_t *a ){}
void httpd_ClientModeBidir( httpd_client_t *a ){}
void httpd_FileDelete( httpd_file_t *a ){}
httpd_file_t *httpd_FileNew( httpd_host_t *a, char *b, char *c, char *d,
char *e, httpd_file_callback_t f,
httpd_file_sys_t *g ){ return 0; }
void httpd_RedirectDelete( httpd_redirect_t *a ){}
httpd_redirect_t *httpd_RedirectNew( httpd_host_t *a,
char *b, char *c ){ return 0; }
void httpd_StreamDelete( httpd_stream_t *a ){}
int httpd_StreamHeader( httpd_stream_t *a, uint8_t *b, int c ){ return 0; }
int httpd_StreamSend ( httpd_stream_t *a, uint8_t *b, int c ){ return 0; }
httpd_stream_t *httpd_StreamNew( httpd_host_t *a, char *b, char *c,
char *d, char *e ){ return 0; }
void httpd_MsgInit ( httpd_message_t *a ){}
void httpd_MsgAdd ( httpd_message_t *a, char *b, char *c, ... ){}
char *httpd_MsgGet ( httpd_message_t *a, char *b ){ return 0; }
void httpd_MsgClean( httpd_message_t *a ){}
#endif /* ENABLE_HTTPD */
......@@ -29,6 +29,9 @@
#include <stdlib.h> /* malloc(), free() */
#include <vlc/vlc.h>
#ifdef ENABLE_VLM
#include <vlc/intf.h>
#include <vlc/input.h>
......@@ -2133,3 +2136,17 @@ static int Manage( vlc_object_t* p_object )
return VLC_SUCCESS;
}
#else /* ENABLE_VLM */
/* We just define an empty wrapper */
vlm_t *__vlm_New( vlc_object_t *a )
{
msg_Err( a, "VideoLAN manager support is disabled" );
return 0;
}
void vlm_Delete( vlm_t *a ){}
int vlm_ExecuteCommand( vlm_t *a, char *b, vlm_message_t **c ){ return -1; }
void vlm_MessageDelete( vlm_message_t *a ){}
#endif /* ENABLE_VLM */
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