⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wizard.cpp

📁 video linux conference
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    /* Audio box */    wxStaticBox *audio_box = new wxStaticBox( this, -1, wxU(_("Audio")) );    wxStaticBoxSizer *audio_sizer = new wxStaticBoxSizer( audio_box,                                                          wxVERTICAL );    /* Line1: enabler */    wxFlexGridSizer *audio_sizer1 = new wxFlexGridSizer( 2,3,20);    audio_sizer1->Add( new wxCheckBox( this, AudioEnable_Event,                            wxU(_("Transcode audio") ) ), 0 , wxALIGN_CENTER_VERTICAL|wxALL, 5 );    audio_sizer1->Add( 0, 0, 1 );    /* Line 2 : codec */    audio_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT,5);    audio_combo = new wxComboBox( this, AudioCodec_Event, wxT(""),                                  wxDefaultPosition, wxSize(200,25), 0, NULL,                                   wxCB_DROPDOWN| wxCB_READONLY );    for( int i= 0; acodecs_array[i].psz_display != NULL; i++ )    {        audio_combo->Append( wxU( acodecs_array[i].psz_display ) ,                            (void *)&acodecs_array[i] );    }    i_audio_codec = 0;    audio_combo->SetSelection(0);    audio_sizer1->Add( audio_combo, 0 , wxALIGN_LEFT, 0 );    audio_sizer1->Add( new wxStaticText(this, -1, wxU(_("Bitrate (kb/s)"))),0,                       wxLEFT ,5);    ab_combo = new wxComboBox( this, AudioBitrate_Event, wxT("192"),                               wxDefaultPosition, wxDefaultSize,                               WXSIZEOF(abitrates_array), abitrates_array, wxCB_READONLY );    audio_sizer1->Add( ab_combo, 0, wxALIGN_LEFT, 0 );    /* Line 3 : text */    audio_text = new wxStaticText( this, -1,                     wxU( vlc_wraptext( TR_AUDIO_TEXT, TEXTWIDTH, false) ) );    audio_sizer->Add(audio_sizer1, 0, wxEXPAND, 5);    audio_sizer->Add( audio_text, 0, wxLEFT | wxTOP, 5 );    main_sizer->Add( video_sizer, 1, wxGROW, 0 );    main_sizer->Add( audio_sizer, 1, wxGROW, 0 );    main_sizer->Layout();    SetSizerAndFit( main_sizer );    /* Default disabled */    video_combo->Disable(); video_text->Disable();vb_combo->Disable();    audio_combo->Disable(); audio_text->Disable();ab_combo->Disable();}wizTranscodeCodecPage::~wizTranscodeCodecPage(){    if( acodec ) free( acodec );    if( vcodec ) free( vcodec );}void wizTranscodeCodecPage::OnEnableVideo(wxCommandEvent& event){   video_combo->Enable( event.IsChecked() );   vb_combo->Enable( event.IsChecked() );   video_text->Enable( event.IsChecked() );}void wizTranscodeCodecPage::OnEnableAudio(wxCommandEvent& event){   audio_combo->Enable( event.IsChecked() );   ab_combo->Enable( event.IsChecked() );   audio_text->Enable( event.IsChecked() );}void wizTranscodeCodecPage::OnVideoCodecChange(wxCommandEvent& event){    struct codec *c = (struct codec*)             (video_combo->GetClientData(video_combo->GetSelection()));    video_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH, false) ) );    i_video_codec = video_combo->GetSelection();    vcodec = strdup(c->psz_codec);}void wizTranscodeCodecPage::OnAudioCodecChange(wxCommandEvent& event){    struct codec *c = (struct codec*)             (audio_combo->GetClientData(audio_combo->GetSelection()));    audio_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH, false) ) );    i_audio_codec = audio_combo->GetSelection();    acodec = strdup(c->psz_codec);}void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event){    unsigned int i,j;    if( !event.GetDirection() )    {            GetPrev()->Enable();            return;    }    /* Set the dummy codec ( accept all muxers ) if needed */    if( !video_combo->IsEnabled() )    {        i_video_codec = VCODECS_NUMBER;    }    if( !audio_combo->IsEnabled() )    {        i_audio_codec = ACODECS_NUMBER;    }    ((wizEncapPage *)GetNext())->SetPrev(this);    for( i = 0 ; i< MUXERS_NUMBER ; i++ )    {        if( vcodecs_array[i_video_codec].muxers[i] != -1 )        {            for( j = 0 ; j<  MUXERS_NUMBER ; j++ )            {                if( acodecs_array[i_audio_codec].muxers[j] ==                              vcodecs_array[i_video_codec].muxers[i] )                {                    ((wizEncapPage*)GetNext())->EnableEncap(                               vcodecs_array[i_video_codec].muxers[i] );                }            }        }    }    struct codec *c = (struct codec*)             (video_combo->GetClientData( video_combo->IsEnabled() ?                                          video_combo->GetSelection(): i_video_codec ));    vcodec = strdup(c->psz_codec);    c = (struct codec*)           (audio_combo->GetClientData( audio_combo->IsEnabled() ?                                       audio_combo->GetSelection() : i_audio_codec ));    acodec = strdup(c->psz_codec);    int vb = atoi(vb_combo->GetValue().mb_str() );    if( vb == 0 )    {         vb = 1024;    }    int ab = atoi(ab_combo->GetValue().mb_str() );    if( ab == 0)    {        ab = 192;    }    p_parent->SetTranscode( vcodec, vb , acodec, ab );    ((wizEncapPage*)GetNext())->SetAction( p_parent->GetAction() );    p_parent->SetAction( p_parent->GetAction() );    return;}wxWizardPage *wizTranscodeCodecPage::GetPrev() const { return p_prev; }wxWizardPage *wizTranscodeCodecPage::GetNext() const { return p_next; }void wizTranscodeCodecPage::SetPrev( wxWizardPage *page) {p_prev = page; }/*************************************************** * First streaming page: choose method             * ***************************************************/wizStreamingMethodPage::wizStreamingMethodPage( wxWizard *parent,    wxWizardPage *next) : wxWizardPage(parent){    int i;    p_next = next;    p_parent = (WizardDialog *)parent;    mainSizer = new wxBoxSizer(wxVERTICAL);    /* Create the texts */    pageHeader( this, mainSizer,  STREAMING1_TITLE, STREAMING1_TEXT );    mainSizer->Add( 0,50,0 );    i_method = 0;    wxStaticBox *method_box = new wxStaticBox( this, -1,                                               wxU(_("Streaming method")) );    wxStaticBoxSizer *method_sizer = new wxStaticBoxSizer(method_box,                                                          wxHORIZONTAL );    for( i = 0 ; i< 3 ; i++ )    {        method_radios[i] = new wxRadioButton( this, MethodRadio0_Event + i,                               wxU( methods_array[i].psz_method ) );        method_radios[i]->SetToolTip( wxU(_( methods_array[i].psz_descr ) ) );        method_sizer->Add( method_radios[i], 0, wxALL, 5 );    }    method_sizer->Layout();    wxStaticBox *address_box = new wxStaticBox( this, -1,                    wxU(_("Destination")) );    address_sizer = new wxStaticBoxSizer(address_box,                                         wxVERTICAL );    /* Big kludge, we take the longest text to get the size */    address_text = new wxStaticText(this, -1,               wxU( vlc_wraptext(methods_array[2].psz_address,                                 TEXTWIDTH, false ) ),               wxDefaultPosition, wxDefaultSize );    address_txtctrl = new wxTextCtrl( this, -1, wxU(""), wxDefaultPosition,                                      wxSize(200,25));    address_sizer->Add( address_text, 0, wxALL, 5 );    address_sizer->Add( address_txtctrl, 0, wxALL, 5 );    address_sizer->Layout();    /* Set the minimum size */    address_sizer->SetMinSize( address_sizer->GetSize() );    address_text->SetLabel( wxU(     vlc_wraptext( _(methods_array[0].psz_address), TEXTWIDTH, false)));    mainSizer->Add( method_sizer, 0, wxALL | wxEXPAND, 5 );    mainSizer->Add( address_sizer, 0, wxALL | wxEXPAND, 5 );    mainSizer->Add( 0,0,1 );    mainSizer->Layout();    SetSizer(mainSizer);    mainSizer->Fit(this);    return;}void wizStreamingMethodPage::OnWizardPageChanging(wxWizardEvent& event){    unsigned int i;    if( !event.GetDirection() ) return;    /* Check valid address */    if( i_method == 1 && !ismult( address_txtctrl->GetValue().mb_str()) )    {        wxMessageBox( wxU( INVALID_MCAST_ADDRESS ) , wxU( ERROR_MSG ),                      wxICON_WARNING | wxOK, this->p_parent );        event.Veto();    }    else if( i_method == 0 && address_txtctrl->GetValue().IsEmpty() )    {        wxMessageBox( wxU( NO_ADDRESS ) , wxU( ERROR_MSG ),                      wxICON_WARNING | wxOK, this->p_parent );        event.Veto();    }    ((wizEncapPage *)GetNext())->SetPrev(this);    for( i = 0 ; i< MUXERS_NUMBER ; i++ )    {        if( methods_array[i_method].muxers[i] != -1 )        {            ((wizEncapPage*)GetNext())->EnableEncap(                               methods_array[i_method].muxers[i] );        }    }    p_parent->SetStream( methods_array[i_method].psz_access ,                         (char *)address_txtctrl->GetValue().mb_str() );    /* Set the action for the muxer page */    ((wizEncapPage*)GetNext())->SetAction( p_parent->GetAction() );    return;}wxWizardPage *wizStreamingMethodPage::GetPrev() const { return p_prev; }wxWizardPage *wizStreamingMethodPage::GetNext() const { return p_next; }void wizStreamingMethodPage::SetPrev( wxWizardPage *page) {p_prev = page; }void wizStreamingMethodPage::OnMethodChange( wxCommandEvent& event ){    i_method = event.GetId() - MethodRadio0_Event;    address_text->SetLabel( wxU(     vlc_wraptext( _(methods_array[i_method].psz_address), TEXTWIDTH, false)));    address_sizer->Layout();    mainSizer->Layout();}/*************************************************** * Choose encapsulation format                     * ***************************************************/wizEncapPage::wizEncapPage( wxWizard *parent ) : wxWizardPage(parent){    int i;    i_mux = 0;    p_parent = (WizardDialog *)parent;    p_streaming_page = NULL;    p_transcode_page = NULL;    p_prev = NULL;    wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);    /* Create the texts */    pageHeader( this, mainSizer, ENCAP_TITLE, ENCAP_TEXT );    mainSizer->Add( 0,0,1 );    for( i = 0 ; i< MUXERS_NUMBER ; i++ )    {        encap_radios[i] = new wxRadioButton( this, EncapRadio0_Event + i,                               wxU( encaps_array[i].psz_encap ) );        encap_radios[i]->SetToolTip( wxU(_( encaps_array[i].psz_descr ) ) );        mainSizer->Add( encap_radios[i], 0, wxLEFT, 5 );        encap_radios[i]->Disable();    }    mainSizer->Add( 0,0,1 );    SetSizer(mainSizer);    mainSizer->Fit(this);}wizEncapPage::~wizEncapPage(){}void wizEncapPage::OnWizardPageChanging(wxWizardEvent& event){    int i;    if( !event.GetDirection() )    {        for( i = 0 ; i< MUXERS_NUMBER ; i++ )        {            encap_radios[i]->Disable();        }    }    p_parent->SetMux( encaps_array[i_mux].psz_mux );    if( p_parent->GetAction() == ACTION_STREAM )    {        if( strstr( p_parent->method, "udp" ))        {            ((wizStreamingExtraPage *)GetNext())->sap_checkbox->Enable();            ((wizStreamingExtraPage *)GetNext())->sap_text->Enable(false);        }        else        {           ((wizStreamingExtraPage *)GetNext())->sap_checkbox->Enable( false );           ((wizStreamingExtraPage *)GetNext())->sap_text->Enable( false );        }    }    return;}void wizEncapPage::OnEncapChange( wxCommandEvent& event ){    i_mux = event.GetId() - EncapRadio0_Event;}void wizEncapPage::EnableEncap( int encap ){    int i;    for( i = 0 ; i< MUXERS_NUMBER ; i++)    {        if( encaps_array[i].id == encap )        {            encap_radios[i]->Enable();            encap_radios[i]->SetValue(true);            i_mux = i;        }    }}void wizEncapPage::SetStreamingPage( wxWizardPage *page){    p_streaming_page = page;}void wizEncapPage::SetTranscodePage( wxWizardPage *page){    p_transcode_page = page;}wxWizardPage *wizEncapPage::GetPrev() const { return p_prev; }wxWizardPage *wizEncapPage::GetNext() const{    if( i_action== ACTION_STREAM )        return p_streaming_page;    else       return p_transcode_page;}void wizEncapPage::SetAction( int i_act  ) { i_action = i_act; }void wizEncapPage::SetPrev( wxWizardPage *page) { p_prev = page; }/*************************************************** * Extra transcoding page : Select file            * ***************************************************/wizTranscodeExtraPage::wizTranscodeExtraPage( wxWizard *parent,                       wxWizardPage *prev,                       wxWizardPage *next) : wxWizardPage(parent){    p_next = next;    p_prev = prev;    p_parent = (WizardDialog *) parent;    wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);    /* Create the texts */    pageHeader( this, mainSizer, EXTRATRANSCODE_TITLE, EXTRATRANSCODE_TEXT );    mainSizer->Add( 0, 0, 1 );    wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 2, 1 );    sizer->Add( new wxStaticText( this, -1,                    wxU(_("Select the file to save to") ) ),                    0, wxALL, 5 );    sizer->Add( 0, 0, 1 );    file_text = new wxTextCtrl( this, -1, wxU(""), wxDefaultPosition,                                wxSize( 150, -1 ) );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -