00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <stdlib.h>
00028 #include <errno.h>
00029 #include <string.h>
00030 #include <stdio.h>
00031
00032 #include <vlc/vlc.h>
00033 #include <vlc/intf.h>
00034
00035 #include "wxwidgets.h"
00036 #include <wx/combobox.h>
00037 #include <wx/statline.h>
00038
00039 #include "streamdata.h"
00040
00041 #ifndef wxRB_SINGLE
00042 # define wxRB_SINGLE 0
00043 #endif
00044
00045
00046
00047
00048
00049
00050 enum
00051 {
00052 Notebook_Event = wxID_HIGHEST,
00053 MRL_Event,
00054
00055 FileBrowse_Event,
00056 FileName_Event,
00057 FileDump_Event,
00058
00059 AccessType1_Event, AccessType2_Event, AccessType3_Event,
00060 AccessType4_Event, AccessType5_Event, AccessType6_Event,
00061 NetPort1_Event, NetPort2_Event, NetPort3_Event, NetPort4_Event,
00062 NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
00063
00064 EncapsulationRadio1_Event, EncapsulationRadio2_Event,
00065 EncapsulationRadio3_Event, EncapsulationRadio4_Event,
00066 EncapsulationRadio5_Event, EncapsulationRadio6_Event,
00067 EncapsulationRadio7_Event, EncapsulationRadio8_Event,
00068 EncapsulationRadio9_Event, EncapsulationRadio10_Event,
00069
00070 VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event,
00071 VideoTranscScale_Event,
00072 AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event,
00073 AudioTranscChans_Event,
00074 SubtitlesTranscEnable_Event, SubtitlesTranscCodec_Event,
00075 SubtitlesOverlayEnable_Event,
00076
00077 SAPMisc_Event, AnnounceGroup_Event, AnnounceAddr_Event,
00078 SoutAll_Event
00079 };
00080
00081 BEGIN_EVENT_TABLE(SoutDialog, wxDialog)
00082
00083 EVT_BUTTON(wxID_OK, SoutDialog::OnOk)
00084 EVT_BUTTON(wxID_CANCEL, SoutDialog::OnCancel)
00085
00086
00087 EVT_CHECKBOX(AccessType1_Event, SoutDialog::OnAccessTypeChange)
00088 EVT_CHECKBOX(AccessType2_Event, SoutDialog::OnAccessTypeChange)
00089 EVT_CHECKBOX(AccessType3_Event, SoutDialog::OnAccessTypeChange)
00090 EVT_CHECKBOX(AccessType4_Event, SoutDialog::OnAccessTypeChange)
00091 EVT_CHECKBOX(AccessType5_Event, SoutDialog::OnAccessTypeChange)
00092 EVT_CHECKBOX(AccessType6_Event, SoutDialog::OnAccessTypeChange)
00093 EVT_TEXT(FileName_Event, SoutDialog::OnFileChange)
00094 EVT_BUTTON(FileBrowse_Event, SoutDialog::OnFileBrowse)
00095 EVT_CHECKBOX(FileDump_Event, SoutDialog::OnFileDump)
00096
00097 EVT_TEXT(NetPort1_Event, SoutDialog::OnNetChange)
00098 EVT_TEXT(NetAddr1_Event, SoutDialog::OnNetChange)
00099 EVT_TEXT(NetPort2_Event, SoutDialog::OnNetChange)
00100 EVT_TEXT(NetAddr2_Event, SoutDialog::OnNetChange)
00101 EVT_TEXT(NetPort3_Event, SoutDialog::OnNetChange)
00102 EVT_TEXT(NetAddr3_Event, SoutDialog::OnNetChange)
00103 EVT_TEXT(NetPort4_Event, SoutDialog::OnNetChange)
00104 EVT_TEXT(NetAddr4_Event, SoutDialog::OnNetChange)
00105
00106
00107 EVT_RADIOBUTTON(EncapsulationRadio1_Event,
00108 SoutDialog::OnEncapsulationChange)
00109 EVT_RADIOBUTTON(EncapsulationRadio2_Event,
00110 SoutDialog::OnEncapsulationChange)
00111 EVT_RADIOBUTTON(EncapsulationRadio3_Event,
00112 SoutDialog::OnEncapsulationChange)
00113 EVT_RADIOBUTTON(EncapsulationRadio4_Event,
00114 SoutDialog::OnEncapsulationChange)
00115 EVT_RADIOBUTTON(EncapsulationRadio5_Event,
00116 SoutDialog::OnEncapsulationChange)
00117 EVT_RADIOBUTTON(EncapsulationRadio6_Event,
00118 SoutDialog::OnEncapsulationChange)
00119 EVT_RADIOBUTTON(EncapsulationRadio7_Event,
00120 SoutDialog::OnEncapsulationChange)
00121 EVT_RADIOBUTTON(EncapsulationRadio8_Event,
00122 SoutDialog::OnEncapsulationChange)
00123 EVT_RADIOBUTTON(EncapsulationRadio9_Event,
00124 SoutDialog::OnEncapsulationChange)
00125
00126
00127 EVT_CHECKBOX(VideoTranscEnable_Event, SoutDialog::OnTranscodingEnable)
00128 EVT_CHECKBOX(AudioTranscEnable_Event, SoutDialog::OnTranscodingEnable)
00129 EVT_CHECKBOX(SubtitlesTranscEnable_Event, SoutDialog::OnTranscodingEnable)
00130 EVT_CHECKBOX(SubtitlesOverlayEnable_Event, SoutDialog::OnTranscodingEnable)
00131 EVT_COMBOBOX(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
00132 EVT_TEXT(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange)
00133 EVT_COMBOBOX(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
00134 EVT_TEXT(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange)
00135 EVT_COMBOBOX(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
00136 EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange)
00137 EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
00138 EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange)
00139 EVT_COMBOBOX(VideoTranscScale_Event, SoutDialog::OnTranscodingChange)
00140 EVT_TEXT(VideoTranscScale_Event, SoutDialog::OnTranscodingChange)
00141 EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
00142 EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange)
00143 EVT_COMBOBOX(SubtitlesTranscCodec_Event, SoutDialog::OnTranscodingChange)
00144 EVT_TEXT(SubtitlesTranscCodec_Event, SoutDialog::OnTranscodingChange)
00145
00146
00147 EVT_CHECKBOX(SAPMisc_Event, SoutDialog::OnSAPMiscChange)
00148 EVT_TEXT(AnnounceGroup_Event, SoutDialog::OnAnnounceGroupChange)
00149 EVT_TEXT(AnnounceAddr_Event, SoutDialog::OnAnnounceAddrChange)
00150 EVT_CHECKBOX(SoutAll_Event, SoutDialog::OnAnnounceGroupChange)
00151
00152 END_EVENT_TABLE()
00153
00154
00155
00156
00157 SoutDialog::SoutDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
00158 wxDialog( _p_parent, -1, wxU(_("Stream output")),
00159 wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
00160 {
00161
00162 p_intf = _p_intf;
00163 p_parent = _p_parent;
00164 SetIcon( *p_intf->p_sys->p_icon );
00165
00166
00167 wxPanel *panel = new wxPanel( this, -1 );
00168 panel->SetAutoLayout( TRUE );
00169
00170
00171 wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
00172 wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
00173 wxU(_("Stream output MRL")) );
00174 wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
00175 wxHORIZONTAL );
00176 wxStaticText *mrl_label = new wxStaticText( panel, -1,
00177 wxU(_("Destination Target:")));
00178 mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
00179 wxPoint(20,25), wxSize(120, -1) );
00180 mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
00181 "the full MRL you want to open.\n""Alternatively, the field will be "
00182 "filled automatically when you use the controls below")) );
00183
00184 mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
00185 mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
00186 mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
00187
00188
00189 encapsulation_panel = EncapsulationPanel( panel );
00190
00191
00192 access_panel = AccessPanel( panel );
00193
00194
00195 transcoding_panel = TranscodingPanel( panel );
00196
00197
00198 misc_panel = MiscPanel( panel );
00199
00200
00201 wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
00202 ok_button->SetDefault();
00203 wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
00204 wxU(_("Cancel")) );
00205
00206
00207 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
00208 button_sizer->Add( ok_button, 0, wxALL, 5 );
00209 button_sizer->Add( cancel_button, 0, wxALL, 5 );
00210 button_sizer->Layout();
00211 wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
00212 wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
00213 panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
00214 panel_sizer->Add( access_panel, 1, wxEXPAND | wxALL, 5 );
00215 panel_sizer->Add( encapsulation_panel, 0, wxEXPAND | wxALL, 5 );
00216 panel_sizer->Add( transcoding_panel, 0, wxEXPAND | wxALL, 5 );
00217 panel_sizer->Add( misc_panel, 0, wxEXPAND | wxALL, 5 );
00218 panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
00219 wxALL, 5 );
00220 panel_sizer->Layout();
00221 panel->SetSizerAndFit( panel_sizer );
00222 main_sizer->Add( panel, 1, wxGROW, 0 );
00223 main_sizer->Layout();
00224 SetSizerAndFit( main_sizer );
00225 }
00226
00227 SoutDialog::~SoutDialog()
00228 {
00229 }
00230
00231 wxArrayString SoutDialog::GetOptions()
00232 {
00233 return SeparateEntries( mrl_combo->GetValue() );
00234 }
00235
00236
00237
00238
00239 void SoutDialog::UpdateMRL()
00240 {
00241
00242 if( dump_checkbox->IsChecked() )
00243 {
00244 wxString dumpfile;
00245
00246 if( file_combo->GetValue().size() )
00247 dumpfile = wxT(" :demuxdump-file=\"") +
00248 file_combo->GetValue() + wxT("\"");
00249 mrl_combo->SetValue( wxT(":demux=dump") + dumpfile );
00250
00251 return;
00252 }
00253
00254
00255 wxString transcode;
00256 if( video_transc_checkbox->IsChecked() ||
00257 audio_transc_checkbox->IsChecked() ||
00258 subtitles_transc_checkbox->IsChecked() ||
00259 subtitles_overlay_checkbox->IsChecked() )
00260 {
00261 transcode = wxT("transcode{");
00262 if( video_transc_checkbox->IsChecked() )
00263 {
00264 transcode += wxT("vcodec=") + video_codec_combo->GetValue();
00265 transcode += wxT(",vb=") + video_bitrate_combo->GetValue();
00266 transcode += wxT(",scale=") + video_scale_combo->GetValue();
00267 if( audio_transc_checkbox->IsChecked() ||
00268 subtitles_transc_checkbox->IsChecked() ||
00269 subtitles_overlay_checkbox->IsChecked() )
00270 transcode += wxT(",");
00271 }
00272 if( audio_transc_checkbox->IsChecked() )
00273 {
00274 transcode += wxT("acodec=") + audio_codec_combo->GetValue();
00275 transcode += wxT(",ab=") + audio_bitrate_combo->GetValue();
00276 transcode += wxT(",channels=") + audio_channels_combo->GetValue();
00277 if( subtitles_transc_checkbox->IsChecked() ||
00278 subtitles_overlay_checkbox->IsChecked() )
00279 transcode += wxT(",");
00280 }
00281 if( subtitles_transc_checkbox->IsChecked() )
00282 {
00283 transcode += wxT("scodec=") + subtitles_codec_combo->GetValue();
00284 }
00285 if( subtitles_overlay_checkbox->IsChecked() )
00286 {
00287 transcode += wxT("soverlay");
00288 }
00289 transcode += wxT("}");
00290 }
00291
00292
00293 wxString encapsulation;
00294 switch( i_encapsulation_type )
00295 {
00296 case PS_ENCAPSULATION:
00297 encapsulation = wxT("ps");
00298 break;
00299 case MPEG1_ENCAPSULATION:
00300 encapsulation = wxT("mpeg1");
00301 break;
00302 case AVI_ENCAPSULATION:
00303 encapsulation = wxT("avi");
00304 break;
00305 case OGG_ENCAPSULATION:
00306 encapsulation = wxT("ogg");
00307 break;
00308 case RAW_ENCAPSULATION:
00309 encapsulation = wxT("raw");
00310 break;
00311 case MP4_ENCAPSULATION:
00312 encapsulation = wxT("mp4");
00313 break;
00314 case MOV_ENCAPSULATION:
00315 encapsulation = wxT("mov");
00316 break;
00317 case ASF_ENCAPSULATION:
00318 encapsulation = wxT("asf");
00319 break;
00320 case WAV_ENCAPSULATION:
00321 encapsulation = wxT("wav");
00322 break;
00323 case TS_ENCAPSULATION:
00324 default:
00325 encapsulation = wxT("ts");
00326 break;
00327 }
00328
00329
00330 wxString dup_opts;
00331 if( access_checkboxes[PLAY_ACCESS_OUT]->IsChecked() )
00332 {
00333 dup_opts += wxT("dst=display");
00334 }
00335 if( access_checkboxes[FILE_ACCESS_OUT]->IsChecked() )
00336 {
00337 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
00338 dup_opts += wxT("dst=std{access=file,mux=");
00339 dup_opts += encapsulation + wxT(",url=\"");
00340 dup_opts += file_combo->GetValue() + wxT("\"}");
00341 }
00342 if( access_checkboxes[HTTP_ACCESS_OUT]->IsChecked() )
00343 {
00344 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
00345 dup_opts += wxT("dst=std{access=http,mux=");
00346 dup_opts += encapsulation + wxT(",url=");
00347 dup_opts += net_addrs[HTTP_ACCESS_OUT]->GetLineText(0);
00348 dup_opts += wxString::Format( wxT(":%d"),
00349 net_ports[HTTP_ACCESS_OUT]->GetValue() );
00350 dup_opts += wxT("}");
00351 }
00352 if( access_checkboxes[MMSH_ACCESS_OUT]->IsChecked() )
00353 {
00354 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
00355 dup_opts += wxT("dst=std{access=mmsh,mux=");
00356 dup_opts += encapsulation;
00357 if( i_encapsulation_type == ASF_ENCAPSULATION ) dup_opts += wxT("h");
00358 dup_opts += wxT(",url=");
00359 dup_opts += net_addrs[MMSH_ACCESS_OUT]->GetLineText(0);
00360 dup_opts += wxString::Format( wxT(":%d"),
00361 net_ports[MMSH_ACCESS_OUT]->GetValue() );
00362 dup_opts += wxT("}");
00363 }
00364 if( access_checkboxes[RTP_ACCESS_OUT]->IsChecked() )
00365 {
00366 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
00367 dup_opts += wxT("dst=std{access=rtp,mux=");
00368 dup_opts += encapsulation + wxT(",url=");
00369
00370 wxString rtp_addr = net_addrs[RTP_ACCESS_OUT]->GetLineText(0);
00371 if ((rtp_addr[0u] != '[') && (rtp_addr.Find(':') != -1))
00372 {
00373 dup_opts += wxT ("[") + rtp_addr + wxT ("]");
00374 }
00375 else
00376 {
00377 dup_opts += rtp_addr;
00378 }
00379 dup_opts += wxString::Format( wxT(":%d"),
00380 net_ports[RTP_ACCESS_OUT]->GetValue() );
00381
00382
00383 if( sap_checkbox->IsChecked() )
00384 {
00385 dup_opts += wxT(",sap");
00386 if( ! announce_group->GetLineText(0).IsEmpty() )
00387 {
00388 dup_opts += wxT(",group=\"");
00389 dup_opts += announce_group->GetLineText(0);
00390 dup_opts += wxT("\"");
00391 }
00392 if( ! announce_addr->GetLineText(0).IsEmpty() )
00393 {
00394 dup_opts += wxT(",name=\"");
00395 dup_opts += announce_addr->GetLineText(0);
00396 dup_opts += wxT("\"");
00397 }
00398 }
00399
00400 dup_opts += wxT("}");
00401 }
00402
00403 if( access_checkboxes[UDP_ACCESS_OUT]->IsChecked() )
00404 {
00405 if( !dup_opts.IsEmpty() ) dup_opts += wxT(",");
00406 dup_opts += wxT("dst=std{access=udp,mux=");
00407 dup_opts += encapsulation + wxT(",url=");
00408
00409 wxString udp_addr = net_addrs[UDP_ACCESS_OUT]->GetLineText(0);
00410 if ((udp_addr[0u] != '[') && (udp_addr.Find(':') != -1))
00411 {
00412 dup_opts += wxT ("[") + udp_addr + wxT ("]");
00413 }
00414 else
00415 {
00416 dup_opts += udp_addr;
00417 }
00418 dup_opts += wxString::Format( wxT(":%d"),
00419 net_ports[UDP_ACCESS_OUT]->GetValue() );
00420
00421
00422 if( sap_checkbox->IsChecked() )
00423 {
00424 dup_opts += wxT(",sap");
00425 if( ! announce_group->GetLineText(0).IsEmpty() )
00426 {
00427 dup_opts += wxT(",group=\"");
00428 dup_opts += announce_group->GetLineText(0);
00429 dup_opts += wxT("\"");
00430 }
00431 if( ! announce_addr->GetLineText(0).IsEmpty() )
00432 {
00433 dup_opts += wxT(",name=\"");
00434 dup_opts += announce_addr->GetLineText(0);
00435 dup_opts += wxT("\"");
00436 }
00437 }
00438
00439 dup_opts += wxT("}");
00440 }
00441
00442 wxString duplicate;
00443 if( !dup_opts.IsEmpty() )
00444 {
00445 if( !transcode.IsEmpty() ) duplicate = wxT(":");
00446 duplicate += wxT("duplicate{") + dup_opts + wxT("}");
00447 }
00448
00449 wxString misc;
00450 if( (!transcode.IsEmpty() || !duplicate.IsEmpty()) &&
00451 sout_all_checkbox->IsChecked() )
00452 {
00453 misc = wxT(" :sout-all");
00454 }
00455
00456 if( !transcode.IsEmpty() || !duplicate.IsEmpty() )
00457 mrl_combo->SetValue( wxT(":sout=#") + transcode + duplicate + misc );
00458 else
00459 mrl_combo->SetValue( wxT("") );
00460 }
00461
00462 wxPanel *SoutDialog::AccessPanel( wxWindow* parent )
00463 {
00464 int i;
00465 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
00466 wxSize(200, 200) );
00467
00468 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
00469 wxU(_("Output methods")) );
00470 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
00471 wxVERTICAL );
00472
00473
00474 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 0, 20 );
00475 static const wxString access_output_array[] =
00476 {
00477 wxU(_("Play locally")),
00478 wxU(_("File")),
00479 wxU(_("HTTP")),
00480 wxU(_("MMSH")),
00481 wxU(_("RTP")),
00482 wxU(_("UDP")),
00483 };
00484
00485 for( i=0; i < ACCESS_OUT_NUM; i++ )
00486 {
00487 access_checkboxes[i] = new wxCheckBox( panel, AccessType1_Event + i,
00488 access_output_array[i] );
00489 access_subpanels[i] = new wxPanel( panel, -1 );
00490 }
00491
00492
00493 wxFlexGridSizer *subpanel_sizer;
00494 wxStaticText *label;
00495 label = new wxStaticText( access_subpanels[0], -1, wxT("") );
00496 subpanel_sizer = new wxFlexGridSizer( 1, 1, 20 );
00497 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00498 access_subpanels[0]->SetSizerAndFit( subpanel_sizer );
00499 access_subpanels[0]->Hide();
00500
00501
00502
00503 subpanel_sizer = new wxFlexGridSizer( 4, 1, 10);
00504 label = new wxStaticText( access_subpanels[1], -1, wxU(_("Filename")) );
00505 file_combo = new wxComboBox( access_subpanels[1], FileName_Event, wxT(""),
00506 wxPoint(20,25), wxSize(200, -1) );
00507 wxButton *browse_button = new wxButton( access_subpanels[1],
00508 FileBrowse_Event, wxU(_("Browse...")) );
00509 subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00510 subpanel_sizer->Add( file_combo, 1,
00511 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00512 subpanel_sizer->Add( browse_button, 0,
00513 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00514
00515
00516 dump_checkbox = new wxCheckBox( access_subpanels[1], FileDump_Event,
00517 wxU(_("Dump raw input")) );
00518 subpanel_sizer->Add( dump_checkbox, 0,
00519 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, 5 );
00520
00521 access_subpanels[1]->SetSizerAndFit( subpanel_sizer );
00522
00523
00524 for( i = HTTP_ACCESS_OUT; i < ACCESS_OUT_NUM; i++ )
00525 {
00526 subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
00527 label = new wxStaticText( access_subpanels[i], -1, wxU(_("Address")) );
00528 net_addrs[i] = new wxTextCtrl( access_subpanels[i],
00529 NetAddr1_Event + i - HTTP_ACCESS_OUT,
00530 wxT(""), wxDefaultPosition,
00531 wxSize( 200, -1 ), wxTE_PROCESS_ENTER);
00532 subpanel_sizer->Add( label, 0,
00533 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00534 subpanel_sizer->Add( net_addrs[i], 1, wxEXPAND |
00535 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00536
00537 int val = config_GetInt( p_intf, "server-port" );
00538 label = new wxStaticText( access_subpanels[i], -1, wxU(_("Port")) );
00539 net_ports[i] = new wxSpinCtrl( access_subpanels[i],
00540 NetPort1_Event + i - HTTP_ACCESS_OUT,
00541 wxString::Format(wxT("%d"), val),
00542 wxDefaultPosition, wxDefaultSize,
00543 wxSP_ARROW_KEYS,
00544 0, 65535, val );
00545
00546 subpanel_sizer->Add( label, 0,
00547 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00548 subpanel_sizer->Add( net_ports[i], 0,
00549 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00550
00551 access_subpanels[i]->SetSizerAndFit( subpanel_sizer );
00552 }
00553
00554
00555
00556 for( i=1; i < ACCESS_OUT_NUM; i++ )
00557 {
00558 sizer->Add( access_checkboxes[i], 0,
00559 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
00560 sizer->Add( access_subpanels[i], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL
00561 | wxALIGN_LEFT | wxALL, 5 );
00562 }
00563
00564 panel_sizer->Add( access_checkboxes[0], 0,
00565 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
00566 panel_sizer->Add( sizer, 1, wxEXPAND | wxTOP, 3 );
00567
00568 panel->SetSizerAndFit( panel_sizer );
00569
00570
00571 for( i=1; i < ACCESS_OUT_NUM; i++ )
00572 {
00573 access_subpanels[i]->Disable();
00574 }
00575
00576 return panel;
00577 }
00578
00579 wxPanel *SoutDialog::MiscPanel( wxWindow* parent )
00580 {
00581 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
00582 wxSize(200, 200) );
00583
00584 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
00585 wxU(_("Miscellaneous options")) );
00586 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
00587 wxVERTICAL );
00588
00589
00590 misc_subpanels[ANN_MISC_SOUT] = new wxPanel( panel, -1 );
00591 misc_subpanels[TTL_MISC_SOUT] = new wxPanel( panel, -1 );
00592 wxFlexGridSizer *subpanel_sizer = new wxFlexGridSizer( 3, 4, 20 );
00593 wxFlexGridSizer *subpanel_sub_sizer = new wxFlexGridSizer( 5, 4, 20 );
00594 wxFlexGridSizer *subpanel2_sizer = new wxFlexGridSizer( 3, 4, 20 );
00595
00596 sap_checkbox = new wxCheckBox( misc_subpanels[ANN_MISC_SOUT],SAPMisc_Event,
00597 wxU(_("SAP announce")) );
00598 wxStaticText *label_g = new wxStaticText( misc_subpanels[ANN_MISC_SOUT], -1,
00599 wxU(_("Group name")) );
00600 announce_group = new wxTextCtrl( misc_subpanels[ANN_MISC_SOUT],
00601 AnnounceGroup_Event,
00602 wxT(""), wxDefaultPosition,
00603 wxSize( 100, -1 ), wxTE_PROCESS_ENTER);
00604
00605 wxStaticText *label = new wxStaticText( misc_subpanels[ANN_MISC_SOUT], -1,
00606 wxU(_("Channel name")) );
00607 announce_addr = new wxTextCtrl( misc_subpanels[ANN_MISC_SOUT],
00608 AnnounceAddr_Event,
00609 wxT(""), wxDefaultPosition,
00610 wxSize( 100, -1 ), wxTE_PROCESS_ENTER);
00611
00612 wxStaticText *ttl_label = new wxStaticText( misc_subpanels[TTL_MISC_SOUT], -1,
00613 wxU(_("Time-To-Live (TTL)")) );
00614 ttl_spin = new wxSpinCtrl( misc_subpanels[TTL_MISC_SOUT], -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
00615 0, 1, 255, config_GetInt( p_intf, "ttl" ) );
00616
00617 subpanel_sizer->Add( sap_checkbox, 0,
00618 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00619 subpanel_sub_sizer->Add( label_g, 0, wxALIGN_RIGHT |
00620 wxALIGN_CENTER_VERTICAL );
00621 subpanel_sub_sizer->Add( announce_group, 1, wxEXPAND |
00622 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00623 subpanel_sub_sizer->Add( label, 0, wxALIGN_RIGHT |
00624 wxALIGN_CENTER_VERTICAL );
00625 subpanel_sub_sizer->Add( announce_addr, 1, wxEXPAND |
00626 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00627 subpanel_sizer->Add( subpanel_sub_sizer, 1, wxEXPAND |
00628 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00629
00630 sout_all_checkbox = new wxCheckBox( misc_subpanels[TTL_MISC_SOUT],
00631 SoutAll_Event, wxU(_("Select all elementary streams")) );
00632 subpanel2_sizer->Add( sout_all_checkbox, 1,
00633 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
00634 subpanel2_sizer->Add( ttl_label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00635 subpanel2_sizer->Add( ttl_spin, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00636
00637 misc_subpanels[ANN_MISC_SOUT]->SetSizerAndFit( subpanel_sizer );
00638 misc_subpanels[TTL_MISC_SOUT]->SetSizerAndFit( subpanel2_sizer );
00639
00640
00641 panel_sizer->Add( misc_subpanels[ANN_MISC_SOUT], 1,
00642 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT, 5 );
00643
00644 panel_sizer->Add( misc_subpanels[TTL_MISC_SOUT], 1,
00645 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
00646
00647
00648 panel->SetSizerAndFit( panel_sizer );
00649
00650
00651 misc_subpanels[ANN_MISC_SOUT]->Disable();
00652 announce_group->Disable();
00653 announce_addr->Disable();
00654
00655 return panel;
00656 }
00657
00658 wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent )
00659 {
00660 unsigned int i;
00661 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
00662 wxSize(200, 200) );
00663
00664 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
00665 wxU(_("Encapsulation Method")) );
00666 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
00667 wxHORIZONTAL );
00668
00669 static const wxString encapsulation_array[] =
00670 {
00671 wxT("MPEG TS"),
00672 wxT("MPEG PS"),
00673 wxT("MPEG 1"),
00674 wxT("Ogg"),
00675 wxT("ASF"),
00676 wxT("MP4"),
00677 wxT("MOV"),
00678 wxT("WAV"),
00679 wxT("Raw")
00680 };
00681
00682
00683 for( i = 0; i < WXSIZEOF(encapsulation_array); i++ )
00684 {
00685 encapsulation_radios[i] =
00686 new wxRadioButton( panel, EncapsulationRadio1_Event + i,
00687 encapsulation_array[i] );
00688 panel_sizer->Add( encapsulation_radios[i], 0,
00689 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
00690 wxALL, 4 );
00691 }
00692
00693 for( i = WXSIZEOF(encapsulation_array); i < ENCAPS_NUM; i++ )
00694 {
00695 encapsulation_radios[i] =
00696 new wxRadioButton( panel, EncapsulationRadio1_Event + i, wxT("") );
00697 encapsulation_radios[i]->Hide();
00698 }
00699
00700 panel->SetSizerAndFit( panel_sizer );
00701
00702
00703 encapsulation_radios[TS_ENCAPSULATION]->SetValue(true);
00704 i_encapsulation_type = TS_ENCAPSULATION;
00705
00706 return panel;
00707 }
00708
00709 wxPanel *SoutDialog::TranscodingPanel( wxWindow* parent )
00710 {
00711 wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
00712 wxSize(200, 200) );
00713
00714 wxStaticBox *panel_box = new wxStaticBox( panel, -1,
00715 wxU(_("Transcoding options")) );
00716 wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
00717 wxVERTICAL );
00718
00719
00720 static const wxString wxvcodecs_array[] =
00721 {
00722 wxT("mp1v"),
00723 wxT("mp2v"),
00724 wxT("mp4v"),
00725 wxT("DIV1"),
00726 wxT("DIV2"),
00727 wxT("DIV3"),
00728 wxT("H263"),
00729 wxT("h264"),
00730 wxT("WMV1"),
00731 wxT("WMV2"),
00732 wxT("MJPG"),
00733 wxT("theo")
00734 };
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753 static const wxString vscales_array[] =
00754 {
00755 wxT("0.25"),
00756 wxT("0.5"),
00757 wxT("0.75"),
00758 wxT("1"),
00759 wxT("1.25"),
00760 wxT("1.5"),
00761 wxT("1.75"),
00762 wxT("2")
00763 };
00764
00765 wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 6, 1, 20 );
00766 #if defined( __WXMSW__ )
00767 wxFlexGridSizer *video_sub_sizer = new wxFlexGridSizer( 4, 5, 20 );
00768 #else
00769 wxFlexGridSizer *video_sub_sizer = new wxFlexGridSizer( 2, 5, 20 );
00770 #endif
00771 video_transc_checkbox =
00772 new wxCheckBox( panel, VideoTranscEnable_Event, wxU(_("Video codec")));
00773 video_codec_combo =
00774 new wxComboBox( panel, VideoTranscCodec_Event, wxvcodecs_array[2],
00775 wxPoint(20,25), wxDefaultSize,
00776 WXSIZEOF(wxvcodecs_array),
00777 wxvcodecs_array, wxCB_READONLY );
00778 video_codec_combo->SetSelection(2);
00779 wxStaticText *bitrate_label =
00780 new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
00781 video_bitrate_combo =
00782 new wxComboBox( panel, VideoTranscBitrate_Event, wxT("1024"),
00783 wxPoint(20,25), wxDefaultSize,
00784 WXSIZEOF(vbitrates_array), vbitrates_array );
00785 wxStaticText *scale_label =
00786 new wxStaticText( panel, -1, wxU(_("Scale")));
00787 video_scale_combo =
00788 new wxComboBox( panel, VideoTranscScale_Event, wxT("1"),
00789 wxPoint(20,25), wxDefaultSize,
00790 WXSIZEOF(vscales_array), vscales_array );
00791 video_sizer->Add( video_transc_checkbox, 0,
00792 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00793 video_sizer->Add( video_codec_combo, 1,
00794 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00795 video_sub_sizer->Add( bitrate_label, 0,
00796 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00797 video_sub_sizer->Add( video_bitrate_combo, 1,
00798 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00799 video_sub_sizer->Add( scale_label, 0,
00800 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00801 video_sub_sizer->Add( video_scale_combo, 1,
00802 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00803 video_sizer->Add( video_sub_sizer, 1, wxEXPAND |
00804 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
00805
00806
00807 static const wxString wxacodecs_array[] =
00808 {
00809 wxT("mpga"),
00810 wxT("mp2a"),
00811 wxT("mp3"),
00812 wxT("mp4a"),
00813 wxT("a52"),
00814 wxT("vorb"),
00815 wxT("flac"),
00816 wxT("spx"),
00817 wxT("s16l"),
00818 wxT("fl32")
00819 };
00820 static const wxString achannels_array[] =
00821 {
00822 wxT("1"),
00823 wxT("2"),
00824 wxT("4"),
00825 wxT("6")
00826 };
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840 wxFlexGridSizer *audio_sizer = new wxFlexGridSizer( 3, 1, 20 );
00841 audio_transc_checkbox =
00842 new wxCheckBox( panel, AudioTranscEnable_Event, wxU(_("Audio codec")));
00843 audio_codec_combo =
00844 new wxComboBox( panel, AudioTranscCodec_Event, wxacodecs_array[0],
00845 wxPoint(10,25), wxDefaultSize,
00846 WXSIZEOF(wxacodecs_array),
00847 wxacodecs_array, wxCB_READONLY );
00848 audio_codec_combo->SetSelection(0);
00849 #if defined( __WXMSW__ )
00850 wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 4, 5, 20 );
00851 #else
00852 wxFlexGridSizer *audio_sub_sizer = new wxFlexGridSizer( 2, 5, 20 );
00853 #endif
00854 bitrate_label =
00855 new wxStaticText( panel, -1, wxU(_("Bitrate (kb/s)")));
00856 audio_bitrate_combo =
00857 new wxComboBox( panel, AudioTranscBitrate_Event, wxT("192"),
00858 wxPoint(10,25), wxDefaultSize,
00859 WXSIZEOF(abitrates_array), abitrates_array );
00860 wxStaticText *channels_label =
00861 new wxStaticText( panel, -1, wxU(_("Channels")));
00862 audio_channels_combo =
00863 new wxComboBox( panel, AudioTranscChans_Event, achannels_array[1],
00864 wxPoint(10,25), wxDefaultSize,
00865 WXSIZEOF(achannels_array), achannels_array );
00866 audio_channels_combo->SetSelection(1);
00867 audio_sub_sizer->Add( bitrate_label, 0,
00868 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00869 audio_sub_sizer->Add( audio_bitrate_combo, 1,
00870 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00871 audio_sub_sizer->Add( channels_label, 0,
00872 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00873 audio_sub_sizer->Add( audio_channels_combo, 1,
00874 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00875
00876 audio_sizer->Add( audio_transc_checkbox, 0,
00877 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00878 audio_sizer->Add( audio_codec_combo, 1,
00879 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00880 audio_sizer->Add( audio_sub_sizer, 1,
00881 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00882
00883
00884 static const wxString wxscodecs_array[] =
00885 {
00886 wxT("dvbs")
00887 };
00888
00889 wxFlexGridSizer *subtitles_sizer = new wxFlexGridSizer( 3, 1, 20 );
00890 subtitles_transc_checkbox =
00891 new wxCheckBox( panel, SubtitlesTranscEnable_Event,
00892 wxU(_("Subtitles codec")));
00893 subtitles_codec_combo =
00894 new wxComboBox( panel, SubtitlesTranscCodec_Event, wxscodecs_array[0],
00895 wxPoint(10,25), wxDefaultSize,
00896 WXSIZEOF(wxscodecs_array),
00897 wxscodecs_array, wxCB_READONLY );
00898 subtitles_codec_combo->SetSelection(0);
00899 subtitles_overlay_checkbox =
00900 new wxCheckBox( panel, SubtitlesOverlayEnable_Event,
00901 wxU(_("Subtitles overlay")));
00902
00903 subtitles_sizer->Add( subtitles_transc_checkbox, 0,
00904 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00905 subtitles_sizer->Add( subtitles_codec_combo, 1,
00906 wxEXPAND | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00907 subtitles_sizer->Add( subtitles_overlay_checkbox, 0,
00908 wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
00909
00910
00911 panel_sizer->Add( video_sizer, 0,
00912 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
00913 panel_sizer->Add( audio_sizer, 0,
00914 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
00915 panel_sizer->Add( subtitles_sizer, 0,
00916 wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
00917
00918 panel->SetSizerAndFit( panel_sizer );
00919
00920
00921 wxCommandEvent event( 0, VideoTranscEnable_Event );
00922 event.SetInt( 0 );
00923 OnTranscodingEnable( event );
00924 event.SetId( AudioTranscEnable_Event );
00925 OnTranscodingEnable( event );
00926 event.SetId( SubtitlesTranscEnable_Event );
00927 OnTranscodingEnable( event );
00928
00929 return panel;
00930 }
00931
00932
00933
00934
00935 void SoutDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
00936 {
00937 mrl_combo->Append( mrl_combo->GetValue() );
00938 config_PutInt( p_intf, "ttl", ttl_spin->GetValue());
00939 EndModal( wxID_OK );
00940 }
00941
00942 void SoutDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
00943 {
00944 EndModal( wxID_CANCEL );
00945 }
00946
00947 void SoutDialog::OnMRLChange( wxCommandEvent& event )
00948 {
00949
00950 }
00951
00952
00953
00954
00955 void SoutDialog::OnAccessTypeChange( wxCommandEvent& event )
00956 {
00957 int i;
00958 i_access_type = event.GetId() - AccessType1_Event;
00959
00960 access_subpanels[i_access_type]->Enable( event.GetInt() );
00961
00962 switch( i_access_type )
00963 {
00964 case UDP_ACCESS_OUT:
00965 case RTP_ACCESS_OUT:
00966 misc_subpanels[ANN_MISC_SOUT]->Enable( event.GetInt() );
00967
00968 for( i = 1; i < ENCAPS_NUM; i++ )
00969 {
00970 encapsulation_radios[i]->Enable( !event.GetInt() );
00971 }
00972 if( event.GetInt() )
00973 {
00974 encapsulation_radios[TS_ENCAPSULATION]->SetValue(true);
00975 i_encapsulation_type = TS_ENCAPSULATION;
00976 }
00977 break;
00978 }
00979 UpdateMRL();
00980 }
00981
00982
00983
00984
00985 void SoutDialog::OnSAPMiscChange( wxCommandEvent& event )
00986 {
00987 announce_addr->Enable( event.GetInt() );
00988 announce_group->Enable( event.GetInt() );
00989 UpdateMRL();
00990 }
00991
00992
00993
00994
00995 void SoutDialog::OnAnnounceAddrChange( wxCommandEvent& WXUNUSED(event) )
00996 {
00997 UpdateMRL();
00998 }
00999
01000 void SoutDialog::OnAnnounceGroupChange( wxCommandEvent& WXUNUSED(event) )
01001 {
01002 UpdateMRL();
01003 }
01004
01005
01006
01007
01008 void SoutDialog::OnFileChange( wxCommandEvent& WXUNUSED(event) )
01009 {
01010 UpdateMRL();
01011 }
01012
01013 void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
01014 {
01015 wxFileDialog dialog( this, wxU(_("Save file")), wxT(""), wxT(""), wxT("*"),
01016 wxSAVE | wxOVERWRITE_PROMPT );
01017
01018 if( dialog.ShowModal() == wxID_OK )
01019 {
01020 file_combo->SetValue( dialog.GetPath() );
01021 UpdateMRL();
01022 }
01023 }
01024
01025 void SoutDialog::OnFileDump( wxCommandEvent& event )
01026 {
01027 misc_panel->Enable( !event.GetInt() );
01028 encapsulation_panel->Enable( !event.GetInt() );
01029 transcoding_panel->Enable( !event.GetInt() );
01030
01031 for( int i = 0; i < ACCESS_OUT_NUM; i++ )
01032 {
01033 if( i != FILE_ACCESS_OUT )
01034 {
01035 access_checkboxes[i]->Enable( !event.GetInt() );
01036 access_subpanels[i]->Enable( !event.GetInt() &&
01037 access_checkboxes[i]->IsChecked() );
01038 }
01039 }
01040
01041 UpdateMRL();
01042 }
01043
01044
01045
01046
01047 void SoutDialog::OnNetChange( wxCommandEvent& WXUNUSED(event) )
01048 {
01049 UpdateMRL();
01050 }
01051
01052
01053
01054
01055 void SoutDialog::OnEncapsulationChange( wxCommandEvent& event )
01056 {
01057 i_encapsulation_type = event.GetId() - EncapsulationRadio1_Event;
01058 UpdateMRL();
01059 }
01060
01061
01062
01063
01064 void SoutDialog::OnTranscodingEnable( wxCommandEvent& event )
01065 {
01066 switch( event.GetId() )
01067 {
01068 case VideoTranscEnable_Event:
01069 video_codec_combo->Enable( event.GetInt() );
01070 video_bitrate_combo->Enable( event.GetInt() );
01071 video_scale_combo->Enable( event.GetInt() );
01072 break;
01073 case AudioTranscEnable_Event:
01074 audio_codec_combo->Enable( event.GetInt() );
01075 audio_bitrate_combo->Enable( event.GetInt() );
01076 audio_channels_combo->Enable( event.GetInt() );
01077 break;
01078 case SubtitlesTranscEnable_Event:
01079 subtitles_overlay_checkbox->Enable( !event.GetInt() );
01080 subtitles_codec_combo->Enable( event.GetInt() );
01081 break;
01082 case SubtitlesOverlayEnable_Event:
01083 subtitles_transc_checkbox->Enable( !event.GetInt() );
01084 break;
01085 }
01086
01087 UpdateMRL();
01088 }
01089
01090 void SoutDialog::OnTranscodingChange( wxCommandEvent& event )
01091 {
01092 UpdateMRL();
01093 }