1 /*****************************************************************************
2 * streamout.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2004 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include "dialogs/streamout.hpp"
29 #include <wx/spinctrl.h>
30 #include <wx/combobox.h>
31 #include <wx/statline.h>
33 #include "streamdata.h"
36 # define wxRB_SINGLE 0
39 /*****************************************************************************
41 *****************************************************************************/
43 /* IDs for the controls and the menu commands */
46 Notebook_Event = wxID_HIGHEST,
53 AccessType1_Event, AccessType2_Event, AccessType3_Event,
54 AccessType4_Event, AccessType5_Event, AccessType6_Event,
55 NetPort1_Event, NetPort2_Event, NetPort3_Event, NetPort4_Event,
56 NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
58 EncapsulationRadio1_Event, EncapsulationRadio2_Event,
59 EncapsulationRadio3_Event, EncapsulationRadio4_Event,
60 EncapsulationRadio5_Event, EncapsulationRadio6_Event,
61 EncapsulationRadio7_Event, EncapsulationRadio8_Event,
62 EncapsulationRadio9_Event, EncapsulationRadio10_Event,
64 VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event,
65 VideoTranscScale_Event,
66 AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
67 AudioTranscChans_Event,
68 SubtitlesTranscEnable_Event, SubtitlesTranscCodec_Event,
69 SubtitlesOverlayEnable_Event,
71 SAPMisc_Event, AnnounceGroup_Event, AnnounceAddr_Event,
75 BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
77 EVT_BUTTON(wxID_OK, SoutDialog::OnOk)
78 EVT_BUTTON(wxID_CANCEL, SoutDialog::OnCancel)
80 /* Events generated by the access output panel */
81 EVT_CHECKBOX(AccessType1_Event, SoutDialog::OnAccessTypeChange)
82 EVT_CHECKBOX(AccessType2_Event, SoutDialog::OnAccessTypeChange)
83 EVT_CHECKBOX(AccessType3_Event, SoutDialog::OnAccessTypeChange)
84 EVT_CHECKBOX(AccessType4_Event, SoutDialog::OnAccessTypeChange)
85 EVT_CHECKBOX(AccessType5_Event, SoutDialog::OnAccessTypeChange)
86 EVT_CHECKBOX(AccessType6_Event, SoutDialog::OnAccessTypeChange)
87 EVT_TEXT(FileName_Event, SoutDialog::OnFileChange)
88 EVT_BUTTON(FileBrowse_Event, SoutDialog::OnFileBrowse)
89 EVT_CHECKBOX(FileDump_Event, SoutDialog::OnFileDump)
91 EVT_TEXT(NetPort1_Event, SoutDialog::OnNetChange)
92 EVT_TEXT(NetAddr1_Event, SoutDialog::OnNetChange)
93 EVT_TEXT(NetPort2_Event, SoutDialog::OnNetChange)
94 EVT_TEXT(NetAddr2_Event, SoutDialog::OnNetChange)
95 EVT_TEXT(NetPort3_Event, SoutDialog::OnNetChange)
96 EVT_TEXT(NetAddr3_Event, SoutDialog::OnNetChange)
97 EVT_TEXT(NetPort4_Event, SoutDialog::OnNetChange)
98 EVT_TEXT(NetAddr4_Event, SoutDialog::OnNetChange)
100 /* Events generated by the encapsulation panel */
101 EVT_RADIOBUTTON(EncapsulationRadio1_Event,
102 SoutDialog::OnEncapsulationChange)
103 EVT_RADIOBUTTON(EncapsulationRadio2_Event,
104 SoutDialog::OnEncapsulationChange)
105 EVT_RADIOBUTTON(EncapsulationRadio3_Event,
106 SoutDialog::OnEncapsulationChange)
107 EVT_RADIOBUTTON(EncapsulationRadio4_Event,
108 SoutDialog::OnEncapsulationChange)
109 EVT_RADIOBUTTON(EncapsulationRadio5_Event,
110 SoutDialog::OnEncapsulationChange)
111 EVT_RADIOBUTTON(EncapsulationRadio6_Event,
112 SoutDialog::OnEncapsulationChange)
113 EVT_RADIOBUTTON(EncapsulationRadio7_Event,
114 SoutDialog::OnEncapsulationChange)
115 EVT_RADIOBUTTON(EncapsulationRadio8_Event,
116 SoutDialog::OnEncapsulationChange)
117 EVT_RADIOBUTTON(EncapsulationRadio9_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_CHECKBOX(SubtitlesTranscEnable_Event, SoutDialog::OnTranscodingEnable)
124 EVT_CHECKBOX(SubtitlesOverlayEnable_Event, SoutDialog::OnTranscodingEnable)
125 EVT_COMBOBOX(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
126 EVT_TEXT(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
127 EVT_COMBOBOX(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
128 EVT_TEXT(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
129 EVT_COMBOBOX(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
130 EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
131 EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
132 EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
133 EVT_COMBOBOX(VideoTranscScale_Event, SoutDialog::OnTranscodingChange)
134 EVT_TEXT(VideoTranscScale_Event, SoutDialog::OnTranscodingChange)
135 EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
136 EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
137 EVT_COMBOBOX(SubtitlesTranscCodec_Event, SoutDialog::OnTranscodingChange)
138 EVT_TEXT(SubtitlesTranscCodec_Event, SoutDialog::OnTranscodingChange)
140 /* Events generated by the misc panel */
141 EVT_CHECKBOX(SAPMisc_Event, SoutDialog::OnSAPMiscChange)
142 EVT_TEXT(AnnounceGroup_Event, SoutDialog::OnAnnounceGroupChange)
143 EVT_TEXT(AnnounceAddr_Event, SoutDialog::OnAnnounceAddrChange)
144 EVT_CHECKBOX(SoutAll_Event, SoutDialog::OnAnnounceGroupChange)
148 /*****************************************************************************
150 *****************************************************************************/
151 SoutDialog::SoutDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
152 wxDialog( _p_parent, -1, wxU(_("Stream output")),
153 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
155 /* Initializations */
157 p_parent = _p_parent;
158 SetIcon( *p_intf->p_sys->p_icon );
160 /* Create a panel to put everything in */
161 wxPanel *panel = new wxPanel( this, -1 );
162 panel->SetAutoLayout( TRUE );
164 /* Create MRL combobox */
165 wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
166 wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
167 wxU(_("Stream output MRL")) );
168 wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
170 wxStaticText *mrl_label = new wxStaticText( panel, -1,
171 wxU(_("Destination Target:")));
172 mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
173 wxPoint(20,25), wxSize(120, -1) );
174 mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
175 "the full MRL you want to open.\n""Alternatively, the field will be "
176 "filled automatically when you use the controls below")) );
178 mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
179 mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
180 mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
182 /* Create the output encapsulation panel */
183 encapsulation_panel = EncapsulationPanel( panel );
185 /* Create the access output panel */
186 access_panel = AccessPanel( panel );
188 /* Create the transcoding panel */
189 transcoding_panel = TranscodingPanel( panel );
191 /* Create the Misc panel */
192 misc_panel = MiscPanel( panel );
194 /* Create the buttons */
195 wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
196 ok_button->SetDefault();
197 wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
200 /* Place everything in sizers */
201 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
202 button_sizer->Add( ok_button, 0, wxALL, 5 );
203 button_sizer->Add( cancel_button, 0, wxALL, 5 );
204 button_sizer->Layout();
205 wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
206 wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
207 panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
208 panel_sizer->Add( access_panel, 1, wxEXPAND | wxALL, 5 );
209 panel_sizer->Add( encapsulation_panel, 0, wxEXPAND | wxALL, 5 );
210 panel_sizer->Add( transcoding_panel, 0, wxEXPAND | wxALL, 5 );
211 panel_sizer->Add( misc_panel, 0, wxEXPAND | wxALL, 5 );
212 panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
214 panel_sizer->Layout();
215 panel->SetSizerAndFit( panel_sizer );
216 main_sizer->Add( panel, 1, wxGROW, 0 );
217 main_sizer->Layout();
218 SetSizerAndFit( main_sizer );
221 SoutDialog::~SoutDialog()
225 wxArrayString SoutDialog::GetOptions()
227 return SeparateEntries( mrl_combo->GetValue() );
230 /*****************************************************************************
232 *****************************************************************************/
233 void SoutDialog::UpdateMRL()
235 /* Check the demux dump option */
236 if( dump_checkbox->IsChecked() )
240 if( file_combo->GetValue().size() )
241 dumpfile = wxT(" :demuxdump-file=\"") +
242 file_combo->GetValue() + wxT("\"");
243 mrl_combo->SetValue( wxT(":demux=dump") + dumpfile );
248 /* Let's start with the transcode options */
250 if( video_transc_checkbox->IsChecked() ||
251 audio_transc_checkbox->IsChecked() ||
252 subtitles_transc_checkbox->IsChecked() ||
253 subtitles_overlay_checkbox->IsChecked() )
255 transcode = wxT("transcode{");
256 if( video_transc_checkbox->IsChecked() )
258 transcode += wxT("vcodec=") + video_codec_combo->GetValue();
259 transcode += wxT(",vb=") + video_bitrate_combo->GetValue();
260 transcode += wxT(",scale=") + video_scale_combo->GetValue();
261 if( audio_transc_checkbox->IsChecked() ||
262 subtitles_transc_checkbox->IsChecked() ||
263 subtitles_overlay_checkbox->IsChecked() )
264 transcode += wxT(",");
266 if( audio_transc_checkbox->IsChecked() )
268 transcode += wxT("acodec=") + audio_codec_combo->GetValue();
269 transcode += wxT(",ab=") + audio_bitrate_combo->GetValue();
270 transcode += wxT(",channels=") + audio_channels_combo->GetValue();
271 if( subtitles_transc_checkbox->IsChecked() ||
272 subtitles_overlay_checkbox->IsChecked() )
273 transcode += wxT(",");
275 if( subtitles_transc_checkbox->IsChecked() )
277 transcode += wxT("scodec=") + subtitles_codec_combo->GetValue();
279 if( subtitles_overlay_checkbox->IsChecked() )
281 transcode += wxT("soverlay");
283 transcode += wxT("}");
287 wxString encapsulation;
288 switch( i_encapsulation_type )
290 case PS_ENCAPSULATION:
291 encapsulation = wxT("ps");
293 case MPEG1_ENCAPSULATION:
294 encapsulation = wxT("mpeg1");
296 case AVI_ENCAPSULATION:
297 encapsulation = wxT("avi");
299 case OGG_ENCAPSULATION:
300 encapsulation = wxT("ogg");
302 case RAW_ENCAPSULATION:
303 encapsulation = wxT("raw");
305 case MP4_ENCAPSULATION:
306 encapsulation = wxT("mp4");
308 case MOV_ENCAPSULATION:
309 encapsulation = wxT("mov");
311 case ASF_ENCAPSULATION:
312 encapsulation = wxT("asf");
314 case WAV_ENCAPSULATION:
315 encapsulation = wxT("wav");
317 case TS_ENCAPSULATION:
319 encapsulation = wxT("ts");
323 /* Now continue with the duplicate option */
325 if( access_checkboxes[PLAY_ACCESS_OUT]->IsChecked() )
327 dup_opts += wxT("dst=display");
329 if( access_checkboxes[FILE_ACCESS_OUT]->IsChecked() )
331 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
332 dup_opts += wxT("dst=std{access=file,mux=");
333 dup_opts += encapsulation + wxT(",dst=\"");
334 dup_opts += file_combo->GetValue() + wxT("\"}");
336 if( access_checkboxes[HTTP_ACCESS_OUT]->IsChecked() )
338 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
339 dup_opts += wxT("dst=std{access=http,mux=");
340 dup_opts += encapsulation + wxT(",dst=");
341 dup_opts += net_addrs[HTTP_ACCESS_OUT]->GetLineText(0);
342 dup_opts += wxString::Format( wxT(":%d"),
343 net_ports[HTTP_ACCESS_OUT]->GetValue() );
344 dup_opts += wxT("}");
346 if( access_checkboxes[MMSH_ACCESS_OUT]->IsChecked() )
348 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
349 dup_opts += wxT("dst=std{access=mmsh,mux=");
350 dup_opts += encapsulation;
351 if( i_encapsulation_type == ASF_ENCAPSULATION ) dup_opts += wxT("h");
352 dup_opts += wxT(",dst=");
353 dup_opts += net_addrs[MMSH_ACCESS_OUT]->GetLineText(0);
354 dup_opts += wxString::Format( wxT(":%d"),
355 net_ports[MMSH_ACCESS_OUT]->GetValue() );
356 dup_opts += wxT("}");
358 if( access_checkboxes[RTP_ACCESS_OUT]->IsChecked() )
360 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
361 dup_opts += wxT("dst=std{access=rtp,mux=");
362 dup_opts += encapsulation + wxT(",dst=");
364 wxString rtp_addr = net_addrs[RTP_ACCESS_OUT]->GetLineText(0);
365 if ((rtp_addr[0u] != '[') && (rtp_addr.Find(':') != -1))
367 dup_opts += wxT ("[") + rtp_addr + wxT ("]");
371 dup_opts += rtp_addr;
373 dup_opts += wxString::Format( wxT(":%d"),
374 net_ports[RTP_ACCESS_OUT]->GetValue() );
377 if( sap_checkbox->IsChecked() )
379 dup_opts += wxT(",sap");
380 if( ! announce_group->GetLineText(0).IsEmpty() )
382 dup_opts += wxT(",group=\"");
383 dup_opts += announce_group->GetLineText(0);
384 dup_opts += wxT("\"");
386 if( ! announce_addr->GetLineText(0).IsEmpty() )
388 dup_opts += wxT(",name=\"");
389 dup_opts += announce_addr->GetLineText(0);
390 dup_opts += wxT("\"");
394 dup_opts += wxT("}");
397 if( access_checkboxes[UDP_ACCESS_OUT]->IsChecked() )
399 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
400 dup_opts += wxT("dst=std{access=udp,mux=");
401 dup_opts += encapsulation + wxT(",dst=");
403 wxString udp_addr = net_addrs[UDP_ACCESS_OUT]->GetLineText(0);
404 if ((udp_addr[0u] != '[') && (udp_addr.Find(':') != -1))
406 dup_opts += wxT ("[") + udp_addr + wxT ("]");
410 dup_opts += udp_addr;
412 dup_opts += wxString::Format( wxT(":%d"),
413 net_ports[UDP_ACCESS_OUT]->GetValue() );
416 if( sap_checkbox->IsChecked() )
418 dup_opts += wxT(",sap");
419 if( ! announce_group->GetLineText(0).IsEmpty() )
421 dup_opts += wxT(",group=\"");
422 dup_opts += announce_group->GetLineText(0);
423 dup_opts += wxT("\"");
425 if( ! announce_addr->GetLineText(0).IsEmpty() )
427 dup_opts += wxT(",name=\"");
428 dup_opts += announce_addr->GetLineText(0);
429 dup_opts += wxT("\"");
433 dup_opts += wxT("}");
437 if( !dup_opts.IsEmpty() )
439 if( !transcode.IsEmpty() ) duplicate = wxT(":");
440 duplicate += wxT("duplicate{") + dup_opts + wxT("}");
444 if( (!transcode.IsEmpty() || !duplicate.IsEmpty()) &&
445 sout_all_checkbox->IsChecked() )
447 misc = wxT(" :sout-all");
450 if( !transcode.IsEmpty() || !duplicate.IsEmpty() )
451 mrl_combo->SetValue( wxT(":sout=#") + transcode + duplicate + misc );
453 mrl_combo->SetValue( wxT("") );
456 wxPanel *SoutDialog::AccessPanel( wxWindow* parent )
459 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
462 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
463 wxU(_("Output methods")) );
464 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
467 /*wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 4, 20 );*/
468 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 0, 20 );
469 static const wxString access_output_array[] =
471 wxU(_("Play locally")),
479 for( i=0; i < ACCESS_OUT_NUM; i++ )
481 access_checkboxes[i] = new wxCheckBox( panel, AccessType1_Event + i,
482 access_output_array[i] );
483 access_subpanels[i] = new wxPanel( panel, -1 );
486 /* Play locally row */
487 wxFlexGridSizer *subpanel_sizer;
489 label = new wxStaticText( access_subpanels[0], -1, wxT("") );
490 subpanel_sizer = new wxFlexGridSizer( 1, 1, 20 );
491 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
492 access_subpanels[0]->SetSizerAndFit( subpanel_sizer );
493 access_subpanels[0]->Hide();
496 /*subpanel_sizer = new wxFlexGridSizer( 3, 2, 20 );*/
497 subpanel_sizer = new wxFlexGridSizer( 4, 1, 10);
498 label = new wxStaticText( access_subpanels[1], -1, wxU(_("Filename")) );
499 file_combo = new wxComboBox( access_subpanels[1], FileName_Event, wxT(""),
500 wxPoint(20,25), wxSize(200, -1) );
501 wxButton *browse_button = new wxButton( access_subpanels[1],
502 FileBrowse_Event, wxU(_("Browse...")) );
503 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
504 subpanel_sizer->Add( file_combo, 1,
505 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
506 subpanel_sizer->Add( browse_button, 0,
507 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
508 /*subpanel_sizer->Add( new wxPanel(access_subpanels[1], -1), 0,*/
509 /* wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );*/
510 dump_checkbox = new wxCheckBox( access_subpanels[1], FileDump_Event,
511 wxU(_("Dump raw input")) );
512 subpanel_sizer->Add( dump_checkbox, 0,
513 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, 5 );
515 access_subpanels[1]->SetSizerAndFit( subpanel_sizer );
518 for( i = HTTP_ACCESS_OUT; i < ACCESS_OUT_NUM; i++ )
520 subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
521 label = new wxStaticText( access_subpanels[i], -1, wxU(_("Address")) );
522 net_addrs[i] = new wxTextCtrl( access_subpanels[i],
523 NetAddr1_Event + i - HTTP_ACCESS_OUT,
524 wxT(""), wxDefaultPosition,
525 wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
526 subpanel_sizer->Add( label, 0,
527 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
528 subpanel_sizer->Add( net_addrs[i], 1, wxEXPAND |
529 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
531 int val = config_GetInt( p_intf, "server-port" );
532 label = new wxStaticText( access_subpanels[i], -1, wxU(_("Port")) );
533 net_ports[i] = new wxSpinCtrl( access_subpanels[i],
534 NetPort1_Event + i - HTTP_ACCESS_OUT,
535 wxString::Format(wxT("%d"), val),
536 wxDefaultPosition, wxDefaultSize,
540 subpanel_sizer->Add( label, 0,
541 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
542 subpanel_sizer->Add( net_ports[i], 0,
543 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
545 access_subpanels[i]->SetSizerAndFit( subpanel_sizer );
549 /* Stuff everything into the main panel */
550 for( i=1; i < ACCESS_OUT_NUM; i++ )
552 sizer->Add( access_checkboxes[i], 0,
553 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
554 sizer->Add( access_subpanels[i], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL
555 | wxALIGN_LEFT | wxALL, 5 );
558 panel_sizer->Add( access_checkboxes[0], 0,
559 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
560 panel_sizer->Add( sizer, 1, wxEXPAND | wxTOP, 3 );
562 panel->SetSizerAndFit( panel_sizer );
564 /* Update access type panel */
565 for( i=1; i < ACCESS_OUT_NUM; i++ )
567 access_subpanels[i]->Disable();
573 wxPanel *SoutDialog::MiscPanel( wxWindow* parent )
575 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
578 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
579 wxU(_("Miscellaneous options")) );
580 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
584 misc_subpanels[ANN_MISC_SOUT] = new wxPanel( panel, -1 );
585 misc_subpanels[TTL_MISC_SOUT] = new wxPanel( panel, -1 );
586 wxFlexGridSizer *subpanel_sizer = new wxFlexGridSizer( 3, 4, 20 );
587 wxFlexGridSizer *subpanel_sub_sizer = new wxFlexGridSizer( 5, 4, 20 );
588 wxFlexGridSizer *subpanel2_sizer = new wxFlexGridSizer( 3, 4, 20 );
590 sap_checkbox = new wxCheckBox( misc_subpanels[ANN_MISC_SOUT],SAPMisc_Event,
591 wxU(_("SAP announce")) );
592 wxStaticText *label_g = new wxStaticText( misc_subpanels[ANN_MISC_SOUT], -1,
593 wxU(_("Group name")) );
594 announce_group = new wxTextCtrl( misc_subpanels[ANN_MISC_SOUT],
596 wxT(""), wxDefaultPosition,
597 wxSize( 100, -1 ), wxTE_PROCESS_ENTER);
599 wxStaticText *label = new wxStaticText( misc_subpanels[ANN_MISC_SOUT], -1,
600 wxU(_("Channel name")) );
601 announce_addr = new wxTextCtrl( misc_subpanels[ANN_MISC_SOUT],
603 wxT(""), wxDefaultPosition,
604 wxSize( 100, -1 ), wxTE_PROCESS_ENTER);
606 wxStaticText *ttl_label = new wxStaticText( misc_subpanels[TTL_MISC_SOUT], -1,
607 wxU(_("Time-To-Live (TTL)")) );
608 ttl_spin = new wxSpinCtrl( misc_subpanels[TTL_MISC_SOUT], -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
609 0, 1, 255, config_GetInt( p_intf, "ttl" ) );
611 subpanel_sizer->Add( sap_checkbox, 0,
612 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
613 subpanel_sub_sizer->Add( label_g, 0, wxALIGN_RIGHT |
614 wxALIGN_CENTER_VERTICAL );
615 subpanel_sub_sizer->Add( announce_group, 1, wxEXPAND |
616 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
617 subpanel_sub_sizer->Add( label, 0, wxALIGN_RIGHT |
618 wxALIGN_CENTER_VERTICAL );
619 subpanel_sub_sizer->Add( announce_addr, 1, wxEXPAND |
620 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
621 subpanel_sizer->Add( subpanel_sub_sizer, 1, wxEXPAND |
622 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
624 sout_all_checkbox = new wxCheckBox( misc_subpanels[TTL_MISC_SOUT],
625 SoutAll_Event, wxU(_("Select all elementary streams")) );
626 subpanel2_sizer->Add( sout_all_checkbox, 1,
627 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
628 subpanel2_sizer->Add( ttl_label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
629 subpanel2_sizer->Add( ttl_spin, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
631 misc_subpanels[ANN_MISC_SOUT]->SetSizerAndFit( subpanel_sizer );
632 misc_subpanels[TTL_MISC_SOUT]->SetSizerAndFit( subpanel2_sizer );
634 /* Stuff everything into the main panel */
635 panel_sizer->Add( misc_subpanels[ANN_MISC_SOUT], 1,
636 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
638 panel_sizer->Add( misc_subpanels[TTL_MISC_SOUT], 1,
639 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
642 panel->SetSizerAndFit( panel_sizer );
644 /* Update misc panel */
645 misc_subpanels[ANN_MISC_SOUT]->Disable();
646 announce_group->Disable();
647 announce_addr->Disable();
652 wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent )
655 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
658 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
659 wxU(_("Encapsulation Method")) );
660 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
663 static const wxString encapsulation_array[] =
676 /* Stuff everything into the main panel */
677 for( i = 0; i < WXSIZEOF(encapsulation_array); i++ )
679 encapsulation_radios[i] =
680 new wxRadioButton( panel, EncapsulationRadio1_Event + i,
681 encapsulation_array[i] );
682 panel_sizer->Add( encapsulation_radios[i], 0,
683 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
687 for( i = WXSIZEOF(encapsulation_array); i < ENCAPS_NUM; i++ )
689 encapsulation_radios[i] =
690 new wxRadioButton( panel, EncapsulationRadio1_Event + i, wxT("") );
691 encapsulation_radios[i]->Hide();
694 panel->SetSizerAndFit( panel_sizer );
696 /* Update encapsulation panel */
697 encapsulation_radios[TS_ENCAPSULATION]->SetValue(true);
698 i_encapsulation_type = TS_ENCAPSULATION;
703 wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
705 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
708 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
709 wxU(_("Transcoding options")) );
710 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
713 /* Create video transcoding checkox */
714 static const wxString wxvcodecs_array[] =
730 static const wxString vbitrates_array[] =
747 static const wxString vscales_array[] =
759 wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 6, 1, 20 );
760 #if defined( __WXMSW__ )
761 wxFlexGridSizer *video_sub_sizer = new wxFlexGridSizer( 4, 5, 20 );
763 wxFlexGridSizer *video_sub_sizer = new wxFlexGridSizer( 2, 5, 20 );
765 video_transc_checkbox =
766 new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec")));
768 new wxComboBox( panel, VideoTranscCodec_Event, wxvcodecs_array[2],
769 wxPoint(20,25), wxDefaultSize,
770 WXSIZEOF(wxvcodecs_array),
771 wxvcodecs_array, wxCB_READONLY );
772 video_codec_combo->SetSelection(2);
773 wxStaticText *bitrate_label =
774 new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
775 video_bitrate_combo =
776 new wxComboBox( panel, VideoTranscBitrate_Event, wxT("1024"),
777 wxPoint(20,25), wxDefaultSize,
778 WXSIZEOF(vbitrates_array), vbitrates_array );
779 wxStaticText *scale_label =
780 new wxStaticText( panel, -1, wxU(_("Scale")));
782 new wxComboBox( panel, VideoTranscScale_Event, wxT("1"),
783 wxPoint(20,25), wxDefaultSize,
784 WXSIZEOF(vscales_array), vscales_array );
785 video_sizer->Add( video_transc_checkbox, 0,
786 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
787 video_sizer->Add( video_codec_combo, 1,
788 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
789 video_sub_sizer->Add( bitrate_label, 0,
790 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
791 video_sub_sizer->Add( video_bitrate_combo, 1,
792 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
793 video_sub_sizer->Add( scale_label, 0,
794 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
795 video_sub_sizer->Add( video_scale_combo, 1,
796 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
797 video_sizer->Add( video_sub_sizer, 1, wxEXPAND |
798 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
800 /* Create audio transcoding checkox */
801 static const wxString wxacodecs_array[] =
814 static const wxString achannels_array[] =
822 static const wxString abitrates_array[] =
834 wxFlexGridSizer *audio_sizer = new wxFlexGridSizer( 3, 1, 20 );
835 audio_transc_checkbox =
836 new wxCheckBox( panel, AudioTranscEnable_Event, wxU(_("Audio codec")));
838 new wxComboBox( panel, AudioTranscCodec_Event, wxacodecs_array[0],
839 wxPoint(10,25), wxDefaultSize,
840 WXSIZEOF(wxacodecs_array),
841 wxacodecs_array, wxCB_READONLY );
842 audio_codec_combo->SetSelection(0);
843 #if defined( __WXMSW__ )
844 wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 4, 5, 20 );
846 wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 2, 5, 20 );
849 new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
850 audio_bitrate_combo =
851 new wxComboBox( panel, AudioTranscBitrate_Event, wxT("192"),
852 wxPoint(10,25), wxDefaultSize,
853 WXSIZEOF(abitrates_array), abitrates_array );
854 wxStaticText *channels_label =
855 new wxStaticText( panel, -1, wxU(_("Channels")));
856 audio_channels_combo =
857 new wxComboBox( panel, AudioTranscChans_Event, achannels_array[1],
858 wxPoint(10,25), wxDefaultSize,
859 WXSIZEOF(achannels_array), achannels_array );
860 audio_channels_combo->SetSelection(1);
861 audio_sub_sizer->Add( bitrate_label, 0,
862 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
863 audio_sub_sizer->Add( audio_bitrate_combo, 1,
864 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
865 audio_sub_sizer->Add( channels_label, 0,
866 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
867 audio_sub_sizer->Add( audio_channels_combo, 1,
868 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
870 audio_sizer->Add( audio_transc_checkbox, 0,
871 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
872 audio_sizer->Add( audio_codec_combo, 1,
873 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
874 audio_sizer->Add( audio_sub_sizer, 1,
875 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
877 /* Create subtitles transcoding checkox */
878 static const wxString wxscodecs_array[] =
883 wxFlexGridSizer *subtitles_sizer = new wxFlexGridSizer( 3, 1, 20 );
884 subtitles_transc_checkbox =
885 new wxCheckBox( panel, SubtitlesTranscEnable_Event,
886 wxU(_("Subtitles codec")));
887 subtitles_codec_combo =
888 new wxComboBox( panel, SubtitlesTranscCodec_Event, wxscodecs_array[0],
889 wxPoint(10,25), wxDefaultSize,
890 WXSIZEOF(wxscodecs_array),
891 wxscodecs_array, wxCB_READONLY );
892 subtitles_codec_combo->SetSelection(0);
893 subtitles_overlay_checkbox =
894 new wxCheckBox( panel, SubtitlesOverlayEnable_Event,
895 wxU(_("Subtitles overlay")));
897 subtitles_sizer->Add( subtitles_transc_checkbox, 0,
898 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
899 subtitles_sizer->Add( subtitles_codec_combo, 1,
900 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
901 subtitles_sizer->Add( subtitles_overlay_checkbox, 0,
902 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
904 /* Stuff everything into the main panel */
905 panel_sizer->Add( video_sizer, 0,
906 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
907 panel_sizer->Add( audio_sizer, 0,
908 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
909 panel_sizer->Add( subtitles_sizer, 0,
910 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
912 panel->SetSizerAndFit( panel_sizer );
914 /* Update transcoding panel */
915 wxCommandEvent event( 0, VideoTranscEnable_Event );
917 OnTranscodingEnable( event );
918 event.SetId( AudioTranscEnable_Event );
919 OnTranscodingEnable( event );
920 event.SetId( SubtitlesTranscEnable_Event );
921 OnTranscodingEnable( event );
926 /*****************************************************************************
928 *****************************************************************************/
929 void SoutDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
931 mrl_combo->Append( mrl_combo->GetValue() );
932 config_PutInt( p_intf, "ttl", ttl_spin->GetValue());
936 void SoutDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
938 EndModal( wxID_CANCEL );
941 void SoutDialog::OnMRLChange( wxCommandEvent& event )
943 //mrl = event.GetString();
946 /*****************************************************************************
947 * Access output panel event methods.
948 *****************************************************************************/
949 void SoutDialog::OnAccessTypeChange( wxCommandEvent& event )
952 i_access_type = event.GetId() - AccessType1_Event;
954 access_subpanels[i_access_type]->Enable( event.GetInt() );
956 switch( i_access_type )
960 misc_subpanels[ANN_MISC_SOUT]->Enable( event.GetInt() );
962 for( i = 1; i < ENCAPS_NUM; i++ )
964 encapsulation_radios[i]->Enable( !event.GetInt() );
968 encapsulation_radios[TS_ENCAPSULATION]->SetValue(true);
969 i_encapsulation_type = TS_ENCAPSULATION;
976 /*****************************************************************************
977 * AnnounceMisc panel event methods.
978 *****************************************************************************/
979 void SoutDialog::OnSAPMiscChange( wxCommandEvent& event )
981 announce_addr->Enable( event.GetInt() );
982 announce_group->Enable( event.GetInt() );
986 /*****************************************************************************
987 * SAPAddr panel event methods.
988 *****************************************************************************/
989 void SoutDialog::OnAnnounceAddrChange( wxCommandEvent& WXUNUSED(event) )
994 void SoutDialog::OnAnnounceGroupChange( wxCommandEvent& WXUNUSED(event) )
999 /*****************************************************************************
1000 * File access output event methods.
1001 *****************************************************************************/
1002 void SoutDialog::OnFileChange( wxCommandEvent& WXUNUSED(event) )
1007 void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
1009 wxFileDialog dialog( this, wxU(_("Save file")), wxT(""), wxT(""), wxT("*"),
1010 wxSAVE | wxOVERWRITE_PROMPT );
1012 if( dialog.ShowModal() == wxID_OK )
1014 file_combo->SetValue( dialog.GetPath() );
1019 void SoutDialog::OnFileDump( wxCommandEvent& event )
1021 misc_panel->Enable( !event.GetInt() );
1022 encapsulation_panel->Enable( !event.GetInt() );
1023 transcoding_panel->Enable( !event.GetInt() );
1025 for( int i = 0; i < ACCESS_OUT_NUM; i++ )
1027 if( i != FILE_ACCESS_OUT )
1029 access_checkboxes[i]->Enable( !event.GetInt() );
1030 access_subpanels[i]->Enable( !event.GetInt() &&
1031 access_checkboxes[i]->IsChecked() );
1038 /*****************************************************************************
1039 * Net access output event methods.
1040 *****************************************************************************/
1041 void SoutDialog::OnNetChange( wxCommandEvent& WXUNUSED(event) )
1046 /*****************************************************************************
1047 * Encapsulation panel event methods.
1048 *****************************************************************************/
1049 void SoutDialog::OnEncapsulationChange( wxCommandEvent& event )
1051 i_encapsulation_type = event.GetId() - EncapsulationRadio1_Event;
1055 /*****************************************************************************
1056 * Transcoding panel event methods.
1057 *****************************************************************************/
1058 void SoutDialog::OnTranscodingEnable( wxCommandEvent& event )
1060 switch( event.GetId() )
1062 case VideoTranscEnable_Event:
1063 video_codec_combo->Enable( event.GetInt() );
1064 video_bitrate_combo->Enable( event.GetInt() );
1065 video_scale_combo->Enable( event.GetInt() );
1067 case AudioTranscEnable_Event:
1068 audio_codec_combo->Enable( event.GetInt() );
1069 audio_bitrate_combo->Enable( event.GetInt() );
1070 audio_channels_combo->Enable( event.GetInt() );
1072 case SubtitlesTranscEnable_Event:
1073 subtitles_overlay_checkbox->Enable( !event.GetInt() );
1074 subtitles_codec_combo->Enable( event.GetInt() );
1076 case SubtitlesOverlayEnable_Event:
1077 subtitles_transc_checkbox->Enable( !event.GetInt() );
1084 void SoutDialog::OnTranscodingChange( wxCommandEvent& event )