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

📄 open.cpp

📁 VLC媒体播放程序
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );    if( psz_subsfile && *psz_subsfile )    {        subsfile_checkbox->SetValue(TRUE);        subsfile_button->Enable();        subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxL2U(psz_subsfile) );    }    if( psz_subsfile ) free( psz_subsfile );    subsfile_sizer->Add( subsfile_button, 1,                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 );    sizer->Add( subsfile_sizer, 0, wxEXPAND | wxALL, 5 );    panel->SetSizerAndFit( sizer );    return panel;}wxPanel *OpenDialog::DiscPanel( wxWindow* parent ){    wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,                                  wxSize(200, 200) );    wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );    wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 3, 20 );    static const wxString disc_type_array[] =    {        wxU(_("DVD (menus support)")),        wxU(_("DVD")),        wxU(_("VCD")),        wxU(_("Audio CD"))    };    disc_type = new wxRadioBox( panel, DiscType_Event, wxU(_("Disc type")),                                wxDefaultPosition, wxDefaultSize,                                WXSIZEOF(disc_type_array), disc_type_array,                                WXSIZEOF(disc_type_array), wxRA_SPECIFY_COLS );    sizer_row->Add( disc_type, i_disc_type_selection, wxEXPAND | wxALL, 5 );    wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Device name")) );    disc_device = new wxTextCtrl( panel, DiscDevice_Event, wxT(""),                                  wxDefaultPosition, wxDefaultSize,                                  wxTE_PROCESS_ENTER);    sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    sizer->Add( disc_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    disc_title_label = new wxStaticText( panel, -1, wxU(_("Title")) );    disc_title = new wxSpinCtrl( panel, DiscTitle_Event );    sizer->Add( disc_title_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    disc_chapter_label = new wxStaticText( panel, -1, wxU(_("Chapter")) );    disc_chapter = new wxSpinCtrl( panel, DiscChapter_Event );    sizer->Add( disc_chapter_label, 0,                wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    sizer->Add( disc_chapter, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );    panel->SetSizerAndFit( sizer_row );    return panel;}wxPanel *OpenDialog::NetPanel( wxWindow* parent ){    int i;    wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,                                  wxSize(200, 200) );    wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );    wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 4, 20 );    static const wxString net_type_array[] =    {        wxU(_("UDP/RTP")),        wxU(_("UDP/RTP Multicast")),        wxU(_("HTTP/FTP/MMS")),        wxU(_("RTSP"))    };    for( i=0; i<4; i++ )    {        net_radios[i] = new wxRadioButton( panel, NetRadio1_Event + i,                                           net_type_array[i],                                           wxDefaultPosition, wxDefaultSize,                                           wxRB_SINGLE );        net_subpanels[i] = new wxPanel( panel, -1,                                        wxDefaultPosition, wxDefaultSize );    }    /* UDP/RTP row */    wxFlexGridSizer *subpanel_sizer;    wxStaticText *label;    i_net_ports[0] = config_GetInt( p_intf, "server-port" );    subpanel_sizer = new wxFlexGridSizer( 3, 1, 20 );    label = new wxStaticText( net_subpanels[0], -1, wxU(_("Port")) );    net_ports[0] = new wxSpinCtrl( net_subpanels[0], NetPort1_Event,                                   wxString::Format(wxT("%d"), i_net_ports[0]),                                   wxDefaultPosition, wxDefaultSize,                                   wxSP_ARROW_KEYS,                                   0, 16000, i_net_ports[0] );    subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    subpanel_sizer->Add( net_ports[0], 1,                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    net_ipv6 = new wxCheckBox( net_subpanels[0], NetForceIPv6_Event,                               wxU(_("Force IPv6")));    subpanel_sizer->Add( net_ipv6, 0,                         wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    net_subpanels[0]->SetSizerAndFit( subpanel_sizer );    net_radios[0]->SetValue( TRUE );    /* UDP/RTP Multicast row */    subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );    label = new wxStaticText( net_subpanels[1], -1, wxU(_("Address")) );    net_addrs[1] = new wxTextCtrl( net_subpanels[1], NetAddr2_Event, wxT(""),                                   wxDefaultPosition, wxDefaultSize,                                   wxTE_PROCESS_ENTER);    subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    subpanel_sizer->Add( net_addrs[1], 1,                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    label = new wxStaticText( net_subpanels[1], -1, wxU(_("Port")) );    i_net_ports[1] = i_net_ports[0];    net_ports[1] = new wxSpinCtrl( net_subpanels[1], NetPort2_Event,                                   wxString::Format(wxT("%d"), i_net_ports[1]),                                   wxDefaultPosition, wxDefaultSize,                                   wxSP_ARROW_KEYS,                                   0, 16000, i_net_ports[1] );    subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    subpanel_sizer->Add( net_ports[1], 1,                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    net_subpanels[1]->SetSizerAndFit( subpanel_sizer );    /* HTTP and RTSP rows */    for( i=2; i<4; i++ )    {        subpanel_sizer = new wxFlexGridSizer( 2, 1, 20 );        label = new wxStaticText( net_subpanels[i], -1, wxU(_("URL")) );        net_addrs[i] = new wxTextCtrl( net_subpanels[i], NetAddr1_Event + i,                                       (i == 2) ? wxT("") : wxT("rtsp://"),                                       wxDefaultPosition, wxSize( 200, -1 ),                                       wxTE_PROCESS_ENTER);        subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );        subpanel_sizer->Add( net_addrs[i], 1,                             wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );        net_subpanels[i]->SetSizerAndFit( subpanel_sizer );    }    /* Stuff everything into the main panel */    for( i=0; i<4; i++ )    {        sizer->Add( net_radios[i], 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |                    wxALL, 5 );        sizer->Add( net_subpanels[i], 1, wxEXPAND | wxALIGN_LEFT |                    wxALIGN_CENTER_VERTICAL | wxALL, 5  );    }    sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );    panel->SetSizerAndFit( sizer_row );    return panel;}#ifndef WIN32wxPanel *OpenDialog::V4LPanel( wxWindow* parent ){    wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,                                  wxSize(200, 200) );    wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );    wxFlexGridSizer *sizer = new wxFlexGridSizer( 1, 4, 20 );    static const wxString video_type_array[] =    {        wxU(_("Webcam")),        wxU(_("TV card")),        wxU(_("PVR")),        wxU(_("Kfir")),    };    video_type = new wxRadioBox( panel, VideoType_Event,            wxU(_("Video device type")),            wxDefaultPosition, wxDefaultSize,            WXSIZEOF(video_type_array), video_type_array,            WXSIZEOF(video_type_array), wxRA_SPECIFY_COLS );    sizer_row->Add( video_type, 0, wxEXPAND | wxALL, 5 );    /* Video Options */    wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 4, 2, 20 );    wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Video device")) );    video_device = new wxTextCtrl( panel, VideoDevice_Event, wxT(""),                                  wxDefaultPosition, wxDefaultSize,                                  wxTE_PROCESS_ENTER);    video_device->SetToolTip( wxU(_("Device corresponding to your acquisition "                                    "card or your webcam")) );    video_sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    video_sizer->Add( video_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    label = new wxStaticText( panel, -1, wxU(_("Channel")) );    video_channel = new wxSpinCtrl( panel, VideoChannel_Event, wxT("0") );    video_channel->SetToolTip( wxU(_("Usually 0 is for tuner, 1 for composite "                                     "and 2 for svideo")) );    video_sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_HORIZONTAL );    video_sizer->Add( video_channel, 1, wxALIGN_LEFT | wxALIGN_CENTER_HORIZONTAL );    sizer->Add( video_sizer, 0, wxEXPAND | wxALL, 5 );    wxBoxSizer *v4lbutton_sizer = new wxBoxSizer( wxHORIZONTAL );    v4l_button = new wxButton( panel, V4LSettings_Event,                            wxU(_("Advanced settings...")) );    v4lbutton_sizer->Add( v4l_button, 0, wxALIGN_RIGHT, 5 );    sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );    sizer_row->Add( v4lbutton_sizer, 0, wxEXPAND | wxALL, 5 );    panel->SetSizerAndFit( sizer_row );    return panel;}#endifvoid OpenDialog::UpdateMRL(){    UpdateMRL( i_current_access_method );}void OpenDialog::UpdateMRL( int i_access_method ){    wxString demux, mrltemp;    i_current_access_method = i_access_method;    switch( i_access_method )    {    case FILE_ACCESS:        //mrltemp = wxT("file") + demux + wxT(":") + file_combo->GetValue();        mrltemp = file_combo->GetValue();        break;    case DISC_ACCESS:      i_disc_type_selection = disc_type->GetSelection();      switch ( i_disc_type_selection )        {        case 0:          disc_chapter->Enable();          disc_chapter_label->Enable();          mrltemp = wxT("dvd://")                  + disc_device->GetValue()                  + wxString::Format( wxT("@%d:%d"),                                      disc_title->GetValue(),                                      disc_chapter->GetValue() );          break;        case 1:          disc_chapter->Enable();          disc_chapter_label->Enable();          mrltemp = wxT("dvdsimple://")                  + disc_device->GetValue()                  + wxString::Format( wxT("@%d:%d"),                                      disc_title->GetValue(),                                      disc_chapter->GetValue() );          break;        case 2:          disc_chapter->Disable();          disc_chapter_label->Disable();#ifdef HAVE_VCDX          if ( disc_title->GetValue() )            mrltemp = wxT("vcdx://")              + disc_device->GetValue()              + wxString::Format( wxT("@%c%d"),                                  config_GetInt( p_intf, "vcdx-PBC"  )                                  ? 'P' : 'E',                                  disc_title->GetValue()                                  );          else            mrltemp = wxT("vcdx://")                  + disc_device->GetValue();#else          mrltemp = wxT("vcd://")                  + disc_device->GetValue()                  + wxString::Format( wxT("@%d"),                                      disc_title->GetValue() );#endif          break;        case 3:          disc_chapter->Disable();          disc_chapter_label->Disable();#ifdef HAVE_CDDAX          if ( disc_title->GetValue() )            mrltemp =  wxT("cddax://")                  + disc_device->GetValue()                  + wxString::Format( wxT("@T%d"),                                      disc_title->GetValue() );          else            mrltemp = wxT("cddax://")                  + disc_device->GetValue();#else          mrltemp =  wxT("cdda://")                  + disc_device->GetValue()                  + wxString::Format( wxT("@%d"),                                      disc_title->GetValue() );#endif          break;        default: ;          msg_Err( p_intf, "invalid selection (%d)",                   disc_type->GetSelection() );        }        break;    case NET_ACCESS:        switch( i_net_type )        {        case 0:            mrltemp = wxT("udp") + demux + wxT("://");            if ( net_ipv6->GetValue() )            {                mrltemp += wxT("@[::]");            }            if( i_net_ports[0] !=                config_GetInt( p_intf, "server-port" ) )            {                mrltemp += wxString::Format( wxT("@:%d"), i_net_ports[0] );            }            break;        case 1:            mrltemp = wxT("udp") + demux + wxT("://@");            if ((net_addrs[1]->GetLineText(0).Find (':') != -1)                && (net_addrs[1]->GetLineText(0)[0u] != '['))            {                /* automatically adds '[' and ']' to IPv6 addresses */                mrltemp += wxT("[") + net_addrs[1]->GetLineText(0)                         + wxT("]");            }            else            {                mrltemp += net_addrs[1]->GetLineText(0);            }            if( i_net_ports[1] != config_GetInt( p_intf, "server-port" ) )            {                mrltemp += wxString::Format( wxT(":%d"), i_net_ports[1] );            }            break;        case 2:            /* http access */            if( net_addrs[2]->GetLineText(0).Find(wxT("http://")) )            {                mrltemp = wxT("http") + demux + wxT("://");            }            mrltemp += net_addrs[2]->GetLineText(0);            break;        case 3:            /* RTSP access */            if( net_addrs[3]->GetLineText(0).Find(wxT("rtsp://")) != 0 )            {                mrltemp = wxT("rtsp") + demux + wxT("://");            }            mrltemp += net_addrs[3]->GetLineText(0);            break;        }        break;#ifndef WIN32    case V4L_ACCESS:        mrltemp = ( video_type->GetSelection() == 0 ? wxT("v4l") :                    video_type->GetSelection() == 1 ? wxT("v4l") :                    video_type->GetSelection() == 2 ? wxT("pvr") :                                                      wxT("kfir") )            + demux + wxT(":")            + video_device->GetLineText( 0 );        if( video_type->GetSelection() == 1 )        {            mrltemp += wxString::Format( wxT(":channel=%d"),                                         video_channel->GetValue() );        }        if ( /* v4l_dialog != NULL && */ !v4l_mrl.IsEmpty() )        {            mrltemp += v4l_mrl[0];        }        break;#endif    default:        {            int i_item = i_access_method - MAX_ACCESS;            if( i_item < 0 || i_item >= (int)input_tab_array.GetCount() )                break;            AutoBuiltPanel *input_panel = input_tab_array.Item( i_item );            mrltemp = input_panel->name + wxT("://");            for( int i=0; i < (int)input_panel->config_array.GetCount(); i++ )            {                ConfigControl *control = input_panel->config_array.Item(i);                mrltemp += wxT(" :") + control->GetName() + wxT("=");                switch( control->GetType() )                {                case CONFIG_ITEM_STRING:                case CONFIG_ITEM_FILE:                case CONFIG_ITEM_DIRECTORY:                case CONFIG_ITEM_MODULE:                    mrltemp += wxT("\"") + control->GetPszValue() + wxT("\"");                    break;                case CONFIG_ITEM_INTEGER:                case CONFIG_ITEM_BOOL:                    mrltemp +=                        wxString::Format( wxT("%i"), control->GetIntValue() );                    break;                case CONFIG_ITEM_FLOAT:                    mrltemp +=                        wxString::Format( wxT("%f"), control->GetFloatValue());                    break;                }            }

⌨️ 快捷键说明

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