1 /*****************************************************************************
2 * streamout.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2001 VideoLAN
5 * $Id: streamout.cpp,v 1.35 2003/11/05 20:06:36 gbazin Exp $
7 * Authors: Gildas Bazin <gbazin@netcourrier.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
28 #include <errno.h> /* ENOMEM */
29 #include <string.h> /* strerror() */
35 #include "wxwindows.h"
36 #include <wx/notebook.h>
37 #include <wx/textctrl.h>
38 #include <wx/combobox.h>
39 #include <wx/spinctrl.h>
40 #include <wx/statline.h>
43 # define wxRB_SINGLE 0
46 /*****************************************************************************
48 *****************************************************************************/
50 /* IDs for the controls and the menu commands */
53 Notebook_Event = wxID_HIGHEST,
60 AccessType1_Event, AccessType2_Event, AccessType3_Event,
61 AccessType4_Event, AccessType5_Event, AccessType6_Event,
62 NetPort1_Event, NetPort2_Event, NetPort3_Event, NetPort4_Event,
63 NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
65 EncapsulationRadio1_Event, EncapsulationRadio2_Event,
66 EncapsulationRadio3_Event, EncapsulationRadio4_Event,
67 EncapsulationRadio5_Event, EncapsulationRadio6_Event,
68 EncapsulationRadio7_Event, EncapsulationRadio8_Event,
70 VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event,
71 AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
72 AudioTranscChans_Event,
74 SAPMisc_Event, SLPMisc_Event, AnnounceAddr_Event
77 BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
79 EVT_BUTTON(wxID_OK, SoutDialog::OnOk)
80 EVT_BUTTON(wxID_CANCEL, SoutDialog::OnCancel)
82 /* Events generated by the access output panel */
83 EVT_CHECKBOX(AccessType1_Event, SoutDialog::OnAccessTypeChange)
84 EVT_CHECKBOX(AccessType2_Event, SoutDialog::OnAccessTypeChange)
85 EVT_CHECKBOX(AccessType3_Event, SoutDialog::OnAccessTypeChange)
86 EVT_CHECKBOX(AccessType4_Event, SoutDialog::OnAccessTypeChange)
87 EVT_CHECKBOX(AccessType5_Event, SoutDialog::OnAccessTypeChange)
88 EVT_CHECKBOX(AccessType6_Event, SoutDialog::OnAccessTypeChange)
89 EVT_TEXT(FileName_Event, SoutDialog::OnFileChange)
90 EVT_BUTTON(FileBrowse_Event, SoutDialog::OnFileBrowse)
91 EVT_CHECKBOX(FileDump_Event, SoutDialog::OnFileDump)
93 EVT_TEXT(NetPort1_Event, SoutDialog::OnNetChange)
94 EVT_TEXT(NetAddr1_Event, SoutDialog::OnNetChange)
95 EVT_TEXT(NetPort2_Event, SoutDialog::OnNetChange)
96 EVT_TEXT(NetAddr2_Event, SoutDialog::OnNetChange)
97 EVT_TEXT(NetPort3_Event, SoutDialog::OnNetChange)
98 EVT_TEXT(NetAddr3_Event, SoutDialog::OnNetChange)
99 EVT_TEXT(NetPort4_Event, SoutDialog::OnNetChange)
100 EVT_TEXT(NetAddr4_Event, SoutDialog::OnNetChange)
102 /* Events generated by the encapsulation panel */
103 EVT_RADIOBUTTON(EncapsulationRadio1_Event,
104 SoutDialog::OnEncapsulationChange)
105 EVT_RADIOBUTTON(EncapsulationRadio2_Event,
106 SoutDialog::OnEncapsulationChange)
107 EVT_RADIOBUTTON(EncapsulationRadio3_Event,
108 SoutDialog::OnEncapsulationChange)
109 EVT_RADIOBUTTON(EncapsulationRadio4_Event,
110 SoutDialog::OnEncapsulationChange)
111 EVT_RADIOBUTTON(EncapsulationRadio5_Event,
112 SoutDialog::OnEncapsulationChange)
113 EVT_RADIOBUTTON(EncapsulationRadio6_Event,
114 SoutDialog::OnEncapsulationChange)
115 EVT_RADIOBUTTON(EncapsulationRadio7_Event,
116 SoutDialog::OnEncapsulationChange)
117 EVT_RADIOBUTTON(EncapsulationRadio8_Event,
118 SoutDialog::OnEncapsulationChange)
120 /* Events generated by the transcoding panel */
121 EVT_CHECKBOX(VideoTranscEnable_Event, SoutDialog::OnTranscodingEnable)
122 EVT_CHECKBOX(AudioTranscEnable_Event, SoutDialog::OnTranscodingEnable)
123 EVT_COMBOBOX(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
124 EVT_TEXT(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
125 EVT_COMBOBOX(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
126 EVT_TEXT(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
127 EVT_COMBOBOX(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
128 EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
129 EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
130 EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
131 EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
132 EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
134 /* Events generated by the misc panel */
135 EVT_CHECKBOX(SAPMisc_Event, SoutDialog::OnSAPMiscChange)
136 EVT_CHECKBOX(SLPMisc_Event, SoutDialog::OnSLPMiscChange)
137 EVT_TEXT(AnnounceAddr_Event, SoutDialog::OnAnnounceAddrChange)
141 /*****************************************************************************
143 *****************************************************************************/
144 SoutDialog::SoutDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
145 wxDialog( _p_parent, -1, wxU(_("Stream output")),
146 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
148 /* Initializations */
150 p_parent = _p_parent;
151 SetIcon( *p_intf->p_sys->p_icon );
153 /* Create a panel to put everything in */
154 wxPanel *panel = new wxPanel( this, -1 );
155 panel->SetAutoLayout( TRUE );
157 /* Create MRL combobox */
158 wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
159 wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
160 wxU(_("Stream output MRL")) );
161 wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
163 wxStaticText *mrl_label = new wxStaticText( panel, -1,
164 wxU(_("Destination Target:")));
165 mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
166 wxPoint(20,25), wxSize(120, -1), 0, NULL );
167 mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
168 "the full MRL you want to open.\n""Alternatively, the field will be "
169 "filled automatically when you use the controls below")) );
171 mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
172 mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
173 mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
175 /* Create the output encapsulation panel */
176 encapsulation_panel = EncapsulationPanel( panel );
178 /* Create the access output panel */
179 access_panel = AccessPanel( panel );
181 /* Create the transcoding panel */
182 transcoding_panel = TranscodingPanel( panel );
184 /* Create the Misc panel */
185 misc_panel = MiscPanel( panel );
188 wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
190 /* Create the buttons */
191 wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
192 ok_button->SetDefault();
193 wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
196 /* Place everything in sizers */
197 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
198 button_sizer->Add( ok_button, 0, wxALL, 5 );
199 button_sizer->Add( cancel_button, 0, wxALL, 5 );
200 button_sizer->Layout();
201 wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
202 wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
203 panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
204 panel_sizer->Add( access_panel, 1, wxEXPAND | wxALL, 5 );
205 panel_sizer->Add( encapsulation_panel, 0, wxEXPAND | wxALL, 5 );
206 panel_sizer->Add( transcoding_panel, 0, wxEXPAND | wxALL, 5 );
207 panel_sizer->Add( misc_panel, 0, wxEXPAND | wxALL, 5 );
208 panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
209 panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
211 panel_sizer->Layout();
212 panel->SetSizerAndFit( panel_sizer );
213 main_sizer->Add( panel, 1, wxGROW, 0 );
214 main_sizer->Layout();
215 SetSizerAndFit( main_sizer );
218 SoutDialog::~SoutDialog()
222 wxArrayString SoutDialog::GetOptions()
224 return SeparateEntries( mrl_combo->GetValue() );
227 /*****************************************************************************
229 *****************************************************************************/
230 void SoutDialog::UpdateMRL()
232 /* Check the demux dump option */
233 if( dump_checkbox->IsChecked() )
237 if( file_combo->GetValue().size() )
238 dumpfile = wxT(" :demuxdump-file=\"") +
239 file_combo->GetValue() + wxT("\"");
240 mrl_combo->SetValue( wxT(":demux=demuxdump") + dumpfile );
245 /* Let's start with the transcode options */
247 if( video_transc_checkbox->IsChecked() ||
248 audio_transc_checkbox->IsChecked() )
250 transcode = wxT("transcode{");
251 if( video_transc_checkbox->IsChecked() )
253 transcode += wxT("vcodec=") + video_codec_combo->GetValue();
254 transcode += wxT(",vb=") + video_bitrate_combo->GetValue();
255 if( audio_transc_checkbox->IsChecked() ) transcode += wxT(",");
257 if( audio_transc_checkbox->IsChecked() )
259 transcode += wxT("acodec=") + audio_codec_combo->GetValue();
260 transcode += wxT(",ab=") + audio_bitrate_combo->GetValue();
261 transcode += wxT(",channels=") + audio_channels_combo->GetValue();
263 transcode += wxT("}");
267 wxString encapsulation;
268 switch( i_encapsulation_type )
270 case PS_ENCAPSULATION:
271 encapsulation = wxT("ps");
273 case MPEG1_ENCAPSULATION:
274 encapsulation = wxT("mpeg1");
276 case AVI_ENCAPSULATION:
277 encapsulation = wxT("avi");
279 case OGG_ENCAPSULATION:
280 encapsulation = wxT("ogg");
282 case MP4_ENCAPSULATION:
283 encapsulation = wxT("mp4");
285 case MOV_ENCAPSULATION:
286 encapsulation = wxT("mov");
288 case ASF_ENCAPSULATION:
289 encapsulation = wxT("asf");
291 case TS_ENCAPSULATION:
293 encapsulation = wxT("ts");
297 /* Now continue with the duplicate option */
299 if( access_checkboxes[PLAY_ACCESS_OUT]->IsChecked() )
301 dup_opts += wxT("dst=display");
303 if( access_checkboxes[FILE_ACCESS_OUT]->IsChecked() )
305 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
306 dup_opts += wxT("dst=std{access=file,mux=");
307 dup_opts += encapsulation + wxT(",url=\"");
308 dup_opts += file_combo->GetValue() + wxT("\"}");
310 if( access_checkboxes[HTTP_ACCESS_OUT]->IsChecked() )
312 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
313 dup_opts += wxT("dst=std{access=http,mux=");
314 dup_opts += encapsulation + wxT(",url=");
315 dup_opts += net_addrs[HTTP_ACCESS_OUT]->GetLineText(0);
316 dup_opts += wxString::Format( wxT(":%d"),
317 net_ports[HTTP_ACCESS_OUT]->GetValue() );
318 dup_opts += wxT("}");
320 if( access_checkboxes[MMSH_ACCESS_OUT]->IsChecked() )
322 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
323 dup_opts += wxT("dst=std{access=mmsh,mux=");
324 dup_opts += encapsulation;
325 if( i_encapsulation_type == ASF_ENCAPSULATION ) dup_opts += wxT("h");
326 dup_opts += wxT(",url=");
327 dup_opts += net_addrs[HTTP_ACCESS_OUT]->GetLineText(0);
328 dup_opts += wxString::Format( wxT(":%d"),
329 net_ports[MMSH_ACCESS_OUT]->GetValue() );
330 dup_opts += wxT("}");
332 if( access_checkboxes[UDP_ACCESS_OUT]->IsChecked() )
334 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
335 dup_opts += wxT("dst=std{access=udp,mux=");
336 dup_opts += encapsulation + wxT(",url=");
337 dup_opts += net_addrs[UDP_ACCESS_OUT]->GetLineText(0);
338 dup_opts += wxString::Format( wxT(":%d"),
339 net_ports[UDP_ACCESS_OUT]->GetValue() );
341 /* SAP only if UDP */
342 if( sap_checkbox->IsChecked() )
344 dup_opts += wxT(",sap=\"");
345 dup_opts += announce_addr->GetLineText(0);
346 dup_opts += wxT("\"");
349 /* SLP only if UDP */
350 if( slp_checkbox->IsChecked() )
352 dup_opts += wxT(",slp=\"");
353 dup_opts += announce_addr->GetLineText(0);
354 dup_opts += wxT("\"");
357 dup_opts += wxT("}");
359 if( access_checkboxes[RTP_ACCESS_OUT]->IsChecked() )
361 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
362 dup_opts += wxT("dst=std{access=rtp,mux=");
363 dup_opts += encapsulation + wxT(",url=");
364 dup_opts += net_addrs[RTP_ACCESS_OUT]->GetLineText(0);
365 dup_opts += wxString::Format( wxT(":%d"),
366 net_ports[RTP_ACCESS_OUT]->GetValue() );
367 dup_opts += wxT("}");
371 if( !dup_opts.IsEmpty() )
373 if( !transcode.IsEmpty() ) duplicate = wxT(":");
374 duplicate += wxT("duplicate{") + dup_opts + wxT("}");
377 if( !transcode.IsEmpty() || !duplicate.IsEmpty() )
378 mrl_combo->SetValue( wxT(":sout=#") + transcode + duplicate );
380 mrl_combo->SetValue( wxT("") );
383 wxPanel *SoutDialog::AccessPanel( wxWindow* parent )
386 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
389 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
390 wxU(_("Output Methods")) );
391 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
394 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 4, 20 );
395 static const wxString access_output_array[] =
397 wxU(_("Play locally")),
405 for( i=0; i < ACCESS_OUT_NUM; i++ )
407 access_checkboxes[i] = new wxCheckBox( panel, AccessType1_Event + i,
408 access_output_array[i] );
409 access_subpanels[i] = new wxPanel( panel, -1 );
412 /* Play locally row */
413 wxFlexGridSizer *subpanel_sizer;
415 label = new wxStaticText( access_subpanels[0], -1, wxT("") );
416 subpanel_sizer = new wxFlexGridSizer( 1, 1, 20 );
417 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
418 access_subpanels[0]->SetSizerAndFit( subpanel_sizer );
419 access_subpanels[0]->Hide();
422 subpanel_sizer = new wxFlexGridSizer( 3, 2, 20 );
423 label = new wxStaticText( access_subpanels[1], -1, wxU(_("Filename")) );
424 file_combo = new wxComboBox( access_subpanels[1], FileName_Event, wxT(""),
425 wxPoint(20,25), wxSize(200, -1), 0, NULL );
426 wxButton *browse_button = new wxButton( access_subpanels[1],
427 FileBrowse_Event, wxU(_("Browse...")) );
428 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
429 subpanel_sizer->Add( file_combo, 1,
430 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
431 subpanel_sizer->Add( browse_button, 0,
432 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
433 subpanel_sizer->Add( new wxPanel(access_subpanels[1], -1), 0,
434 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
435 dump_checkbox = new wxCheckBox( access_subpanels[1], FileDump_Event,
436 wxU(_("Dump raw input")) );
437 subpanel_sizer->Add( dump_checkbox, 0,
438 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, 5 );
440 access_subpanels[1]->SetSizerAndFit( subpanel_sizer );
443 for( i = HTTP_ACCESS_OUT; i < ACCESS_OUT_NUM; i++ )
445 subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
446 label = new wxStaticText( access_subpanels[i], -1, wxU(_("Address")) );
447 net_addrs[i] = new wxTextCtrl( access_subpanels[i],
448 NetAddr1_Event + i - HTTP_ACCESS_OUT,
449 wxT(""), wxDefaultPosition,
450 wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
451 subpanel_sizer->Add( label, 0,
452 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
453 subpanel_sizer->Add( net_addrs[i], 1, wxEXPAND |
454 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
456 int val = config_GetInt( p_intf, "server-port" );
457 label = new wxStaticText( access_subpanels[i], -1, wxU(_("Port")) );
458 net_ports[i] = new wxSpinCtrl( access_subpanels[i],
459 NetPort1_Event + i - HTTP_ACCESS_OUT,
460 wxString::Format(wxT("%d"), val),
461 wxDefaultPosition, wxDefaultSize,
465 subpanel_sizer->Add( label, 0,
466 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
467 subpanel_sizer->Add( net_ports[i], 0,
468 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
470 access_subpanels[i]->SetSizerAndFit( subpanel_sizer );
474 /* Stuff everything into the main panel */
475 for( i=1; i < ACCESS_OUT_NUM; i++ )
477 sizer->Add( access_checkboxes[i], 0,
478 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
479 sizer->Add( access_subpanels[i], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL
480 | wxALIGN_LEFT | wxALL, 5 );
483 panel_sizer->Add( access_checkboxes[0], 0,
484 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
485 panel_sizer->Add( sizer, 1, wxEXPAND | wxTOP, 3 );
487 panel->SetSizerAndFit( panel_sizer );
489 /* Update access type panel */
490 for( i=1; i < ACCESS_OUT_NUM; i++ )
492 access_subpanels[i]->Disable();
498 wxPanel *SoutDialog::MiscPanel( wxWindow* parent )
500 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
503 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
504 wxU(_("Miscellaneous Options")) );
505 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
509 misc_subpanels[ANN_MISC_SOUT] = new wxPanel( panel, -1 );
510 wxFlexGridSizer *subpanel_sizer = new wxFlexGridSizer( 4, 4, 20 );
512 sap_checkbox = new wxCheckBox( misc_subpanels[ANN_MISC_SOUT],SAPMisc_Event,
513 wxU(_("SAP Announce")) );
514 slp_checkbox = new wxCheckBox( misc_subpanels[ANN_MISC_SOUT],SLPMisc_Event,
515 wxU(_("SLP Announce")) );
517 wxStaticText *label = new wxStaticText( misc_subpanels[ANN_MISC_SOUT], -1,
518 wxU(_("Channel Name")) );
519 announce_addr = new wxTextCtrl( misc_subpanels[ANN_MISC_SOUT],
521 wxT(""), wxDefaultPosition,
522 wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
524 subpanel_sizer->Add( sap_checkbox, 0,
525 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
526 subpanel_sizer->Add( slp_checkbox, 0,
527 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
528 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
529 subpanel_sizer->Add( announce_addr, 1, wxEXPAND |
530 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
532 misc_subpanels[ANN_MISC_SOUT]->SetSizerAndFit( subpanel_sizer );
534 /* Stuff everything into the main panel */
535 panel_sizer->Add( misc_subpanels[ANN_MISC_SOUT], 1,
536 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
538 panel->SetSizerAndFit( panel_sizer );
540 /* Update misc panel */
541 misc_subpanels[ANN_MISC_SOUT]->Disable();
542 announce_addr->Disable();
547 wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent )
550 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
553 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
554 wxU(_("Encapsulation Method")) );
555 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
558 static const wxString encapsulation_array[] =
570 /* Stuff everything into the main panel */
571 for( i=0; i < ENCAPS_NUM; i++ )
573 encapsulation_radios[i] =
574 new wxRadioButton( panel, EncapsulationRadio1_Event + i,
575 encapsulation_array[i] );
576 panel_sizer->Add( encapsulation_radios[i], 0,
577 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
581 panel->SetSizerAndFit( panel_sizer );
583 /* Update encapsulation panel */
584 encapsulation_radios[TS_ENCAPSULATION]->SetValue(true);
585 i_encapsulation_type = TS_ENCAPSULATION;
590 wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
592 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
595 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
596 wxU(_("Transcoding options")) );
597 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
600 /* Create video transcoding checkox */
601 static const wxString vcodecs_array[] =
616 static const wxString vbitrates_array[] =
633 wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 4, 1, 20 );
634 video_transc_checkbox =
635 new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec")));
637 new wxComboBox( panel, VideoTranscCodec_Event, wxT(""),
638 wxPoint(20,25), wxDefaultSize, WXSIZEOF(vcodecs_array),
639 vcodecs_array, wxCB_READONLY );
640 video_codec_combo->SetSelection(2);
641 wxStaticText *bitrate_label =
642 new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
643 video_bitrate_combo =
644 new wxComboBox( panel, VideoTranscBitrate_Event, wxT("1024"),
645 wxPoint(20,25), wxDefaultSize,
646 WXSIZEOF(vbitrates_array), vbitrates_array );
647 video_sizer->Add( video_transc_checkbox, 0,
648 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
649 video_sizer->Add( video_codec_combo, 1,
650 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
651 video_sizer->Add( bitrate_label, 0,
652 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
653 video_sizer->Add( video_bitrate_combo, 1,
654 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
656 /* Create audio transcoding checkox */
657 static const wxString acodecs_array[] =
664 static const wxString abitrates_array[] =
675 static const wxString achannels_array[] =
683 wxFlexGridSizer *audio_sizer = new wxFlexGridSizer( 3, 1, 20 );
684 audio_transc_checkbox =
685 new wxCheckBox( panel, AudioTranscEnable_Event, wxU(_("Audio codec")));
687 new wxComboBox( panel, AudioTranscCodec_Event, wxT(""),
688 wxPoint(10,25), wxDefaultSize, WXSIZEOF(acodecs_array),
689 acodecs_array, wxCB_READONLY );
690 audio_codec_combo->SetSelection(0);
691 #if defined( __WXMSW__ )
692 wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 4, 5, 20 );
694 wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 2, 5, 20 );
697 new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
698 audio_bitrate_combo =
699 new wxComboBox( panel, AudioTranscBitrate_Event, wxT("192"),
700 wxPoint(10,25), wxDefaultSize,
701 WXSIZEOF(abitrates_array), abitrates_array );
702 wxStaticText *channels_label =
703 new wxStaticText( panel, -1, wxU(_("Channels")));
704 audio_channels_combo =
705 new wxComboBox( panel, AudioTranscChans_Event, wxT(""),
706 wxPoint(10,25), wxDefaultSize,
707 WXSIZEOF(achannels_array), achannels_array );
708 audio_channels_combo->SetSelection(1);
709 audio_sub_sizer->Add( bitrate_label, 0,
710 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
711 audio_sub_sizer->Add( audio_bitrate_combo, 1,
712 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
713 audio_sub_sizer->Add( channels_label, 0,
714 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
715 audio_sub_sizer->Add( audio_channels_combo, 1,
716 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
718 audio_sizer->Add( audio_transc_checkbox, 0,
719 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
720 audio_sizer->Add( audio_codec_combo, 1,
721 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
722 audio_sizer->Add( audio_sub_sizer, 1,
723 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
725 /* Stuff everything into the main panel */
726 panel_sizer->Add( video_sizer, 0,
727 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
728 panel_sizer->Add( audio_sizer, 0,
729 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
731 panel->SetSizerAndFit( panel_sizer );
733 /* Update transcoding panel */
734 wxCommandEvent event( 0, VideoTranscEnable_Event );
736 OnTranscodingEnable( event );
737 event.SetId( AudioTranscEnable_Event );
738 OnTranscodingEnable( event );
743 /*****************************************************************************
745 *****************************************************************************/
746 void SoutDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
748 mrl_combo->Append( mrl_combo->GetValue() );
752 void SoutDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
754 EndModal( wxID_CANCEL );
757 void SoutDialog::OnMRLChange( wxCommandEvent& event )
759 //mrl = event.GetString();
762 /*****************************************************************************
763 * Access output panel event methods.
764 *****************************************************************************/
765 void SoutDialog::OnAccessTypeChange( wxCommandEvent& event )
768 i_access_type = event.GetId() - AccessType1_Event;
770 access_subpanels[i_access_type]->Enable( event.GetInt() );
772 switch( i_access_type )
775 misc_subpanels[ANN_MISC_SOUT]->Enable( event.GetInt() );
778 for( i = 1; i < ENCAPS_NUM; i++ )
780 encapsulation_radios[i]->Enable( !event.GetInt() );
784 encapsulation_radios[TS_ENCAPSULATION]->SetValue(true);
785 i_encapsulation_type = TS_ENCAPSULATION;
792 /*****************************************************************************
793 * AnnounceMisc panel event methods.
794 *****************************************************************************/
795 void SoutDialog::OnSAPMiscChange( wxCommandEvent& event )
797 if( !slp_checkbox->IsChecked() )
799 announce_addr->Enable( event.GetInt() );
804 void SoutDialog::OnSLPMiscChange( wxCommandEvent& event )
806 if( !sap_checkbox->IsChecked() )
808 announce_addr->Enable( event.GetInt() );
813 /*****************************************************************************
814 * SAPAddr panel event methods.
815 *****************************************************************************/
816 void SoutDialog::OnAnnounceAddrChange( wxCommandEvent& WXUNUSED(event) )
821 /*****************************************************************************
822 * File access output event methods.
823 *****************************************************************************/
824 void SoutDialog::OnFileChange( wxCommandEvent& WXUNUSED(event) )
829 void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
831 wxFileDialog dialog( this, wxU(_("Save file")), wxT(""), wxT(""), wxT("*"),
832 wxSAVE | wxOVERWRITE_PROMPT );
834 if( dialog.ShowModal() == wxID_OK )
836 file_combo->SetValue( dialog.GetPath() );
841 void SoutDialog::OnFileDump( wxCommandEvent& event )
843 misc_panel->Enable( !event.GetInt() );
844 encapsulation_panel->Enable( !event.GetInt() );
845 transcoding_panel->Enable( !event.GetInt() );
847 for( int i = 0; i < ACCESS_OUT_NUM; i++ )
849 if( i != FILE_ACCESS_OUT )
851 access_checkboxes[i]->Enable( !event.GetInt() );
852 access_subpanels[i]->Enable( !event.GetInt() &&
853 access_checkboxes[i]->IsChecked() );
860 /*****************************************************************************
861 * Net access output event methods.
862 *****************************************************************************/
863 void SoutDialog::OnNetChange( wxCommandEvent& WXUNUSED(event) )
868 /*****************************************************************************
869 * Encapsulation panel event methods.
870 *****************************************************************************/
871 void SoutDialog::OnEncapsulationChange( wxCommandEvent& event )
873 i_encapsulation_type = event.GetId() - EncapsulationRadio1_Event;
877 /*****************************************************************************
878 * Transcoding panel event methods.
879 *****************************************************************************/
880 void SoutDialog::OnTranscodingEnable( wxCommandEvent& event )
882 switch( event.GetId() )
884 case VideoTranscEnable_Event:
885 video_codec_combo->Enable( event.GetInt() );
886 video_bitrate_combo->Enable( event.GetInt() );
888 case AudioTranscEnable_Event:
889 audio_codec_combo->Enable( event.GetInt() );
890 audio_bitrate_combo->Enable( event.GetInt() );
891 audio_channels_combo->Enable( event.GetInt() );
898 void SoutDialog::OnTranscodingChange( wxCommandEvent& event )