📄 wizard.cpp
字号:
/***************************************************************************** * wizard.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2004 VideoLAN * $Id: wizard.cpp 10641 2005-04-10 18:40:52Z zorglub $ * * Authors: Cl閙ent Stenac <zorglub@videolan.org> * * 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 "streamdata.h"#include <wx/statline.h>class wizHelloPage;class wizInputPage;/***************************************************************************** * Define events *****************************************************************************/enum{ ActionRadio0_Event, ActionRadio1_Event, MoreInfoStreaming_Event, MoreInfoTranscode_Event, Open_Event , Choose_Event , ListView_Event, InputRadio0_Event, InputRadio1_Event, PartialEnable_Event, MethodRadio0_Event, MethodRadio1_Event, MethodRadio2_Event, MethodRadio3_Event, EncapRadio0_Event, EncapRadio1_Event, EncapRadio2_Event, EncapRadio3_Event, EncapRadio4_Event, EncapRadio5_Event, EncapRadio6_Event, EncapRadio7_Event, EncapRadio8_Event, EncapRadio9_Event, EncapRadio10_Event, EncapRadio11_Event, VideoEnable_Event, VideoCodec_Event,VideoBitrate_Event, AudioEnable_Event, AudioCodec_Event,AudioBitrate_Event, SAP_Event,};#define TEXTWIDTH 55#define ACTION_STREAM 0#define ACTION_TRANSCODE 1BEGIN_EVENT_TABLE(WizardDialog, wxWizard)END_EVENT_TABLE()/***************************************************************************** * Wizard strings *****************************************************************************/#define ERROR_MSG _("Error")#define ITEM_NAME _("Streaming/Transcoding Wizard")/* Hello page */#define HELLO_TITLE _("Streaming/Transcoding Wizard")#define HELLO_TEXT _("This wizard helps you to stream, transcode or" \ " save a stream")#define HELLO_STREAMING _("Stream to network")#define HELLO_STREAMING_DESC _("Use this to stream on a network")#define HELLO_TRANSCODE _("Transcode/Save to file")#define HELLO_TRANSCODE_DESC _("Use this to re-encode a stream and save it to a file")#define HELLO_NOTICE _("This wizard only gives access to a small subset of VLC's streaming and transcoding capabilities. Use the Open and Stream Output dialogs to get all of them")#define MOREINFO_STREAM _("Use this to stream on a network")#define MOREINFO_TRANSCODE _("Use this to save a stream to a file. You have the possibility to reencode the stream. You can save whatever VLC can read.\nPlease notice that VLC is not very suited " \ "for file to file transcoding. You should use its transcoding " \ "features to save network streams, for example" )/* Input page */#define INPUT_TITLE _("Choose input")#define INPUT_TEXT _("Choose here your input stream")#define INPUT_OPEN _("Select a stream" )#define INPUT_PL _( "Existing playlist item" )#define CHOOSE_STREAM _("You must choose a stream")#define NO_PLAYLIST _("Uh Oh! Unable to find playlist !")#define PARTIAL _("Use this to read only a part of the stream. " \ "You must be able to control the incoming stream " \ "(for example, a file or a disc, but not an UDP " \ "network stream.)\n" \ "Enter the starting and ending times (in seconds)")#define INPUT_BUTTON _("Choose")/* Transcode 1 */#define TRANSCODE1_TITLE _("Transcode")#define TRANSCODE1_TEXT _("If you want to change the compression format of the audio or video tracks, fill in this page. (If you only want to change the container format, proceed to next page).")#define TR_VIDEO_TEXT0 _("If your stream has video and you want to " \ "transcode it, enable this")#define TR_VIDEO_TEXT _("Select your video codec. Click one to get more " \ "information")#define TR_AUDIO_TEXT0 _("If your stream has audio and you want to "\ "transcode it, enable this")#define TR_AUDIO_TEXT _("Select your audio codec. Click one to get more " \ "information")/* Streaming 1 */#define STREAMING1_TITLE _("Streaming")#define STREAMING1_TEXT _("In this page, you will select how your input stream will be sent.")#define INVALID_MCAST_ADDRESS _("This does not appear to be a valid " \ "multicast address" )#define NO_ADDRESS _("You need to enter an address" )/* Encap */#define ENCAP_TITLE _("Encapsulation format")#define ENCAP_TEXT _("In this page, you will select how the stream will be "\ "encapsulated. Depending on the choices you made, all "\ "formats won't be available." )/* Transcode 2 */#define EXTRATRANSCODE_TITLE _("Additional transcode options")#define EXTRATRANSCODE_TEXT _("In this page, you will define a few " \ "additionnal parameters for your transcoding" )#define CHOOSE_OUTFILE _("You must choose a file to save to")/* Streaming 2 */#define EXTRASTREAMING_TITLE _("Additional streaming options")#define EXTRASTREAMING_TEXT _("In this page, you will define a few " \ "additionnal parameters for your stream" )#define TTL _("Define the TTL (Time-To-Live) of the stream. This parameter " \ "is the maximum number of routers your stream can go through. " \ "If you don't know what it means, or if you want to stream on " \ "your local network only, leave this setting to 1." )#define SAP _("When streaming using UDP, you can announce your streams " \ "using the SAP/SDP announcing protocol. This way, the clients " \ "won't have to type in the multicast address, it will appear " \ "in their playlist if they enable the SAP extra interface.\n" \ "If you want to give a name to your stream, enter it here, " \ "else, a default name will be used" )/***************************************************************************** * All the pages of the wizard, declaration *****************************************************************************//* Declare classes */class wizHelloPage : public wxWizardPageSimple{ public: wizHelloPage( wxWizard *parent); void OnActionChange( wxCommandEvent& event ); void OnWizardPageChanging(wxWizardEvent& event); void OnMoreInfo( wxCommandEvent& event ); protected: int i_action; WizardDialog *p_parent; wxRadioButton *action_radios[2]; DECLARE_EVENT_TABLE()};BEGIN_EVENT_TABLE(wizHelloPage, wxWizardPageSimple) EVT_RADIOBUTTON( ActionRadio0_Event, wizHelloPage::OnActionChange) EVT_RADIOBUTTON( ActionRadio1_Event, wizHelloPage::OnActionChange) EVT_BUTTON( MoreInfoStreaming_Event, wizHelloPage::OnMoreInfo ) EVT_BUTTON( MoreInfoTranscode_Event, wizHelloPage::OnMoreInfo ) EVT_WIZARD_PAGE_CHANGING(-1, wizHelloPage::OnWizardPageChanging)END_EVENT_TABLE()class wizInputPage : public wxWizardPage{ public: wizInputPage( wxWizard *, wxWizardPage *, intf_thread_t *); wizInputPage::~wizInputPage(); void OnWizardPageChanging(wxWizardEvent& event); void OnInputChange( wxCommandEvent& event ); void OnEnablePartial(wxCommandEvent& event); virtual wxWizardPage *GetPrev() const; virtual wxWizardPage *GetNext() const; void SetStreamingPage( wxWizardPage *page); void SetTranscodePage( wxWizardPage *page); void SetAction( int i_action ); void SetPintf( intf_thread_t *p_intf ); void SetUri( char *psz_uri ); void SetPartial( int i_from, int i_to ); protected: bool b_chosen; intf_thread_t *p_intf; int i_action; int i_input; void OnChoose( wxCommandEvent& event ); WizardDialog *p_parent; wxRadioButton *input_radios[2]; wxCheckBox *enable_checkbox; wxBoxSizer *mainSizer; wxArrayString mrl; wxTextCtrl *mrl_text; wxTextCtrl *from_text; wxTextCtrl *to_text; OpenDialog *p_open_dialog; wxListView *listview; wxPanel *open_panel; wxWizardPage *p_prev; wxWizardPage *p_streaming_page; wxWizardPage *p_transcode_page; DECLARE_EVENT_TABLE()};BEGIN_EVENT_TABLE(wizInputPage, wxWizardPage) EVT_RADIOBUTTON( InputRadio0_Event, wizInputPage::OnInputChange) EVT_RADIOBUTTON( InputRadio1_Event, wizInputPage::OnInputChange) EVT_BUTTON( Choose_Event, wizInputPage::OnChoose) EVT_CHECKBOX( PartialEnable_Event, wizInputPage::OnEnablePartial) EVT_WIZARD_PAGE_CHANGING(-1, wizInputPage::OnWizardPageChanging)END_EVENT_TABLE()class wizTranscodeCodecPage : public wxWizardPage{public: wizTranscodeCodecPage( wxWizard *parent, wxWizardPage *next); ~wizTranscodeCodecPage(); void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event); virtual wxWizardPage *GetPrev() const; virtual wxWizardPage *GetNext() const; void SetPrev( wxWizardPage *page);protected: wxCheckBox *video_checkbox; wxComboBox *video_combo; wxComboBox *vb_combo; wxStaticText * video_text; wxCheckBox *audio_checkbox; wxComboBox *audio_combo; wxComboBox *ab_combo; wxStaticText * audio_text; WizardDialog *p_parent; int i_audio_codec; int i_video_codec; char *vcodec; char *acodec; wxWizardPage *p_prev; wxWizardPage *p_next; void OnVideoCodecChange(wxCommandEvent& event); void OnAudioCodecChange(wxCommandEvent& event); void OnEnableVideo(wxCommandEvent& event); void OnEnableAudio(wxCommandEvent& event); DECLARE_EVENT_TABLE()};BEGIN_EVENT_TABLE(wizTranscodeCodecPage, wxWizardPage) EVT_CHECKBOX( VideoEnable_Event, wizTranscodeCodecPage::OnEnableVideo) EVT_CHECKBOX( AudioEnable_Event, wizTranscodeCodecPage::OnEnableAudio) EVT_COMBOBOX( VideoCodec_Event, wizTranscodeCodecPage::OnVideoCodecChange) EVT_COMBOBOX( AudioCodec_Event, wizTranscodeCodecPage::OnAudioCodecChange) EVT_WIZARD_PAGE_CHANGING(-1, wizTranscodeCodecPage::OnWizardPageChanging)END_EVENT_TABLE()class wizStreamingMethodPage : public wxWizardPage{public: wizStreamingMethodPage( wxWizard *parent, wxWizardPage *next); void OnWizardPageChanging(wxWizardEvent& event); virtual wxWizardPage *GetPrev() const; virtual wxWizardPage *GetNext() const; void SetPrev( wxWizardPage *page);protected: DECLARE_EVENT_TABLE() int i_method; wxBoxSizer *mainSizer; wxStaticBoxSizer *address_sizer; wxStaticText *address_text; wxTextCtrl *address_txtctrl; WizardDialog * p_parent; void OnMethodChange( wxCommandEvent& event ); wxRadioButton *method_radios[4]; wxWizardPage *p_prev; wxWizardPage *p_next;};BEGIN_EVENT_TABLE(wizStreamingMethodPage, wxWizardPage) EVT_RADIOBUTTON( MethodRadio0_Event, wizStreamingMethodPage::OnMethodChange) EVT_RADIOBUTTON( MethodRadio1_Event, wizStreamingMethodPage::OnMethodChange) EVT_RADIOBUTTON( MethodRadio2_Event, wizStreamingMethodPage::OnMethodChange) EVT_RADIOBUTTON( MethodRadio3_Event, wizStreamingMethodPage::OnMethodChange) EVT_WIZARD_PAGE_CHANGING(-1, wizStreamingMethodPage::OnWizardPageChanging)END_EVENT_TABLE()class wizEncapPage : public wxWizardPage{public: wizEncapPage( wxWizard *parent); wizEncapPage::~wizEncapPage(); void OnWizardPageChanging(wxWizardEvent& event); virtual wxWizardPage *GetPrev() const; virtual wxWizardPage *GetNext() const; void SetStreamingPage( wxWizardPage *page); void SetTranscodePage( wxWizardPage *page); void SetPrev( wxWizardPage *page); void SetAction( int ); void EnableEncap( int encap );protected: DECLARE_EVENT_TABLE() int i_encap; int i_mux; int i_action; void OnEncapChange( wxCommandEvent& event ); wxRadioButton *encap_radios[MUXERS_NUMBER]; WizardDialog *p_parent; wxWizardPage *p_prev; wxWizardPage *p_streaming_page; wxWizardPage *p_transcode_page;};BEGIN_EVENT_TABLE(wizEncapPage, wxWizardPage) EVT_WIZARD_PAGE_CHANGING(-1, wizEncapPage::OnWizardPageChanging) EVT_RADIOBUTTON( EncapRadio0_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio1_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio2_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio3_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio4_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio5_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio6_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio7_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio8_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio9_Event, wizEncapPage::OnEncapChange) EVT_RADIOBUTTON( EncapRadio10_Event, wizEncapPage::OnEncapChange)END_EVENT_TABLE()/* Additional settings for transcode */class wizTranscodeExtraPage : public wxWizardPage{public: wizTranscodeExtraPage( wxWizard *parent, wxWizardPage *prev, wxWizardPage *next); virtual wxWizardPage *GetPrev() const; virtual wxWizardPage *GetNext() const; void OnWizardPageChanging( wxWizardEvent& event );protected: DECLARE_EVENT_TABLE() void wizTranscodeExtraPage::OnSelectFile(wxCommandEvent&); wxTextCtrl *file_text; WizardDialog *p_parent; wxWizardPage *p_prev; wxWizardPage *p_next;};BEGIN_EVENT_TABLE(wizTranscodeExtraPage, wxWizardPage) EVT_BUTTON( Open_Event, wizTranscodeExtraPage::OnSelectFile) EVT_WIZARD_PAGE_CHANGING(-1, wizTranscodeExtraPage::OnWizardPageChanging)END_EVENT_TABLE()/* Additional settings for streaming */class wizStreamingExtraPage : public wxWizardPage{public: wizStreamingExtraPage( wxWizard *parent, wxWizardPage *prev, wxWizardPage *next); virtual wxWizardPage *GetPrev() const; virtual wxWizardPage *GetNext() const; void OnWizardPageChanging(wxWizardEvent&); void OnSAP( wxCommandEvent&); wxCheckBox *sap_checkbox; wxTextCtrl *sap_text;protected: friend class wizEncapPage; DECLARE_EVENT_TABLE() WizardDialog *p_parent; wxWizardPage *p_prev; wxWizardPage *p_next;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -