SLP Announce :)
[vlc.git] / modules / gui / wxwindows / streamout.cpp
index a73345e..02d1758 100644 (file)
@@ -2,7 +2,7 @@
  * streamout.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: streamout.cpp,v 1.27 2003/07/24 21:50:28 gbazin Exp $
+ * $Id: streamout.cpp,v 1.28 2003/08/19 21:54:07 adn Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -78,7 +78,7 @@ enum
 
 enum
 {
-    SAP_MISC = 0
+    ANN_MISC = 0
 };
 
 
@@ -108,7 +108,7 @@ enum
     AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
     AudioTranscChans_Event,
 
-    SAPMisc_Event, SAPAddr_Event
+    SAPMisc_Event, SLPMisc_Event, AnnounceAddr_Event
 };
 
 BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
@@ -131,7 +131,7 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
     EVT_TEXT(NetAddr2_Event, SoutDialog::OnNetChange)
     EVT_TEXT(NetPort3_Event, SoutDialog::OnNetChange)
     EVT_TEXT(NetAddr3_Event, SoutDialog::OnNetChange)
+
     /* Events generated by the encapsulation panel */
     EVT_RADIOBUTTON(EncapsulationRadio1_Event,
                     SoutDialog::OnEncapsulationChange)
@@ -160,7 +160,8 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
 
     /* Events generated by the misc panel */
     EVT_CHECKBOX(SAPMisc_Event, SoutDialog::OnSAPMiscChange)
-    EVT_TEXT(SAPAddr_Event, SoutDialog::OnSAPAddrChange)
+    EVT_CHECKBOX(SLPMisc_Event, SoutDialog::OnSLPMiscChange)
+    EVT_TEXT(AnnounceAddr_Event, SoutDialog::OnAnnounceAddrChange)
 
 END_EVENT_TABLE()
 
@@ -209,7 +210,7 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
 
     /* Create the Misc panel */
     wxPanel *misc_panel = MiscPanel( panel );
-    
+
     /* Separation */
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
 
@@ -337,7 +338,15 @@ void SoutDialog::UpdateMRL()
         if( sap_checkbox->IsChecked() )
         {
             dup_opts += wxT(",sap=\"");
-            dup_opts += sap_addr->GetLineText(0);
+            dup_opts += announce_addr->GetLineText(0);
+            dup_opts += wxT("\"");
+        }
+
+        /* SLP only if UDP */
+        if( slp_checkbox->IsChecked() )
+        {
+            dup_opts += wxT(",slp=\"");
+            dup_opts += announce_addr->GetLineText(0);
             dup_opts += wxT("\"");
         }
 
@@ -485,41 +494,46 @@ wxPanel *SoutDialog::MiscPanel( wxWindow* parent )
     wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
                                                           wxVERTICAL );
 
-    /* SAP Row */
+    /* Announce Row */
     wxStaticText *label;
     wxFlexGridSizer *subpanel_sizer;
 
-    misc_subpanels[SAP_MISC] = new wxPanel( panel, -1 );
-    subpanel_sizer = new wxFlexGridSizer( 4, 2, 20 );
+    misc_subpanels[ANN_MISC] = new wxPanel( panel, -1 );
+    subpanel_sizer = new wxFlexGridSizer( 2, 2, 20 );
 
-    sap_checkbox = new wxCheckBox( misc_subpanels[SAP_MISC], SAPMisc_Event,
+    sap_checkbox = new wxCheckBox( misc_subpanels[ANN_MISC], SAPMisc_Event,
                                    wxU(_("SAP Announce")) );
-    label = new wxStaticText( misc_subpanels[SAP_MISC], -1,
+    slp_checkbox = new wxCheckBox( misc_subpanels[ANN_MISC], SLPMisc_Event,
+                                   wxU(_("SLP Announce")) );
+    label = new wxStaticText( misc_subpanels[ANN_MISC], -1,
                               wxU(_("Channel Name ")) );
-    sap_addr = new wxTextCtrl( misc_subpanels[SAP_MISC], SAPAddr_Event,
-                               wxT(""), wxDefaultPosition,
-                               wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
+    announce_addr = new wxTextCtrl( misc_subpanels[ANN_MISC],
+                                    AnnounceAddr_Event,
+                                    wxT(""), wxDefaultPosition,
+                                    wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
 
     subpanel_sizer->Add( sap_checkbox, 0,
                          wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+    subpanel_sizer->Add( slp_checkbox, 0,
+                         wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
-    subpanel_sizer->Add( sap_addr, 1, wxEXPAND |
+    subpanel_sizer->Add( announce_addr, 1, wxEXPAND |
                          wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
 
-    misc_subpanels[SAP_MISC]->SetSizerAndFit( subpanel_sizer );
+    misc_subpanels[ANN_MISC]->SetSizerAndFit( subpanel_sizer );
 
     /* Stuff everything into the main panel */
-    panel_sizer->Add( misc_subpanels[SAP_MISC], 1,
+    panel_sizer->Add( misc_subpanels[ANN_MISC], 1,
                       wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
 
     panel->SetSizerAndFit( panel_sizer );
 
     /* Update misc panel */
-    misc_subpanels[SAP_MISC]->Disable();
-    sap_addr->Disable();
+    misc_subpanels[ANN_MISC]->Disable();
+    announce_addr->Disable();
 
     return panel;
-} 
+}
 
 wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent )
 {
@@ -737,7 +751,7 @@ void SoutDialog::OnAccessTypeChange( wxCommandEvent& event )
     switch( i_access_type )
     {
     case UDP_ACCESS_OUT:
-        misc_subpanels[SAP_MISC]->Enable( event.GetInt() );
+        misc_subpanels[ANN_MISC]->Enable( event.GetInt() );
 
     case RTP_ACCESS_OUT:
         for( i = 1; i < ENCAPS_NUM; i++ )
@@ -755,18 +769,32 @@ void SoutDialog::OnAccessTypeChange( wxCommandEvent& event )
 }
 
 /*****************************************************************************
- * SAPMisc panel event methods.
+ * AnnounceMisc panel event methods.
  *****************************************************************************/
 void SoutDialog::OnSAPMiscChange( wxCommandEvent& event )
 {
-    sap_addr->Enable( event.GetInt() );
-    UpdateMRL();
+    if(!slp_checkbox->IsChecked())
+    {
+        announce_addr->Enable( event.GetInt() );
+
+    }
+        UpdateMRL();
+}
+
+void SoutDialog::OnSLPMiscChange( wxCommandEvent& event )
+{
+    if(!sap_checkbox->IsChecked())
+    {
+        announce_addr->Enable( event.GetInt() );
+    }
+        UpdateMRL();
 }
 
+
 /*****************************************************************************
  * SAPAddr panel event methods.
  *****************************************************************************/
-void SoutDialog::OnSAPAddrChange( wxCommandEvent& WXUNUSED(event) )
+void SoutDialog::OnAnnounceAddrChange( wxCommandEvent& WXUNUSED(event) )
 {
     UpdateMRL();
 }