]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/wizard.cpp
Disable broken stuff (Refs:#459)
[vlc] / modules / gui / wxwidgets / dialogs / wizard.cpp
index c83e5ae6429a15df18ee76dfacd7bfebb7b1ac97..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.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -591,6 +591,8 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
                 listview->InsertItem( i, filename );
                 listview->SetItem( i, 1, wxL2U( p_playlist->pp_items[i]->
                                                             input.psz_uri) );
+                listview->SetItemData( i,
+                                  (long)p_playlist->pp_items[i]->input.i_id );
             }
             listview->Select( p_playlist->i_index , TRUE);
             mainSizer->Add( listview, 1, wxALL|wxEXPAND, 5 );
@@ -715,14 +717,25 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
     else
     {
         int i = -1;
-        wxListItem listitem;
         i = listview->GetNextItem( i , wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
         if( i != -1 )
         {
-            listitem.SetId( i );
-            listitem.SetColumn( 1 );
-            listview->GetItem( listitem );
-            p_parent->SetMrl( (const char*) listitem.GetText().mb_str() );
+            long data = listview->GetItemData( i );            
+            playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
+                                      VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
+            if( p_playlist )
+            {
+                playlist_item_t * p_item = playlist_LockItemGetById(
+                                                   p_playlist, (int)data );
+                if( p_item )
+                {
+                    p_parent->SetMrl( (const char*)p_item->input.psz_uri );
+                }
+                else
+                    event.Veto();
+            }
+            else
+                event.Veto();
         }
     }
     if( enable_checkbox->IsChecked() )
@@ -1528,7 +1541,6 @@ void WizardDialog::Run()
 {
     if( RunWizard(page1) )
     {
-        int i_size;
         char *psz_opt;
 
         if( i_action == ACTION_TRANSCODE )
@@ -1575,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 )
@@ -1585,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,