]> git.sesse.net Git - vlc/commitdiff
* configure.ac.in:
authorLoïc Minier <lool@videolan.org>
Thu, 16 Jan 2003 23:25:55 +0000 (23:25 +0000)
committerLoïc Minier <lool@videolan.org>
Thu, 16 Jan 2003 23:25:55 +0000 (23:25 +0000)
    . renamed access_slp to slp
    . slp is enabled by default if slp.h is present
  * modules/access/slp.c:
    . slp is now an access and a demux and forces the use of itself
    . cleanups and bug corrections
    . disappears of the playlist
      Thanks to fenrir for the help in debugging!

configure.ac.in
include/input_ext-intf.h
modules/access/Modules.am
modules/access/slp.c

index e3717f49e3528305ead1ad71a9c6fca9ebb9ec67..518976589ad4550b36dec39420ccb943a1184aab 100644 (file)
@@ -2499,14 +2499,14 @@ dnl
 dnl  SLP access plugin
 dnl
 AC_ARG_ENABLE(slp,
-  [  --enable-slp            SLP service discovery support (default disabled)])
-if test "x${enable_slp}" = "xyes"
+  [  --enable-slp            SLP service discovery support (default enabled)])
+if test "x${enable_slp}" != "xno"
 then
   AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
   if test "x${have_slp}" = "xtrue"
   then
-    PLUGINS="${PLUGINS} access_slp"
-    LDFLAGS_access_slp="${LDFLAGS_access_slp} -lslp"
+    PLUGINS="${PLUGINS} slp"
+    LDFLAGS_slp="${LDFLAGS_slp} -lslp"
   fi
 fi
 
index 673d6acf64ee01d27a92f9b38b598db31ccbf143..9a48dc1f4a50f3096e33000069ca0511f4ba07cd 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.83 2003/01/07 21:49:01 fenrir Exp $
+ * $Id: input_ext-intf.h,v 1.84 2003/01/16 23:25:54 lool Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -352,6 +352,7 @@ struct input_thread_t
 #define INPUT_METHOD_VLAN_BCAST  0x34            /* UDP broadcast with VLANs */
 #define INPUT_METHOD_SATELLITE   0x40               /* stream is read from a */
                                                            /* satellite card */
+#define INPUT_METHOD_SLP         0x50                          /* SLP stream */
 
 /* Status changing methods */
 #define INPUT_STATUS_END            0
index 28884ef31118de8f3c8c8057075a3ed948da3c7e..30cbc9f26f11e5b1a798d2658d00c4ff0681be0f 100644 (file)
@@ -2,4 +2,4 @@ SOURCES_access_file = modules/access/file.c
 SOURCES_access_udp = modules/access/udp.c
 SOURCES_access_http = modules/access/http.c
 SOURCES_access_ftp = modules/access/ftp.c
-SOURCES_access_slp = modules/access/slp.c
+SOURCES_slp = modules/access/slp.c
index 5449108911ac742adcd0adc3d55ebc45f4b73c9e..19fa45420185fd76c15ee6ab1b8c1ff17e2fdd9f 100644 (file)
@@ -2,7 +2,7 @@
  * slp.c: SLP access plugin
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: slp.c,v 1.2 2003/01/10 06:16:55 lool Exp $
+ * $Id: slp.c,v 1.3 2003/01/16 23:25:55 lool Exp $
  *
  * Authors: Loïc Minier <lool@videolan.org>
  *
 #include <vlc/vlc.h>
 #include <vlc/input.h>
 
