* slp.c: SLP access plugin
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: slp.c,v 1.11 2003/05/15 22:27:36 massiot Exp $
+ * $Id: slp.c,v 1.17 2003/10/29 17:32:54 zorglub Exp $
*
* Authors: Loïc Minier <lool@videolan.org>
*
* 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
static void End ( vlc_object_t * );
static int Demux ( input_thread_t * );
+int i_group;
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
NAMINGAUTHORITY_LONGTEXT, VLC_TRUE );
add_string( "slp-filter", "", NULL, FILTER_TEXT, FILTER_LONGTEXT, VLC_TRUE );
add_string( "slp-lang", "", NULL, LANG_TEXT, LANG_LONGTEXT, VLC_TRUE );
- add_submodule();
- set_capability( "access", 0 );
- set_callbacks( Open, Close );
+ set_capability( "access", 0 );
+ set_callbacks( Open, Close );
+
add_submodule();
add_shortcut( "demux_slp" );
set_capability( "demux", 0 );
/* or there was a problem with getting the data we requested */
if( (slpe_errcode != SLP_OK) )
{
-/* msg_Err( (vlc_object_t*)NULL,
+#if 0
+ msg_Err( (vlc_object_t*)NULL,
"AttrCallback got an error %i with attribute %s",
slpe_errcode,
- psz_attrlist ); */
+ psz_attrlist );
+#endif
return SLP_TRUE;
}
{
input_thread_t * p_input = (input_thread_t *)p_cookie;
playlist_t * p_playlist;
- char psz_item[42] = "udp:@";
+ char psz_item[42] = ""; //"udp:@";
char * psz_s; /* to hold the uri of the stream */
SLPHandle slph_slp3;
SLPError slpe_result;
return SLP_TRUE;
}
+ msg_Dbg(p_input,"URL: %s",psz_srvurl);
+
/* or there was a problem with getting the data we requested */
if( (slpe_errcode != SLP_OK) )
{
p_playlist_item->i_type = 0;
p_playlist_item->i_status = 0;
p_playlist_item->b_autodeletion = VLC_FALSE;
+ p_playlist_item->i_options = 0;
+ p_playlist_item->ppsz_options = 0;
+ p_playlist_item->psz_author = NULL;
+ p_playlist_item->i_group = i_group;
+ p_playlist_item->b_enabled = VLC_TRUE;
/* search the description of the stream */
if( SLPOpen( config_GetPsz( p_input, "slp-lang" ),
input_thread_t * p_input = (input_thread_t *)p_cookie;
SLPError slpe_result;
SLPHandle slph_slp2;
+ char *psz_eos;
+ char *psz_service;
+ msg_Dbg(p_input,"Services: %s",psz_srvurl);
/* our callback was only called to tell us there's nothing more to read */
if( slpe_errcode == SLP_LAST_CALL )
{
return SLP_TRUE;
}
+ msg_Dbg(p_input,"Services: %s",psz_srvurl);
+
/* or there was a problem with getting the data we requested */
if( slpe_errcode != SLP_OK )
{
&slph_slp2 ) == SLP_OK )
{
/* search for services */
- slpe_result = SLPFindSrvs( slph_slp2,
- psz_srvurl,
+ while(1)
+ {
+ if( *psz_srvurl == '\0') break;
+
+ if( !strncasecmp( psz_srvurl, "service:", 8 ) )
+ {
+ while(1)
+ {
+ psz_eos = strchr( psz_srvurl, ',');
+ if(!psz_eos) break;
+ if(!strncasecmp(psz_eos+1,"service:",8)) break;
+ }
+
+ if(psz_eos)
+ *psz_eos = '\0';
+
+ psz_service = strdup( psz_srvurl);
+
+ msg_Dbg(p_input,"Getting details for %s",psz_service);
+
+ slpe_result = SLPFindSrvs( slph_slp2,
+ psz_service,
config_GetPsz( p_input, "slp-scopelist" ),
config_GetPsz( p_input, "slp-filter" ),
SrvUrlCallback,
p_input );
- SLPClose( slph_slp2 );
-
- if( slpe_result != SLP_OK )
- {
- msg_Err( p_input,
- "SLPFindSrvs error %i finding servers of type %s",
- slpe_result,
- psz_srvurl );
+ if(psz_eos)
+ psz_srvurl = psz_eos;
+
+#if 0
+ SLPClose( slph_slp2 );
+#endif
+ if( slpe_result != SLP_OK )
+ {
+ msg_Err( p_input,
+ "SLPFindSrvs error %i finding servers of type %s",
+ slpe_result,
+ psz_service );
+ }
+ }
+ psz_srvurl++;
}
}
+ SLPClose( slph_slp2 );
return SLP_TRUE;
}
*****************************************************************************/
static int Open( vlc_object_t * p_this )
{
- input_thread_t * p_input = (input_thread_t *)p_this;
- SLPError slpe_result;
- SLPHandle slph_slp;
- playlist_t * p_playlist;
+ input_thread_t * p_input = (input_thread_t *)p_this;
+ SLPError slpe_result;
+ SLPHandle slph_slp;
+ playlist_t * p_playlist;
+ playlist_group_t * p_group;
/* remove the "slp:" entry of the playlist */
p_playlist = (playlist_t *) vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
return VLC_FALSE;
}
+ p_group = playlist_CreateGroup( p_playlist , "SLP" );
+ i_group = p_group->i_id;
p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
vlc_object_release( (vlc_object_t *)p_playlist );
}
p_input->pf_demux = Demux;
+ p_input->pf_demux_control = demux_vaControlDefault;
p_input->pf_rewind = NULL;
return VLC_SUCCESS;