]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/standard.c
Copyright fixes
[vlc] / modules / stream_out / standard.c
index 64b84b64f88e5f9e294dee8e71c9cf8cde76162a..5d2cc39b34ea037b839b982bfd60284795f7f583 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * standard.c: standard stream output module
  *****************************************************************************
- * Copyright (C) 2003-2004 VideoLAN
+ * Copyright (C) 2003-2004 VideoLAN (Centrale Réseaux) and its contributors
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *****************************************************************************/
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 
 #include <vlc/vlc.h>
 #include <vlc/sout.h>
 
+#ifdef HAVE_UNISTD_H
+#    include <unistd.h>
+#endif
+
 #include "announce.h"
 #include "network.h"
 
 #define NAME_LONGTEXT N_( \
     "Name of the session that will be announced with SAP or SLP" )
 
+#define GROUP_TEXT N_("Session groupname")
+#define GROUP_LONGTEXT N_( \
+    "Name of the group that will be announced for the session" )
+
 #define SAP_TEXT N_("SAP announcing")
 #define SAP_LONGTEXT N_("Announce this session with SAP")
 
-#define SAPv6_TEXT N_("SAP IPv6 announcing")
-#define SAPv6_LONGTEXT N_("Use IPv6 to announce this session with SAP")
-
 #define SLP_TEXT N_("SLP announcing")
 #define SLP_LONGTEXT N_("Announce this session with SLP")
 
@@ -68,10 +72,13 @@ static void     Close   ( vlc_object_t * );
 #define SOUT_CFG_PREFIX "sout-standard-"
 
 vlc_module_begin();
+    set_shortname( _("Standard"));
     set_description( _("Standard stream output") );
     set_capability( "sout stream", 50 );
     add_shortcut( "standard" );
     add_shortcut( "std" );
+    set_category( CAT_SOUT );
+    set_subcategory( SUBCAT_SOUT_STREAM );
 
     add_string( SOUT_CFG_PREFIX "access", "", NULL, ACCESS_TEXT,
                 ACCESS_LONGTEXT, VLC_FALSE );
@@ -81,10 +88,11 @@ vlc_module_begin();
                 URL_LONGTEXT, VLC_FALSE );
 
     add_bool( SOUT_CFG_PREFIX "sap", 0, NULL, SAP_TEXT, SAP_LONGTEXT, VLC_TRUE );
-    add_string( SOUT_CFG_PREFIX "name", "", NULL, NAME_TEXT,NAME_LONGTEXT
-                                     , VLC_TRUE );
-    add_bool( SOUT_CFG_PREFIX "sap-ipv6", 0, NULL, SAPv6_TEXT, SAPv6_LONGTEXT,
+    add_string( SOUT_CFG_PREFIX "name", "", NULL, NAME_TEXT, NAME_LONGTEXT,
+                                        VLC_TRUE );
+    add_string( SOUT_CFG_PREFIX "group", "", NULL, GROUP_TEXT, GROUP_LONGTEXT,
                                         VLC_TRUE );
+    add_suppressed_bool( SOUT_CFG_PREFIX "sap-ipv6" );
 
     add_bool( SOUT_CFG_PREFIX "slp", 0, NULL, SLP_TEXT, SLP_LONGTEXT, VLC_TRUE );
 
@@ -97,11 +105,9 @@ vlc_module_end();
  *****************************************************************************/
 static const char *ppsz_sout_options[] = {
     "access", "mux", "url",
-    "sap", "name", "sap-ipv6",
-    "slp",NULL
+    "sap", "name", "group", "slp", NULL
 };
 
-#define DEFAULT_IPV6_SCOPE '8'
 #define DEFAULT_PORT 1234
 
 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * );
@@ -135,7 +141,7 @@ static int Open( vlc_object_t *p_this )
 
     char                *psz_mux_byext = NULL;
 
-    sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+    sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
                    p_stream->p_cfg );
 
     var_Get( p_stream, SOUT_CFG_PREFIX "access", &val );
@@ -223,10 +229,15 @@ static int Open( vlc_object_t *p_this )
         {
             psz_mux = strdup("ts");
         }
-        else
+        else if( psz_mux_byext )
         {
             psz_mux = strdup(psz_mux_byext);
         }
+        else
+        {
+            msg_Err( p_stream, "no mux specified or found by extention" );
+            return VLC_EGENERIC;
+        }
     }
     else if( psz_mux && !psz_access )
     {
@@ -242,7 +253,7 @@ static int Open( vlc_object_t *p_this )
         }
     }
 
-    /* fix or warm of incompatible couple */
+    /* fix or warn of incompatible couple */
     if( psz_mux && psz_access )
     {
         if( !strncmp( psz_access, "mmsh", 4 ) &&
@@ -317,15 +328,20 @@ static int Open( vlc_object_t *p_this )
         var_Get( p_stream, SOUT_CFG_PREFIX "name", &val );
         if( *val.psz_string )
         {
-            p_session->psz_name = val.psz_string;
+            p_session->psz_name = strdup( val.psz_string );
         }
         else
         {
-            free( val.psz_string );
             p_session->psz_name = strdup( psz_url );
         }
-        var_Get( p_stream, SOUT_CFG_PREFIX "sap-ipv6", &val );
-        p_method->i_ip_version = val.b_bool ? 6 : 4;
+        free( val.psz_string );
+
+        var_Get( p_stream, SOUT_CFG_PREFIX "group", &val );
+        if( *val.psz_string )
+        {
+            p_session->psz_group = strdup( val.psz_string );
+        }
+        free( val.psz_string );
 
         /* Now, parse the URL to extract host and port */
         vlc_UrlParse( &url, psz_url , 0);
@@ -334,7 +350,7 @@ static int Open( vlc_object_t *p_this )
         {
             if( url.i_port == 0 ) url.i_port = DEFAULT_PORT;
 
-            p_session->psz_uri = url.psz_host;
+            p_session->psz_uri = strdup( url.psz_host );
             p_session->i_port = url.i_port;
             p_session->psz_sdp = NULL;
 
@@ -344,12 +360,13 @@ static int Open( vlc_object_t *p_this )
             msg_Info( p_this, "SAP Enabled");
 
             sout_AnnounceRegister( p_sout, p_session, p_method );
-
-            /* FIXME: Free p_method */
-
             p_stream->p_sys->p_session = p_session;
         }
         vlc_UrlClean( &url );
+
+        /* FIXME: Free p_method */
+        if( p_method->psz_address) free( p_method->psz_address );
+        free( p_method );
     }
 
     /* *** Register with slp *** */
@@ -397,6 +414,7 @@ static int Open( vlc_object_t *p_this )
     if( psz_mux ) free( psz_mux );
     if( psz_url ) free( psz_url );
 
+
     return VLC_SUCCESS;
 }
 
@@ -412,6 +430,7 @@ static void Close( vlc_object_t * p_this )
     if( p_sys->p_session != NULL )
     {
         sout_AnnounceUnRegister( p_stream->p_sout, p_sys->p_session );
+        sout_AnnounceSessionDestroy( p_sys->p_session );
     }
 
 #ifdef HAVE_SLP_H