+#include <vlc_playlist.h>
+
 #include <slp.h>
 
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Open       ( vlc_object_t * );
-static void Close      ( vlc_object_t * );
+static int  Open  ( vlc_object_t * );
+static void Close ( vlc_object_t * );
+static ssize_t Read  ( input_thread_t *, byte_t *, size_t );
+
+static int  Init  ( vlc_object_t * );
+static void End   ( vlc_object_t * );
+static int  Demux ( input_thread_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -59,15 +66,19 @@ static void Close      ( vlc_object_t * );
 vlc_module_begin();
     set_description( _("SLP access module") );
     add_category_hint( N_("slp"), NULL );
-    set_capability( "access", 0 );
-    add_shortcut( "slp" );
     add_string( "slp-srvtype", "service:vls.services.videolan.org:udpm",
                 NULL, SRVTYPE_TEXT, SRVTYPE_LONGTEXT );
     add_string( "slp-scopelist", "", NULL, SCOPELIST_TEXT,
                 SCOPELIST_LONGTEXT );
     add_string( "slp-filter", "", NULL, FILTER_TEXT, FILTER_LONGTEXT );
     add_string( "slp-lang", "", NULL, LANG_TEXT, LANG_LONGTEXT );
-    set_callbacks( Open, Close );
+    add_submodule();
+        set_capability( "access", 0 );
+        set_callbacks( Open, Close );
+    add_submodule();
+        add_shortcut( "demux_slp" );
+        set_capability( "demux", 0 );
+        set_callbacks( Init, End );
 vlc_module_end();
 
 /*****************************************************************************
@@ -123,7 +134,7 @@ static SLPBoolean SrvUrlCallback( SLPHandle hslp,
 }
 
 /*****************************************************************************
- * Open: initialize library
+ * Open: initialize library for the access module
  *****************************************************************************/
 static int Open( vlc_object_t * p_this )
 {
@@ -131,6 +142,19 @@ static int Open( vlc_object_t * p_this )
     char *           psz_name = strdup(p_input->psz_name);
     SLPError         slpe_result;
     SLPHandle        slph_slp;
+    playlist_t *     p_playlist;
+
+    /* remove the "slp:" entry of the playlist */
+    p_playlist = (playlist_t *) vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
+                                                 FIND_ANYWHERE );
+    if( !p_playlist )
+    {
+        msg_Err( p_input, "can't find playlist" );
+        return -1;
+    }
+
+    p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE;
+    vlc_object_release( (vlc_object_t *)p_playlist );
 
     /* get a new handle to the library */
     if( SLPOpen( config_GetPsz( p_input, "slp-lang" ),
@@ -155,14 +179,77 @@ static int Open( vlc_object_t * p_this )
         SLPClose( slph_slp );
     }
 
-    return( -1 );
+    if( !p_input->psz_demux || !*p_input->psz_demux )
+    {
+        p_input->psz_demux = "demux_slp";
+    }
+
+    p_input->pf_read = Read;
+    p_input->pf_set_program = NULL;
+    p_input->pf_set_area = NULL;
+    p_input->pf_seek = NULL;
+
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    p_input->stream.b_pace_control = VLC_FALSE;
+    p_input->stream.b_seekable = VLC_FALSE;
+    p_input->stream.b_connected = VLC_TRUE;
+    p_input->stream.p_selected_area->i_tell = 0;
+    p_input->stream.p_selected_area->i_size = 0;
+    p_input->stream.i_method = INPUT_METHOD_SLP;
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
+    p_input->i_mtu = 0;
+
+    return 0;
 }
 
 /*****************************************************************************
- * Close: free unused data structures
+ * Close: close access
  *****************************************************************************/
 static void Close( vlc_object_t * p_this )
 {
+    return;
+}
+
+/*****************************************************************************
+ * Read: should fill but zeroes the buffer
+ *****************************************************************************/
+static ssize_t Read  ( input_thread_t *p_input, byte_t *p_buffer, size_t s )
+{
+    memset( p_buffer, 0, s );
+    return s;
+}
 
+/*****************************************************************************
+ * Init: initialize demux
+ *****************************************************************************/
+int Init ( vlc_object_t *p_this )
+{
+    input_thread_t *p_input = (input_thread_t *)p_this;
+
+    if( p_input->stream.i_method != INPUT_METHOD_SLP )
+    {
+        return -1;
+    }
+
+    p_input->pf_demux  = Demux;
+    p_input->pf_rewind = NULL;
+
+    return 0;
+}
+
+/*****************************************************************************
+ * Demux: should demux but does nothing
+ *****************************************************************************/
+static int Demux ( input_thread_t * p_input )
+{
+    return 0;
+}
+
+/*****************************************************************************
+ * End: end demux
+ *****************************************************************************/
+static void End ( vlc_object_t *p_this )
+{
+    return;
 }