]> git.sesse.net Git - vlc/commitdiff
Automatically adds [ and ] around IPv6 addresses in Media Resource Locator.
authorRémi Denis-Courmont <rem@videolan.org>
Wed, 10 Dec 2003 11:04:25 +0000 (11:04 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Wed, 10 Dec 2003 11:04:25 +0000 (11:04 +0000)
modules/gui/wxwindows/open.cpp
modules/gui/wxwindows/streamout.cpp

index a399494ddf7b2d5e379b8de7d773ab801cb2c168..f5d1f51e1aedcfe26615ed3804cbf73abe64bc0e 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.47 2003/12/09 19:15:03 yoann Exp $
+ * $Id: open.cpp,v 1.48 2003/12/10 11:04:25 courmisch Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -685,27 +685,30 @@ void OpenDialog::UpdateMRL( int i_access_method )
         switch( i_net_type )
         {
         case 0:
+            mrltemp = wxT("udp") + demux + wxT("://");
             if( i_net_ports[0] !=
                 config_GetInt( p_intf, "server-port" ) )
             {
-                mrltemp = wxT("udp") + demux +
-                          wxString::Format( wxT("://@:%d"),
-                                            i_net_ports[0] );
-            }
-            else
-            {
-                mrltemp = wxT("udp") + demux + wxT("://");
+                mrltemp += wxString::Format( wxT("@:%d"), i_net_ports[0] );
             }
             break;
 
         case 1:
-            mrltemp = wxT("udp") + demux + wxT("://@") +
-                      net_addrs[1]->GetLineText(0);
-            if( i_net_ports[1] !=
-                config_GetInt( p_intf, "server-port" ) )
+            mrltemp = wxT("udp") + demux + wxT("://@");
+            if ((net_addrs[1]->GetLineText(0).Find (':') != -1)
+                && (net_addrs[1]->GetLineText(0)[0u] != '['))
+            {
+                /* automatically adds '[' and ']' to IPv6 addresses */
+                mrltemp += wxT("[") + net_addrs[1]->GetLineText(0)
+                         + wxT("]");
+            }
+            else
+            {
+                mrltemp += net_addrs[1]->GetLineText(0);
+            }
+            if( i_net_ports[1] != config_GetInt( p_intf, "server-port" ) )
             {
-                mrltemp = mrltemp + wxString::Format( wxT(":%d"),
-                                              i_net_ports[1] );
+                mrltemp += wxString::Format( wxT(":%d"), i_net_ports[1] );
             }
             break;
 
index 468d531db5c2e74216e54ec5e75d02eb5d3a9ea3..6866304af090473f8b3caccc75ee25923f0539b8 100644 (file)
@@ -2,7 +2,7 @@
  * streamout.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: streamout.cpp,v 1.37 2003/11/27 10:34:51 gbazin Exp $
+ * $Id: streamout.cpp,v 1.38 2003/12/10 11:04:25 courmisch Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -334,7 +334,16 @@ void SoutDialog::UpdateMRL()
         if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
         dup_opts += wxT("dst=std{access=udp,mux=");
         dup_opts += encapsulation + wxT(",url=");
-        dup_opts += net_addrs[UDP_ACCESS_OUT]->GetLineText(0);
+
+        wxString udp_addr = net_addrs[UDP_ACCESS_OUT]->GetLineText(0);
+        if ((udp_addr[0u] != '[') && (udp_addr.Find(':') != -1))
+        {
+            dup_opts += wxT ("[") + udp_addr + wxT ("]");
+        }
+        else
+        {
+            dup_opts += udp_addr;
+        }
         dup_opts += wxString::Format( wxT(":%d"),
                                       net_ports[UDP_ACCESS_OUT]->GetValue() );