From ba894d9bb3961c1ea8a46ea5e8f3cb22e1346a3e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Stenac?= Date: Tue, 29 Nov 2005 22:22:14 +0000 Subject: [PATCH] Remove SLP (Closes:#434) --- configure.ac | 37 -------- include/stream_output.h | 1 - modules/stream_out/Modules.am | 4 +- modules/stream_out/announce.c | 172 ---------------------------------- modules/stream_out/announce.h | 52 ---------- modules/stream_out/standard.c | 57 +---------- src/stream_output/announce.c | 7 +- 7 files changed, 4 insertions(+), 326 deletions(-) delete mode 100644 modules/stream_out/announce.c delete mode 100644 modules/stream_out/announce.h diff --git a/configure.ac b/configure.ac index 5c08e11d80..d61e27a71d 100644 --- a/configure.ac +++ b/configure.ac @@ -4520,43 +4520,6 @@ then fi fi -dnl -dnl SLP access plugin -dnl -AC_ARG_ENABLE(slp, - [ --enable-slp SLP service discovery support (default disabled)]) -if test "${enable_slp}" = "yes" -then - AC_ARG_WITH(slp, - [ --with-slp=PATH libslp headers and libraries]) - if test -z "${with_slp}" - then - AC_CHECK_HEADERS(slp.h, have_slp="true", have_slp="false") - if test "${have_slp}" = "true" - then - VLC_ADD_PLUGINS([slp]) - VLC_ADD_LDFLAGS([slp],[-lslp]) - VLC_ADD_LDFLAGS([stream_out_standard],[-lslp]) - fi - else - AC_MSG_CHECKING(for slp headers in ${with_slp}) - if test -f ${with_slp}/slp.h - then - dnl Use ${with_slp}/libslp/slp.h - AC_MSG_RESULT(yes) - VLC_ADD_PLUGINS([slp]) - VLC_ADD_LDFLAGS([slp],[-L${with_slp} -lslp]) - VLC_ADD_LDFLAGS([stream_out_standard],[-L${with_slp} -lslp]) - VLC_ADD_CPPFLAGS([slp],[-I${with_slp}]) - AC_DEFINE(HAVE_SLP_H) - else - dnl No libslp could be found, sorry - AC_MSG_RESULT(no) - AC_MSG_ERROR([cannot find ${with_slp}/slp.h]) - fi - fi -fi - dnl dnl DAAP access plugin and services discovery dnl diff --git a/include/stream_output.h b/include/stream_output.h index aa3ec008ad..07e6b7786a 100644 --- a/include/stream_output.h +++ b/include/stream_output.h @@ -257,7 +257,6 @@ struct session_descriptor_t }; #define METHOD_TYPE_SAP 1 -#define METHOD_TYPE_SLP 2 struct announce_method_t { diff --git a/modules/stream_out/Modules.am b/modules/stream_out/Modules.am index a1c03bcf25..69dd910d6c 100644 --- a/modules/stream_out/Modules.am +++ b/modules/stream_out/Modules.am @@ -1,8 +1,6 @@ SOURCES_stream_out_dummy = dummy.c SOURCES_stream_out_description = description.c -SOURCES_stream_out_standard = standard.c \ - announce.c \ - announce.h +SOURCES_stream_out_standard = standard.c SOURCES_stream_out_transcode = transcode.c SOURCES_stream_out_duplicate = duplicate.c SOURCES_stream_out_es = es.c diff --git a/modules/stream_out/announce.c b/modules/stream_out/announce.c deleted file mode 100644 index ba16abed21..0000000000 --- a/modules/stream_out/announce.c +++ /dev/null @@ -1,172 +0,0 @@ -/***************************************************************************** - * announce.c : Session announcement - ***************************************************************************** - * Copyright (C) 2002 the VideoLAN team - * - * Authors: Clément Stenac - * Damien Lucas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#include /* free() */ - -#include /* ENOMEM */ -#include /* sprintf() */ - -#include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef WIN32 -# include -# include -# ifndef IN_MULTICAST -# define IN_MULTICAST(a) IN_CLASSD(a) -# endif -#else -# include -#endif - -#ifdef HAVE_SLP_H -# include -#endif - -#include "announce.h" -#include "network.h" - -#define DEFAULT_PORT 1234 - -#ifdef HAVE_SLP_H -/***************************************************************************** - * sout_SLPBuildName: Builds a service name according to SLP standard - *****************************************************************************/ -static char * sout_SLPBuildName(char *psz_url,char *psz_name) -{ - char *psz_service; - unsigned int i_size; - - /* name to build is: service:vlc.services.videolan://$(url) */ - - i_size = 8 + 12 + 12 + 5 + strlen(psz_url) + 1; - - psz_service=(char *)malloc(i_size * sizeof(char)); - - snprintf( psz_service , i_size, - "service:vlc.services.videolan://udp:@%s", - psz_url); - /* How piggy ! */ - - psz_service[i_size]='\0'; /* Just to make sure */ - - return psz_service; - -} - -/***************************************************************************** - * sout_SLPReport: Reporting function. Unused at the moment but needed - *****************************************************************************/ -static void sout_SLPReport(SLPHandle slp_handle,SLPError slp_error,void* cookie) -{ -} -#endif - -/***************************************************************************** - * sout_SLPReg: Registers the program with SLP - *****************************************************************************/ -int sout_SLPReg( sout_instance_t *p_sout, char * psz_url, - char * psz_name) -{ -#ifdef HAVE_SLP_H - SLPHandle slp_handle; - SLPError slp_res; - char *psz_service= sout_SLPBuildName(psz_url,psz_name); - - if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK) - { - msg_Warn(p_sout,"Unable to initialize SLP"); - return -1; - } - - msg_Info(p_sout , "Registering %s (name: %s) in SLP", - psz_service , psz_name); - - slp_res = SLPReg ( slp_handle, - psz_service, - SLP_LIFETIME_MAXIMUM, - NULL, - psz_name, - SLP_TRUE, - sout_SLPReport, - NULL ); - - if( slp_res != SLP_OK ) - { - msg_Warn(p_sout,"Error while registering service: %i", slp_res ); - return -1; - } - - return 0; - -#else /* This function should never be called if this is false */ - return -1; -#endif -} - - -/***************************************************************************** - * sout_SLDePReg: Unregisters the program from SLP - *****************************************************************************/ -int sout_SLPDereg( sout_instance_t *p_sout, char * psz_url, - char * psz_name) -{ -#ifdef HAVE_SLP_H - - SLPHandle slp_handle; - SLPError slp_res; - char *psz_service= sout_SLPBuildName(psz_url,psz_name); - - if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK) - { - msg_Warn(p_sout,"Unable to initialize SLP"); - return -1; - } - - msg_Info(p_sout , "Unregistering %s from SLP", - psz_service); - - slp_res = SLPDereg ( slp_handle, - psz_service, - sout_SLPReport, - NULL ); - - if( slp_res != SLP_OK ) - { - msg_Warn(p_sout,"Error while registering service: %i", slp_res ); - return -1; - } - - return 0; - -#else /* This function should never be called if this is false */ - return -1; -#endif -} diff --git a/modules/stream_out/announce.h b/modules/stream_out/announce.h deleted file mode 100644 index 902bed0c31..0000000000 --- a/modules/stream_out/announce.h +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************** - * announce.h : Session announcement - ***************************************************************************** - * Copyright (C) 2002 the VideoLAN team - * $Id$ - * - * Authors: Clément Stenac - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ - -#ifdef HAVE_SLP_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -/***************************************************************************** - * slp_session_t: SLP Session descriptor - *****************************************************************************/ -struct slp_session_t -{ - char *psz_url; - char *psz_name; -}; - -typedef struct slp_session_t slp_session_t; - -/***************************************************************************** - * Prototypes - *****************************************************************************/ -int sout_SLPReg (sout_instance_t *,char *,char *); -int sout_SLPDereg (sout_instance_t *,char *,char *); - diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c index f5ce08cd25..5a18b7e184 100644 --- a/modules/stream_out/standard.c +++ b/modules/stream_out/standard.c @@ -34,7 +34,6 @@ # include #endif -#include "announce.h" #include "network.h" /***************************************************************************** @@ -59,7 +58,7 @@ #define NAME_TEXT N_("Session name") #define NAME_LONGTEXT N_( \ - "Name of the session that will be announced with SAP or SLP" ) + "Name of the session that will be announced with SAP" ) #define GROUP_TEXT N_("Session groupname") #define GROUP_LONGTEXT N_( \ @@ -68,9 +67,6 @@ #define SAP_TEXT N_("SAP announcing") #define SAP_LONGTEXT N_("Announce this session with SAP") -#define SLP_TEXT N_("SLP announcing") -#define SLP_LONGTEXT N_("Announce this session with SLP") - static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); @@ -101,8 +97,6 @@ vlc_module_begin(); VLC_TRUE ); add_suppressed_bool( SOUT_CFG_PREFIX "sap-ipv6" ); - add_bool( SOUT_CFG_PREFIX "slp", 0, NULL, SLP_TEXT, SLP_LONGTEXT, VLC_TRUE ); - set_callbacks( Open, Close ); vlc_module_end(); @@ -112,7 +106,7 @@ vlc_module_end(); *****************************************************************************/ static const char *ppsz_sout_options[] = { "access", "mux", "url", "dst", - "sap", "name", "group", "slp", NULL + "sap", "name", "group", NULL }; #define DEFAULT_PORT 1234 @@ -124,7 +118,6 @@ static int Send( sout_stream_t *, sout_stream_id_t *, block_t* ); struct sout_stream_sys_t { sout_mux_t *p_mux; - slp_session_t *p_slp; session_descriptor_t *p_session; }; @@ -135,7 +128,6 @@ static int Open( vlc_object_t *p_this ) { sout_stream_t *p_stream = (sout_stream_t*)p_this; sout_instance_t *p_sout = p_stream->p_sout; - slp_session_t *p_slp = NULL; char *psz_mux; char *psz_access; @@ -384,46 +376,11 @@ static int Open( vlc_object_t *p_this ) free( p_method ); } - /* *** Register with slp *** */ -#ifdef HAVE_SLP_H - var_Get( p_stream, SOUT_CFG_PREFIX "slp", &val ); - if( val.b_bool && - ( strstr( psz_access, "udp" ) || strstr( psz_access , "rtp" ) ) ) - { - int i_ret; - - msg_Info( p_this, "SLP Enabled"); - var_Get( p_stream, SOUT_CFG_PREFIX "name", &val ); - if( *val.psz_string ) - { - i_ret = sout_SLPReg( p_sout, psz_url, val.psz_string ); - } - else - { - i_ret = sout_SLPReg( p_sout, psz_url, psz_url ); - } - - if( i_ret ) - { - msg_Warn( p_sout, "SLP Registering failed"); - } - else - { - p_slp = malloc(sizeof(slp_session_t)); - p_slp->psz_url = strdup( psz_url ); - p_slp->psz_name = - strdup( *val.psz_string ? val.psz_string : psz_url ); - } - free( val.psz_string ); - } -#endif - p_stream->pf_add = Add; p_stream->pf_del = Del; p_stream->pf_send = Send; p_stream->p_sys->p_mux = p_mux; - p_stream->p_sys->p_slp = p_slp; if( psz_access ) free( psz_access ); if( psz_mux ) free( psz_mux ); @@ -448,16 +405,6 @@ static void Close( vlc_object_t * p_this ) sout_AnnounceSessionDestroy( p_sys->p_session ); } -#ifdef HAVE_SLP_H - if( p_sys->p_slp ) - { - sout_SLPDereg( (sout_instance_t *)p_this, - p_sys->p_slp->psz_url, - p_sys->p_slp->psz_name); - free( p_sys->p_slp); - } -#endif - sout_MuxDelete( p_sys->p_mux ); sout_AccessOutDelete( p_access ); diff --git a/src/stream_output/announce.c b/src/stream_output/announce.c index 90bd8142fc..be1964f2ae 100644 --- a/src/stream_output/announce.c +++ b/src/stream_output/announce.c @@ -194,7 +194,7 @@ void sout_AnnounceSessionDestroy( session_descriptor_t *p_session ) /** * Create and initialize an announcement method structure * - * \param i_type METHOD_TYPE_SAP or METHOD_TYPE_SLP + * \param i_type METHOD_TYPE_SAP * \return a new announce_method structure */ announce_method_t * sout_AnnounceMethodCreate( int i_type ) @@ -287,11 +287,6 @@ int announce_Register( announce_handler_t *p_announce, msg_Dbg( p_announce, "adding SAP session"); p_announce->p_sap->pf_add( p_announce->p_sap, p_session ); } - else if( p_method->i_type == METHOD_TYPE_SLP ) - { - msg_Dbg( p_announce, "SLP unsupported at the moment" ); - return VLC_EGENERIC; - } else { msg_Dbg( p_announce, "Announce type unsupported" ); -- 2.39.5