📄 streamout.cpp
字号:
/***************************************************************************** * streamout.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2004 VideoLAN * $Id: streamout.cpp 10558 2005-04-05 13:15:07Z gbazin $ * * Authors: Gildas Bazin <gbazin@netcourrier.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#include <stdlib.h> /* malloc(), free() */#include <errno.h> /* ENOMEM */#include <string.h> /* strerror() */#include <stdio.h>#include <vlc/vlc.h>#include <vlc/intf.h>#include "wxwindows.h"#include <wx/combobox.h>#include <wx/statline.h>#include "streamdata.h"#ifndef wxRB_SINGLE# define wxRB_SINGLE 0#endif/***************************************************************************** * Event Table. *****************************************************************************//* IDs for the controls and the menu commands */enum{ Notebook_Event = wxID_HIGHEST, MRL_Event, FileBrowse_Event, FileName_Event, FileDump_Event, AccessType1_Event, AccessType2_Event, AccessType3_Event, AccessType4_Event, AccessType5_Event, AccessType6_Event, NetPort1_Event, NetPort2_Event, NetPort3_Event, NetPort4_Event, NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event, EncapsulationRadio1_Event, EncapsulationRadio2_Event, EncapsulationRadio3_Event, EncapsulationRadio4_Event, EncapsulationRadio5_Event, EncapsulationRadio6_Event, EncapsulationRadio7_Event, EncapsulationRadio8_Event, EncapsulationRadio9_Event, EncapsulationRadio10_Event, VideoTranscEnable_Event, VideoTranscCodec_Event, VideoTranscBitrate_Event, VideoTranscScale_Event, AudioTranscEnable_Event, AudioTranscCodec_Event, AudioTranscBitrate_Event, AudioTranscChans_Event, SubtitlesTranscEnable_Event, SubtitlesTranscCodec_Event, SubtitlesOverlayEnable_Event, SAPMisc_Event, SLPMisc_Event, AnnounceGroup_Event, AnnounceAddr_Event, SoutAll_Event};BEGIN_EVENT_TABLE(SoutDialog, wxDialog) /* Button events */ EVT_BUTTON(wxID_OK, SoutDialog::OnOk) EVT_BUTTON(wxID_CANCEL, SoutDialog::OnCancel) /* Events generated by the access output panel */ EVT_CHECKBOX(AccessType1_Event, SoutDialog::OnAccessTypeChange) EVT_CHECKBOX(AccessType2_Event, SoutDialog::OnAccessTypeChange) EVT_CHECKBOX(AccessType3_Event, SoutDialog::OnAccessTypeChange) EVT_CHECKBOX(AccessType4_Event, SoutDialog::OnAccessTypeChange) EVT_CHECKBOX(AccessType5_Event, SoutDialog::OnAccessTypeChange) EVT_CHECKBOX(AccessType6_Event, SoutDialog::OnAccessTypeChange) EVT_TEXT(FileName_Event, SoutDialog::OnFileChange) EVT_BUTTON(FileBrowse_Event, SoutDialog::OnFileBrowse) EVT_CHECKBOX(FileDump_Event, SoutDialog::OnFileDump) EVT_TEXT(NetPort1_Event, SoutDialog::OnNetChange) EVT_TEXT(NetAddr1_Event, SoutDialog::OnNetChange) EVT_TEXT(NetPort2_Event, SoutDialog::OnNetChange) EVT_TEXT(NetAddr2_Event, SoutDialog::OnNetChange) EVT_TEXT(NetPort3_Event, SoutDialog::OnNetChange) EVT_TEXT(NetAddr3_Event, SoutDialog::OnNetChange) EVT_TEXT(NetPort4_Event, SoutDialog::OnNetChange) EVT_TEXT(NetAddr4_Event, SoutDialog::OnNetChange) /* Events generated by the encapsulation panel */ EVT_RADIOBUTTON(EncapsulationRadio1_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio2_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio3_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio4_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio5_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio6_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio7_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio8_Event, SoutDialog::OnEncapsulationChange) EVT_RADIOBUTTON(EncapsulationRadio9_Event, SoutDialog::OnEncapsulationChange) /* Events generated by the transcoding panel */ EVT_CHECKBOX(VideoTranscEnable_Event, SoutDialog::OnTranscodingEnable) EVT_CHECKBOX(AudioTranscEnable_Event, SoutDialog::OnTranscodingEnable) EVT_CHECKBOX(SubtitlesTranscEnable_Event, SoutDialog::OnTranscodingEnable) EVT_CHECKBOX(SubtitlesOverlayEnable_Event, SoutDialog::OnTranscodingEnable) EVT_COMBOBOX(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(VideoTranscCodec_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(AudioTranscCodec_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(VideoTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(AudioTranscBitrate_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(VideoTranscScale_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(VideoTranscScale_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(AudioTranscChans_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(AudioTranscChans_Event, SoutDialog::OnTranscodingChange) EVT_COMBOBOX(SubtitlesTranscCodec_Event, SoutDialog::OnTranscodingChange) EVT_TEXT(SubtitlesTranscCodec_Event, SoutDialog::OnTranscodingChange) /* Events generated by the misc panel */ EVT_CHECKBOX(SAPMisc_Event, SoutDialog::OnSAPMiscChange) EVT_CHECKBOX(SLPMisc_Event, SoutDialog::OnSLPMiscChange) EVT_TEXT(AnnounceGroup_Event, SoutDialog::OnAnnounceGroupChange) EVT_TEXT(AnnounceAddr_Event, SoutDialog::OnAnnounceAddrChange) EVT_CHECKBOX(SoutAll_Event, SoutDialog::OnAnnounceGroupChange)END_EVENT_TABLE()/***************************************************************************** * Constructor. *****************************************************************************/SoutDialog::SoutDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ): wxDialog( _p_parent, -1, wxU(_("Stream output")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE ){ /* Initializations */ p_intf = _p_intf; p_parent = _p_parent; SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ wxPanel *panel = new wxPanel( this, -1 ); panel->SetAutoLayout( TRUE ); /* Create MRL combobox */ wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticBox *mrl_box = new wxStaticBox( panel, -1, wxU(_("Stream output MRL")) ); wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box, wxHORIZONTAL ); wxStaticText *mrl_label = new wxStaticText( panel, -1, wxU(_("Destination Target:"))); mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""), wxPoint(20,25), wxSize(120, -1) ); mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing " "the full MRL you want to open.\n""Alternatively, the field will be " "filled automatically when you use the controls below")) ); mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 ); mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 ); mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 ); /* Create the output encapsulation panel */ encapsulation_panel = EncapsulationPanel( panel ); /* Create the access output panel */ access_panel = AccessPanel( panel ); /* Create the transcoding panel */ transcoding_panel = TranscodingPanel( panel ); /* Create the Misc panel */ misc_panel = MiscPanel( panel ); /* Separation */ wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK ); /* Create the buttons */ wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) ); ok_button->SetDefault(); wxButton *cancel_button = new wxButton( panel, wxID_CANCEL, wxU(_("Cancel")) ); /* Place everything in sizers */ wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); button_sizer->Add( ok_button, 0, wxALL, 5 ); button_sizer->Add( cancel_button, 0, wxALL, 5 ); button_sizer->Layout(); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 ); panel_sizer->Add( access_panel, 1, wxEXPAND | wxALL, 5 ); panel_sizer->Add( encapsulation_panel, 0, wxEXPAND | wxALL, 5 ); panel_sizer->Add( transcoding_panel, 0, wxEXPAND | wxALL, 5 ); panel_sizer->Add( misc_panel, 0, wxEXPAND | wxALL, 5 ); panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 ); panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 5 ); panel_sizer->Layout(); panel->SetSizerAndFit( panel_sizer ); main_sizer->Add( panel, 1, wxGROW, 0 ); main_sizer->Layout(); SetSizerAndFit( main_sizer );}SoutDialog::~SoutDialog(){}wxArrayString SoutDialog::GetOptions(){ return SeparateEntries( mrl_combo->GetValue() );}/***************************************************************************** * Private methods. *****************************************************************************/void SoutDialog::UpdateMRL(){ /* Check the demux dump option */ if( dump_checkbox->IsChecked() ) { wxString dumpfile; if( file_combo->GetValue().size() ) dumpfile = wxT(" :demuxdump-file=\"") + file_combo->GetValue() + wxT("\""); mrl_combo->SetValue( wxT(":demux=dump") + dumpfile ); return; } /* Let's start with the transcode options */ wxString transcode; if( video_transc_checkbox->IsChecked() || audio_transc_checkbox->IsChecked() || subtitles_transc_checkbox->IsChecked() || subtitles_overlay_checkbox->IsChecked() ) { transcode = wxT("transcode{"); if( video_transc_checkbox->IsChecked() ) { transcode += wxT("vcodec=") + video_codec_combo->GetValue(); transcode += wxT(",vb=") + video_bitrate_combo->GetValue(); transcode += wxT(",scale=") + video_scale_combo->GetValue(); if( audio_transc_checkbox->IsChecked() || subtitles_transc_checkbox->IsChecked() || subtitles_overlay_checkbox->IsChecked() ) transcode += wxT(","); } if( audio_transc_checkbox->IsChecked() ) { transcode += wxT("acodec=") + audio_codec_combo->GetValue(); transcode += wxT(",ab=") + audio_bitrate_combo->GetValue(); transcode += wxT(",channels=") + audio_channels_combo->GetValue(); if( subtitles_transc_checkbox->IsChecked() || subtitles_overlay_checkbox->IsChecked() ) transcode += wxT(","); } if( subtitles_transc_checkbox->IsChecked() ) { transcode += wxT("scodec=") + subtitles_codec_combo->GetValue(); } if( subtitles_overlay_checkbox->IsChecked() ) { transcode += wxT("soverlay"); } transcode += wxT("}"); } /* Encapsulation */ wxString encapsulation; switch( i_encapsulation_type ) { case PS_ENCAPSULATION: encapsulation = wxT("ps"); break; case MPEG1_ENCAPSULATION: encapsulation = wxT("mpeg1"); break; case AVI_ENCAPSULATION: encapsulation = wxT("avi"); break; case OGG_ENCAPSULATION: encapsulation = wxT("ogg"); break; case RAW_ENCAPSULATION: encapsulation = wxT("raw"); break; case MP4_ENCAPSULATION: encapsulation = wxT("mp4"); break; case MOV_ENCAPSULATION: encapsulation = wxT("mov"); break; case ASF_ENCAPSULATION: encapsulation = wxT("asf"); break; case WAV_ENCAPSULATION: encapsulation = wxT("wav"); break; case TS_ENCAPSULATION: default: encapsulation = wxT("ts"); break; } /* Now continue with the duplicate option */ wxString dup_opts; if( access_checkboxes[PLAY_ACCESS_OUT]->IsChecked() ) { dup_opts += wxT("dst=display"); } if( access_checkboxes[FILE_ACCESS_OUT]->IsChecked() ) { if( !dup_opts.IsEmpty() ) dup_opts += wxT(","); dup_opts += wxT("dst=std{access=file,mux="); dup_opts += encapsulation + wxT(",url=\""); dup_opts += file_combo->GetValue() + wxT("\"}"); } if( access_checkboxes[HTTP_ACCESS_OUT]->IsChecked() ) { if( !dup_opts.IsEmpty() ) dup_opts += wxT(","); dup_opts += wxT("dst=std{access=http,mux="); dup_opts += encapsulation + wxT(",url="); dup_opts += net_addrs[HTTP_ACCESS_OUT]->GetLineText(0); dup_opts += wxString::Format( wxT(":%d"), net_ports[HTTP_ACCESS_OUT]->GetValue() ); dup_opts += wxT("}"); } if( access_checkboxes[MMSH_ACCESS_OUT]->IsChecked() ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -