* streamout.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: streamout.cpp,v 1.12 2003/05/17 22:48:09 gbazin Exp $
+ * $Id: streamout.cpp,v 1.24 2003/07/12 13:33:10 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
TS_ENCAPSULATION = 0,
PS_ENCAPSULATION,
AVI_ENCAPSULATION,
- MP4_ENCAPSULATION,
OGG_ENCAPSULATION,
- ENCAPS_NUM
+ ENCAPS_NUM,
+ MP4_ENCAPSULATION
};
+enum
+{
+ SAP_MISC = 0
+};
+
+
/*****************************************************************************
* Event Table.
*****************************************************************************/
AccessType1_Event, AccessType2_Event, AccessType3_Event,
AccessType4_Event, AccessType5_Event,
- NetPort_Event,
- NetAddr_Event,
+ NetPort1_Event, NetPort2_Event, NetPort3_Event,
+ NetAddr1_Event, NetAddr2_Event, NetAddr3_Event,
EncapsulationRadio1_Event, EncapsulationRadio2_Event,
EncapsulationRadio3_Event, EncapsulationRadio4_Event,
VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event,
AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
+ AudioTranscChans_Event,
+
+ SAPMisc_Event, SAPAddr_Event
};
BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
EVT_CHECKBOX(AccessType5_Event, SoutDialog::OnAccessTypeChange)
EVT_TEXT(FileName_Event, SoutDialog::OnFileChange)
EVT_BUTTON(FileBrowse_Event, SoutDialog::OnFileBrowse)
- EVT_TEXT(NetPort_Event, SoutDialog::OnNetChange)
- EVT_SPINCTRL(NetPort_Event, SoutDialog::OnNetChange)
- EVT_TEXT(NetAddr_Event, SoutDialog::OnNetChange)
+
+ EVT_TEXT(NetPort1_Event, SoutDialog::OnNetChange)
+ EVT_TEXT(NetAddr1_Event, SoutDialog::OnNetChange)
+ EVT_TEXT(NetPort2_Event, SoutDialog::OnNetChange)
+ 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,
EVT_CHECKBOX(VideoTranscEnable_Event, SoutDialog::OnTranscodingEnable)
EVT_CHECKBOX(AudioTranscEnable_Event, SoutDialog::OnTranscodingEnable)
EVT_COMBOBOX(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
+ EVT_TEXT(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
EVT_COMBOBOX(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
+ EVT_TEXT(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
EVT_COMBOBOX(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
+ EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
+ EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
+ EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
+ EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
+
+ /* Events generated by the misc panel */
+ EVT_CHECKBOX(SAPMisc_Event, SoutDialog::OnSAPMiscChange)
+ EVT_TEXT(SAPAddr_Event, SoutDialog::OnSAPAddrChange)
END_EVENT_TABLE()
wxHORIZONTAL );
wxStaticText *mrl_label = new wxStaticText( panel, -1,
wxU(_("Destination Target:")));
- mrl_combo = new wxComboBox( panel, MRL_Event, mrl,
+ mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
wxPoint(20,25), wxSize(120, -1), 0, NULL );
mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
"the full MRL you want to open.\n""Alternatively, the field will be "
/* Create the transcoding panel */
wxPanel *transcoding_panel = TranscodingPanel( panel );
+ /* Create the Misc panel */
+ wxPanel *misc_panel = MiscPanel( panel );
+
/* Separation */
wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
panel_sizer->Add( access_panel, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( encapsulation_panel, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( transcoding_panel, 0, wxEXPAND | wxALL, 5 );
+ panel_sizer->Add( misc_panel, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
wxALL, 5 );
main_sizer->Add( panel, 1, wxGROW, 0 );
main_sizer->Layout();
SetSizerAndFit( main_sizer );
-
- /* Update all the values */
- //ParseMRL();
}
SoutDialog::~SoutDialog()
{
transcode += wxT("acodec=") + audio_codec_combo->GetValue();
transcode += wxT(",ab=") + audio_bitrate_combo->GetValue();
+ transcode += wxT(",channels=") + audio_channels_combo->GetValue();
}
transcode += wxT("}");
}
{
if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
dup_opts += wxT("dst=std{access=file,mux=");
- dup_opts += encapsulation + wxT(",url=");
- dup_opts += file_combo->GetValue() + wxT("}");
+ dup_opts += encapsulation + wxT(",url=\"");
+ dup_opts += file_combo->GetValue() + wxT("\"}");
}
if( access_checkboxes[HTTP_ACCESS_OUT]->IsChecked() )
{
if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
dup_opts += wxT("dst=std{access=http,mux=");
dup_opts += encapsulation + wxT(",url=");
- dup_opts += net_addr->GetLineText(0);
- dup_opts += wxString::Format( wxT(":%d"), net_port->GetValue() );
+ dup_opts += net_addrs[HTTP_ACCESS_OUT]->GetLineText(0);
+ dup_opts += wxString::Format( wxT(":%d"),
+ net_ports[HTTP_ACCESS_OUT]->GetValue() );
dup_opts += wxT("}");
}
if( access_checkboxes[UDP_ACCESS_OUT]->IsChecked() )
if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
dup_opts += wxT("dst=std{access=udp,mux=");
dup_opts += encapsulation + wxT(",url=");
- dup_opts += net_addr->GetLineText(0);
- dup_opts += wxString::Format( wxT(":%d"), net_port->GetValue() );
+ dup_opts += net_addrs[UDP_ACCESS_OUT]->GetLineText(0);
+ dup_opts += wxString::Format( wxT(":%d"),
+ net_ports[UDP_ACCESS_OUT]->GetValue() );
+
+ /* SAP only if UDP */
+ if( sap_checkbox->IsChecked() )
+ {
+ dup_opts += wxT(",sap=\"");
+ dup_opts += sap_addr->GetLineText(0);
+ dup_opts += wxT("\"");
+ }
+
dup_opts += wxT("}");
}
- if( access_checkboxes[UDP_ACCESS_OUT]->IsChecked() )
+ if( access_checkboxes[RTP_ACCESS_OUT]->IsChecked() )
{
if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
dup_opts += wxT("dst=std{access=rtp,mux=");
dup_opts += encapsulation + wxT(",url=");
- dup_opts += net_addr->GetLineText(0);
- dup_opts += wxString::Format( wxT(":%d"), net_port->GetValue() );
+ dup_opts += net_addrs[RTP_ACCESS_OUT]->GetLineText(0);
+ dup_opts += wxString::Format( wxT(":%d"),
+ net_ports[RTP_ACCESS_OUT]->GetValue() );
dup_opts += wxT("}");
}
}
if( !transcode.IsEmpty() || !duplicate.IsEmpty() )
- mrl = wxT("#") + transcode + duplicate;
+ mrl_combo->SetValue( wxT("#") + transcode + duplicate );
else
- mrl = wxT("");
-
- mrl_combo->SetValue( mrl );
+ mrl_combo->SetValue( wxT("") );
}
wxPanel *SoutDialog::AccessPanel( wxWindow* parent )
access_subpanels[1]->SetSizerAndFit( subpanel_sizer );
/* Net rows */
- for( i=2; i < ACCESS_OUT_NUM; i++ )
+ for( i = HTTP_ACCESS_OUT; i < ACCESS_OUT_NUM; i++ )
{
subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
label = new wxStaticText( access_subpanels[i], -1, wxU(_("Address")) );
- net_addr = new wxTextCtrl( access_subpanels[i], NetAddr_Event, wxT(""),
- wxDefaultPosition, wxSize( 200, -1 ),
- wxTE_PROCESS_ENTER);
+ net_addrs[i] = new wxTextCtrl( access_subpanels[i],
+ NetAddr1_Event + i - HTTP_ACCESS_OUT,
+ wxT(""), wxDefaultPosition,
+ wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
subpanel_sizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
- subpanel_sizer->Add( net_addr, 1, wxEXPAND |
+ subpanel_sizer->Add( net_addrs[i], 1, wxEXPAND |
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
int val = config_GetInt( p_intf, "server-port" );
label = new wxStaticText( access_subpanels[i], -1, wxU(_("Port")) );
- net_port = new wxSpinCtrl( access_subpanels[i], NetPort_Event,
+ net_ports[i] = new wxSpinCtrl( access_subpanels[i],
+ NetPort1_Event + i - HTTP_ACCESS_OUT,
wxString::Format(wxT("%d"), val),
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS,
subpanel_sizer->Add( label, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
- subpanel_sizer->Add( net_port, 0,
+ subpanel_sizer->Add( net_ports[i], 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
access_subpanels[i]->SetSizerAndFit( subpanel_sizer );
return panel;
}
+wxPanel *SoutDialog::MiscPanel( wxWindow* parent )
+{
+ wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
+ wxSize(200, 200) );
+
+ // wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 4, 20 );
+ wxStaticBox *panel_box = new wxStaticBox( panel, -1,
+ wxU(_("Miscellaneous Options")) );
+ wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
+ wxVERTICAL );
+
+ /* SAP Row */
+ wxStaticText *label;
+ wxFlexGridSizer *subpanel_sizer;
+
+ misc_subpanels[SAP_MISC] = new wxPanel( panel, -1 );
+ subpanel_sizer = new wxFlexGridSizer( 4, 2, 20 );
+
+ sap_checkbox = new wxCheckBox( misc_subpanels[SAP_MISC], SAPMisc_Event,
+ wxU(_("SAP Announce")) );
+ label = new wxStaticText( misc_subpanels[SAP_MISC], -1,
+ wxU(_("Channel Name ")) );
+ sap_addr = new wxTextCtrl( misc_subpanels[SAP_MISC], SAPAddr_Event,
+ wxT(""), wxDefaultPosition,
+ wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
+
+ subpanel_sizer->Add( sap_checkbox, 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+ subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+ subpanel_sizer->Add( sap_addr, 1, wxEXPAND |
+ wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+
+ misc_subpanels[SAP_MISC]->SetSizerAndFit( subpanel_sizer );
+
+ /* Stuff everything into the main panel */
+ panel_sizer->Add( misc_subpanels[SAP_MISC], 1,
+ wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
+
+ panel->SetSizerAndFit( panel_sizer );
+
+ /* Update misc panel */
+ misc_subpanels[SAP_MISC]->Disable();
+ sap_addr->Disable();
+
+ return panel;
+}
+
wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent )
{
int i;
wxT("MPEG TS"),
wxT("MPEG PS"),
wxT("AVI"),
- wxT("MP4/MOV"),
- wxT("Ogg")
+ wxT("Ogg"),
+ wxT("MP4/MOV")
};
/* Stuff everything into the main panel */
wxT("H263"),
wxT("I263"),
wxT("WMV1"),
+ wxT("WMV2"),
+ wxT("MJPG")
};
static const wxString vbitrates_array[] =
{
video_transc_checkbox =
new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec")));
video_codec_combo =
- new wxComboBox( panel, VideoTranscCodec_Event, wxT("mp4v"),
+ new wxComboBox( panel, VideoTranscCodec_Event, wxT(""),
wxPoint(20,25), wxDefaultSize, WXSIZEOF(vcodecs_array),
vcodecs_array, wxCB_READONLY );
+ video_codec_combo->SetSelection(1);
wxStaticText *bitrate_label =
new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
video_bitrate_combo =
static const wxString acodecs_array[] =
{
wxT("mpga"),
- wxT("a52")
+ wxT("mp3"),
+ wxT("a52"),
+ wxT("vorb")
};
static const wxString abitrates_array[] =
{
wxT("128"),
wxT("96")
};
+ static const wxString achannels_array[] =
+ {
+ wxT("1"),
+ wxT("2"),
+ wxT("4"),
+ wxT("6")
+ };
- wxFlexGridSizer *audio_sizer = new wxFlexGridSizer( 4, 1, 20 );
+ wxFlexGridSizer *audio_sizer = new wxFlexGridSizer( 3, 1, 20 );
audio_transc_checkbox =
new wxCheckBox( panel, AudioTranscEnable_Event, wxU(_("Audio codec")));
audio_codec_combo =
- new wxComboBox( panel, AudioTranscCodec_Event, wxT("mpga"),
- wxPoint(20,25), wxDefaultSize, WXSIZEOF(acodecs_array),
+ new wxComboBox( panel, AudioTranscCodec_Event, wxT(""),
+ wxPoint(10,25), wxDefaultSize, WXSIZEOF(acodecs_array),
acodecs_array, wxCB_READONLY );
+ audio_codec_combo->SetSelection(0);
+ wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 2, 5, 20 );
bitrate_label =
new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
audio_bitrate_combo =
new wxComboBox( panel, AudioTranscBitrate_Event, wxT("192"),
- wxPoint(20,25), wxDefaultSize,
+ wxPoint(10,25), wxDefaultSize,
WXSIZEOF(abitrates_array), abitrates_array );
+ wxStaticText *channels_label =
+ new wxStaticText( panel, -1, wxU(_("Channels")));
+ audio_channels_combo =
+ new wxComboBox( panel, AudioTranscChans_Event, wxT(""),
+ wxPoint(10,25), wxDefaultSize,
+ WXSIZEOF(achannels_array), achannels_array );
+ audio_channels_combo->SetSelection(1);
+ audio_sub_sizer->Add( bitrate_label, 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+ audio_sub_sizer->Add( audio_bitrate_combo, 1,
+ wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+ audio_sub_sizer->Add( channels_label, 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+ audio_sub_sizer->Add( audio_channels_combo, 1,
+ wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+
audio_sizer->Add( audio_transc_checkbox, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
audio_sizer->Add( audio_codec_combo, 1,
wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
- audio_sizer->Add( bitrate_label, 0,
- wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
- audio_sizer->Add( audio_bitrate_combo, 1,
+ audio_sizer->Add( audio_sub_sizer, 1,
wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
/* Stuff everything into the main panel */
return panel;
}
-void SoutDialog::ParseMRL()
-{
- /* Initialise MRL value */
- char *psz_sout = config_GetPsz( p_intf, "sout" );
- if( psz_sout )
- {
- mrl = wxU(psz_sout);
- free( psz_sout );
- }
-
- /* Parse the MRL */
- wxString access = mrl.BeforeFirst( wxT('/') );
- wxString encapsulation = mrl.BeforeFirst( wxT(':') ).AfterFirst(wxT('/'));
-
- if( !access.Cmp( wxT("http") ) )
- {
- i_access_type = HTTP_ACCESS_OUT;
- }
- else if( !access.Cmp( wxT("udp") ) )
- {
- i_access_type = UDP_ACCESS_OUT;
- }
- else if( !access.Cmp( wxT("rtp") ) )
- {
- i_access_type = RTP_ACCESS_OUT;
- }
- else
- {
- i_access_type = FILE_ACCESS_OUT;
- }
-
- if( !encapsulation.Cmp( wxT("ps") ) )
- {
- i_encapsulation_type = PS_ENCAPSULATION;
- }
- else if( !encapsulation.Cmp( wxT("avi") ) )
- {
- i_encapsulation_type = AVI_ENCAPSULATION;
- }
- else if( !encapsulation.Cmp( wxT("ogg") ) )
- {
- i_encapsulation_type = OGG_ENCAPSULATION;
- }
- else
- {
- i_encapsulation_type = TS_ENCAPSULATION;
- }
-
- wxString second_part = mrl.AfterFirst( wxT(':') );
-
- 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( wxT(':') );
- net_addr->SetValue( address );
-
- long int i_port;
- wxString port = second_part.AfterLast( wxT(':') );
- 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( AccessType1_Event + i_access_type );
- OnAccessTypeChange( dummy_event );
-
- /* Update encapsulation output panel */
- dummy_event.SetId( EncapsulationRadio1_Event + i_encapsulation_type );
- OnEncapsulationChange( dummy_event );
-}
-
/*****************************************************************************
* Events methods.
*****************************************************************************/
void SoutDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
+ mrl_combo->Append( mrl_combo->GetValue() );
+ mrl = mrl_combo->GetValue();
EndModal( wxID_OK );
+
}
void SoutDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
void SoutDialog::OnMRLChange( wxCommandEvent& event )
{
- mrl = event.GetString();
+ //mrl = event.GetString();
}
/*****************************************************************************
switch( i_access_type )
{
case UDP_ACCESS_OUT:
+ misc_subpanels[SAP_MISC]->Enable( event.GetInt() );
+
case RTP_ACCESS_OUT:
for( i = 1; i < ENCAPS_NUM; i++ )
{
}
break;
}
+ UpdateMRL();
+}
+
+/*****************************************************************************
+ * SAPMisc panel event methods.
+ *****************************************************************************/
+void SoutDialog::OnSAPMiscChange( wxCommandEvent& event )
+{
+ sap_addr->Enable( event.GetInt() );
+ UpdateMRL();
+}
+/*****************************************************************************
+ * SAPAddr panel event methods.
+ *****************************************************************************/
+void SoutDialog::OnSAPAddrChange( wxCommandEvent& WXUNUSED(event) )
+{
UpdateMRL();
}
void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
{
- wxFileDialog dialog( this, wxU(_("Save file")),
- wxT(""), wxT(""), wxT("*.*"), wxSAVE );
+ wxFileDialog dialog( this, wxU(_("Save file")), wxT(""), wxT(""), wxT("*"),
+ wxSAVE | wxOVERWRITE_PROMPT );
if( dialog.ShowModal() == wxID_OK )
{
case AudioTranscEnable_Event:
audio_codec_combo->Enable( event.GetInt() );
audio_bitrate_combo->Enable( event.GetInt() );
+ audio_channels_combo->Enable( event.GetInt() );
break;
}