Commit c5abeadf authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/streamout.cpp: misc fixes and enhancements.
parent 2ebf1f92
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* streamout.cpp : wxWindows plugin for vlc * streamout.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: streamout.cpp,v 1.1 2003/03/22 03:14:34 gbazin Exp $ * $Id: streamout.cpp,v 1.2 2003/03/22 11:21:58 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -89,7 +89,6 @@ enum ...@@ -89,7 +89,6 @@ enum
AccessRadio3_Event, AccessRadio4_Event, AccessRadio3_Event, AccessRadio4_Event,
NetPort_Event, NetPort_Event,
NetAddr_Event, NetAddr_Event,
MulticastCheckbox_Event,
EncapsulationRadio1_Event, EncapsulationRadio2_Event, EncapsulationRadio1_Event, EncapsulationRadio2_Event,
EncapsulationRadio3_Event, EncapsulationRadio4_Event, EncapsulationRadio3_Event, EncapsulationRadio4_Event,
...@@ -110,7 +109,6 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog) ...@@ -110,7 +109,6 @@ BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
EVT_TEXT(NetPort_Event, SoutDialog::OnNetChange) EVT_TEXT(NetPort_Event, SoutDialog::OnNetChange)
EVT_SPINCTRL(NetPort_Event, SoutDialog::OnNetChange) EVT_SPINCTRL(NetPort_Event, SoutDialog::OnNetChange)
EVT_TEXT(NetAddr_Event, SoutDialog::OnNetChange) EVT_TEXT(NetAddr_Event, SoutDialog::OnNetChange)
EVT_CHECKBOX(MulticastCheckbox_Event, SoutDialog::OnMulticastChange)
/* Events generated by the encapsulation panel */ /* Events generated by the encapsulation panel */
EVT_RADIOBUTTON(EncapsulationRadio1_Event, EVT_RADIOBUTTON(EncapsulationRadio1_Event,
...@@ -139,14 +137,6 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -139,14 +137,6 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf, Interface *_p_main_interface ):
wxPanel *panel = new wxPanel( this, -1 ); wxPanel *panel = new wxPanel( this, -1 );
panel->SetAutoLayout( TRUE ); panel->SetAutoLayout( TRUE );
/* Initialise MRL value */
char *psz_sout = config_GetPsz( p_intf, "sout" );
if( psz_sout )
{
mrl = psz_sout;
free( psz_sout );
}
/* Create MRL combobox */ /* Create MRL combobox */
wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBox *mrl_box = new wxStaticBox( panel, -1, wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
...@@ -194,6 +184,9 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -194,6 +184,9 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf, Interface *_p_main_interface ):
main_sizer->Add( panel, 1, wxGROW, 0 ); main_sizer->Add( panel, 1, wxGROW, 0 );
main_sizer->Layout(); main_sizer->Layout();
SetSizerAndFit( main_sizer ); SetSizerAndFit( main_sizer );
/* Update all the values */
ParseMRL();
} }
SoutDialog::~SoutDialog() SoutDialog::~SoutDialog()
...@@ -227,22 +220,22 @@ void SoutDialog::UpdateMRL() ...@@ -227,22 +220,22 @@ void SoutDialog::UpdateMRL()
switch( i_access_type ) switch( i_access_type )
{ {
case FILE_ACCESS_OUT: case FILE_ACCESS_OUT:
mrl = "file" + encapsulation + "://" + file_combo->GetValue(); mrl = "file" + encapsulation + ":" + file_combo->GetValue();
break; break;
case HTTP_ACCESS_OUT: case HTTP_ACCESS_OUT:
mrl = "http" + encapsulation + "://" + net_addr->GetLineText(0) mrl = "http" + encapsulation + ":" + net_addr->GetLineText(0)
+ wxString::Format( ":%d", net_port->GetValue() ); + wxString::Format( ":%d", net_port->GetValue() );
break; break;
case UDP_ACCESS_OUT: case UDP_ACCESS_OUT:
mrl = "udp" + encapsulation + (b_multicast ? "://@" : "://") mrl = "udp" + encapsulation + ":"
+ net_addr->GetLineText(0) + net_addr->GetLineText(0)
+ wxString::Format( ":%d", net_port->GetValue() ); + wxString::Format( ":%d", net_port->GetValue() );
break; break;
case RTP_ACCESS_OUT: case RTP_ACCESS_OUT:
mrl = "rtp" + encapsulation + (b_multicast ? "://@" : "://") mrl = "rtp" + encapsulation + ":"
+ net_addr->GetLineText(0) + net_addr->GetLineText(0)
+ wxString::Format( ":%d", net_port->GetValue() ); + wxString::Format( ":%d", net_port->GetValue() );
break; break;
...@@ -321,16 +314,6 @@ wxPanel *SoutDialog::AccessPanel( wxWindow* parent ) ...@@ -321,16 +314,6 @@ wxPanel *SoutDialog::AccessPanel( wxWindow* parent )
access_subpanels[2]->SetSizerAndFit( subpanel_sizer ); access_subpanels[2]->SetSizerAndFit( subpanel_sizer );
/* Multicast row */
subpanel_sizer = new wxFlexGridSizer( 1, 1, 20 );
b_multicast = VLC_FALSE;
multicast_checkbox = new wxCheckBox( access_subpanels[3],
MulticastCheckbox_Event,
_("Multicast") );
subpanel_sizer->Add( multicast_checkbox, 0, wxEXPAND |
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
access_subpanels[3]->SetSizerAndFit( subpanel_sizer );
/* Stuff everything into the main panel */ /* Stuff everything into the main panel */
for( i=0; i<4; i++ ) for( i=0; i<4; i++ )
...@@ -345,13 +328,6 @@ wxPanel *SoutDialog::AccessPanel( wxWindow* parent ) ...@@ -345,13 +328,6 @@ wxPanel *SoutDialog::AccessPanel( wxWindow* parent )
panel->SetSizerAndFit( panel_sizer ); panel->SetSizerAndFit( panel_sizer );
/* Update access output panel */
net_addr->SetValue( "127.0.0.1" );
net_port->SetValue( config_GetInt( p_intf, "server-port" ) );
wxCommandEvent dummy_event;
dummy_event.SetId( AccessRadio1_Event );
OnAccessTypeChange( dummy_event );
return panel; return panel;
} }
...@@ -393,6 +369,89 @@ wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent ) ...@@ -393,6 +369,89 @@ wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent )
return panel; return panel;
} }
void SoutDialog::ParseMRL()
{
/* Initialise MRL value */
char *psz_sout = config_GetPsz( p_intf, "sout" );
if( psz_sout )
{
mrl = psz_sout;
free( psz_sout );
}
/* Parse the MRL */
wxString access = mrl.BeforeFirst( '/' );
wxString encapsulation = mrl.BeforeFirst( ':' ).AfterFirst('/');
if( !access.Cmp( "http" ) )
{
i_access_type = HTTP_ACCESS_OUT;
}
else if( !access.Cmp( "udp" ) )
{
i_access_type = UDP_ACCESS_OUT;
}
else if( !access.Cmp( "rtp" ) )
{
i_access_type = RTP_ACCESS_OUT;
}
else
{
i_access_type = FILE_ACCESS_OUT;
}
if( !encapsulation.Cmp( "ps" ) )
{
i_encapsulation_type = PS_ENCAPSULATION;
}
else if( !encapsulation.Cmp( "avi" ) )
{
i_encapsulation_type = AVI_ENCAPSULATION;
}
else if( !encapsulation.Cmp( "ogg" ) )
{
i_encapsulation_type = OGG_ENCAPSULATION;
}
else
{
i_encapsulation_type = TS_ENCAPSULATION;
}
wxString second_part = mrl.AfterFirst( ':' );
if( i_access_type == FILE_ACCESS_OUT )
{
/* The whole second part of the MRL is the filename */
file_combo->SetValue( second_part );
}
else
{
/* we've got address:port */
wxString address = second_part.BeforeLast( ':' );
net_addr->SetValue( address );
long int i_port;
wxString port = second_part.AfterLast( ':' );
if( port.ToLong( &i_port ) )
{
net_port->SetValue( i_port );
}
else
{
net_port->SetValue( config_GetInt( p_intf, "server-port" ) );
}
}
/* Update access output panel */
wxCommandEvent dummy_event;
dummy_event.SetId( AccessRadio1_Event + i_access_type );
OnAccessTypeChange( dummy_event );
/* Update encapsulation output panel */
dummy_event.SetId( EncapsulationRadio1_Event + i_encapsulation_type );
OnEncapsulationChange( dummy_event );
}
/***************************************************************************** /*****************************************************************************
* Events methods. * Events methods.
*****************************************************************************/ *****************************************************************************/
...@@ -477,7 +536,7 @@ void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) ...@@ -477,7 +536,7 @@ void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
if( dialog.ShowModal() == wxID_OK ) if( dialog.ShowModal() == wxID_OK )
{ {
file_combo->SetValue( dialog.GetPath() ); file_combo->SetValue( dialog.GetPath() );
UpdateMRL(); UpdateMRL();
} }
} }
...@@ -490,12 +549,6 @@ void SoutDialog::OnNetChange( wxCommandEvent& WXUNUSED(event) ) ...@@ -490,12 +549,6 @@ void SoutDialog::OnNetChange( wxCommandEvent& WXUNUSED(event) )
UpdateMRL(); UpdateMRL();
} }
void SoutDialog::OnMulticastChange( wxCommandEvent& event )
{
b_multicast = event.GetInt();
UpdateMRL();
}
/***************************************************************************** /*****************************************************************************
* Encapsulation panel event methods. * Encapsulation panel event methods.
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.9 2003/03/22 03:14:34 gbazin Exp $ * $Id: wxwindows.h,v 1.10 2003/03/22 11:21:58 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -250,6 +250,7 @@ private: ...@@ -250,6 +250,7 @@ private:
void UpdateMRL(); void UpdateMRL();
wxPanel *AccessPanel( wxWindow* parent ); wxPanel *AccessPanel( wxWindow* parent );
wxPanel *EncapsulationPanel( wxWindow* parent ); wxPanel *EncapsulationPanel( wxWindow* parent );
void ParseMRL();
/* Event handlers (these functions should _not_ be virtual) */ /* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event ); void OnOk( wxCommandEvent& event );
...@@ -263,7 +264,6 @@ private: ...@@ -263,7 +264,6 @@ private:
/* Event handlers for the net access output */ /* Event handlers for the net access output */
void OnNetChange( wxCommandEvent& event ); void OnNetChange( wxCommandEvent& event );
void OnMulticastChange( wxCommandEvent& event );
/* Event handlers for the encapsulation panel */ /* Event handlers for the encapsulation panel */
void OnEncapsulationChange( wxCommandEvent& event ); void OnEncapsulationChange( wxCommandEvent& event );
...@@ -280,10 +280,8 @@ private: ...@@ -280,10 +280,8 @@ private:
/* Controls for the access outputs */ /* Controls for the access outputs */
wxPanel *access_subpanels[4]; wxPanel *access_subpanels[4];
wxRadioButton *access_radios[4]; wxRadioButton *access_radios[4];
wxCheckBox *multicast_checkbox;
int i_access_type; int i_access_type;
vlc_bool_t b_multicast;
wxComboBox *file_combo; wxComboBox *file_combo;
wxSpinCtrl *net_port; wxSpinCtrl *net_port;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment