]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/wizard.cpp
sout-standard-url is deprecated
[vlc] / modules / gui / wxwidgets / dialogs / wizard.cpp
index dbce5ad74b2cfaf03995198fa066603ed91a6468..4b6de335aba909aab4e40872cd41751b32fcec5d 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * wizard.cpp : wxWindows plugin for vlc
  *****************************************************************************
- * Copyright (C) 2000-2004 the VideoLAN team
+ * Copyright (C) 2000-2005 the VideoLAN team
  * $Id$
  *
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
  *
  * 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
@@ -18,7 +18,7 @@
  *
  * 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -1541,7 +1541,6 @@ void WizardDialog::Run()
 {
     if( RunWizard(page1) )
     {
-        int i_size;
         char *psz_opt;
 
         if( i_action == ACTION_TRANSCODE )
@@ -1588,9 +1587,7 @@ void WizardDialog::Run()
             else
                 psz_transcode = "";
 
-            i_size = 73 + strlen(mux) + strlen(address) + strlen(psz_transcode);
-            psz_opt = (char *)malloc( i_size * sizeof(char) );
-            snprintf( psz_opt, i_size, ":sout=#%sstandard{mux=%s,url=%s,"
+            asprintf( &psz_opt, ":sout=#%sstandard{mux=%s,dst=%s,"
                       "access=file}", psz_transcode, mux, address );
 
             if( *psz_transcode )
@@ -1598,37 +1595,30 @@ void WizardDialog::Run()
         }
         else
         {
+            char *psz_sap_option = NULL;
+            bool v6;
+
             msg_Dbg( p_intf, "Starting stream of %s to %s using %s, encap %s",
-                               mrl, address, method, mux);
+                               mrl, address, method, mux );
             if( b_sap )
             {
-                char *psz_sap_option = NULL;
                 if( psz_sap_name )
                 {
-                    psz_sap_option = (char *) malloc( strlen( psz_sap_name )
-                                               + 15 );
-                    snprintf( psz_sap_option,strlen( psz_sap_name ) + 15,
-                             "sap,name=\"%s\"",psz_sap_name );
+                    asprintf( &psz_sap_option,
+                              ",sap,name=\"%s\"", psz_sap_name );
                 }
                 else
-                    psz_sap_option = strdup( "sap" );
-
-                i_size = 40 + strlen(mux) + strlen(address) +
-                              strlen( psz_sap_option);
-                psz_opt = (char *)malloc( i_size * sizeof(char) );
-                snprintf( psz_opt, i_size,
-                          ":sout=#standard{mux=%s,url=%s,access=%s,%s}",
-                          mux, address,method, psz_sap_option);
-                if( psz_sap_option ) free( psz_sap_option );
-            }
-            else
-            {
-                i_size = 40 + strlen(mux) + strlen(address);
-                psz_opt = (char *)malloc( i_size * sizeof(char) );
-                snprintf( psz_opt, i_size,
-                          ":sout=#standard{mux=%s,url=%s,access=%s}",
-                          mux, address,method);
+                    psz_sap_option = strdup( ",sap" );
+
             }
+
+            /* Add brackets automatically for IPv6 if they are missing */
+            v6 = ( address[0] != '[' ) && ( strchr( address, ':' ) != NULL );
+            asprintf( &psz_opt,
+                      ":sout=#standard{mux=%s,dst=%s%s%s,access=%s%s}",
+                      mux, v6 ? "[" : "", address, v6 ? "]" : "", method,
+                      psz_sap_option ?: "" );
+            if( psz_sap_option ) free( psz_sap_option );
         }
 
         playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,