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

📄 open.cpp

📁 uclinux 下的vlc播放器源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    mrl_combo->SetValue( mrltemp );}/***************************************************************************** * Events methods. *****************************************************************************/void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) ){    mrl = SeparateEntries( mrl_combo->GetValue() );    mrl_combo->Append( mrl_combo->GetValue() );    if( mrl_combo->GetCount() > 10 ) mrl_combo->Delete( 0 );    mrl_combo->SetSelection( mrl_combo->GetCount() - 1 );    if( i_method == OPEN_STREAM )    {        if( IsModal() ) EndModal( wxID_OK );        Hide();        return;    }    /* Update the playlist */    playlist_t *p_playlist =        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                       FIND_ANYWHERE );    if( p_playlist == NULL ) return;    for( int i = 0; i < (int)mrl.GetCount(); i++ )    {        vlc_bool_t b_start = !i && i_open_arg;        playlist_item_t *p_item;        char *psz_utf8;        psz_utf8 = wxFromLocale( mrl[i] );        p_item = playlist_ItemNew( p_intf, psz_utf8, psz_utf8 );        wxLocaleFree( psz_utf8 );        /* Insert options */        while( i + 1 < (int)mrl.GetCount() &&               ((const char *)mrl[i + 1].mb_str(wxConvUTF8))[0] == ':' )        {            psz_utf8 = wxFromLocale( mrl[i + 1] );            playlist_ItemAddOption( p_item, psz_utf8 );            wxLocaleFree( psz_utf8 );            i++;        }        /* Get the options from the subtitles dialog */        if( subsfile_checkbox->IsChecked() && subsfile_mrl.GetCount() )        {            for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )            {                psz_utf8 = wxFromLocale( subsfile_mrl[j] );                playlist_ItemAddOption( p_item, psz_utf8 );                wxLocaleFree( psz_utf8 );            }        }        /* Get the options from the stream output dialog */        if( sout_checkbox->IsChecked() && sout_mrl.GetCount() )        {            for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )            {                psz_utf8 = wxFromLocale( sout_mrl[j] );                playlist_ItemAddOption( p_item, psz_utf8 );                wxLocaleFree( psz_utf8 );            }        }        if( b_start )        {            playlist_AddItem( p_playlist, p_item,                              PLAYLIST_APPEND,                              PLAYLIST_END );            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );        }        else        {            playlist_AddItem( p_playlist, p_item,                              PLAYLIST_APPEND|PLAYLIST_PREPARSE,                              PLAYLIST_END );        }    }    vlc_object_release( p_playlist );    Hide();    if( IsModal() ) EndModal( wxID_OK );}void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) ){    wxCloseEvent cevent;    OnClose(cevent);}void OpenDialog::OnClose( wxCloseEvent& WXUNUSED(event) ){    Hide();    if( IsModal() ) EndModal( wxID_CANCEL );}void OpenDialog::OnPageChange( wxNotebookEvent& event ){    UpdateMRL( event.GetSelection() );}void OpenDialog::OnMRLChange( wxCommandEvent& event ){    //mrl = SeparateEntries( event.GetString() );}/***************************************************************************** * File panel event methods. *****************************************************************************/void OpenDialog::OnFilePanelChange( wxCommandEvent& WXUNUSED(event) ){    UpdateMRL( FILE_ACCESS );}void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ){    if( file_dialog == NULL )        file_dialog = new wxFileDialog( this, wxU(_("Open File")),            wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );    file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST        "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));    if( file_dialog && file_dialog->ShowModal() == wxID_OK )    {        wxArrayString paths;        wxString path;        file_dialog->GetPaths( paths );        for( size_t i = 0; i < paths.GetCount(); i++ )        {            if( paths[i].Find( wxT(' ') ) >= 0 )                path += wxT("\"") + paths[i] + wxT("\" ");            else                path += paths[i] + wxT(" ");        }        file_combo->SetValue( path );        file_combo->Append( path );        if( file_combo->GetCount() > 10 ) file_combo->Delete( 0 );        UpdateMRL( FILE_ACCESS );    }}void OpenDialog::OnSubFileBrowse( wxCommandEvent& WXUNUSED(event) ){    wxFileDialog dialog( this, wxU(_("Open subtitles file")),                         wxT(""), wxT(""), wxT("*"), wxOPEN );    if( dialog.ShowModal() == wxID_OK )    {        subfile_combo->SetValue( dialog.GetPath() );    }    wxCommandEvent event; OnSubFileChange( event );}void OpenDialog::OnSubFileChange( wxCommandEvent& WXUNUSED(event) ){    if( subsfile_mrl.GetCount() != 0 )    {        subsfile_mrl.RemoveAt( 0 );        subsfile_mrl.Insert( wxString(wxT("sub-file=")) + subfile_combo->GetValue() , 0 );    }    else    {        subsfile_mrl.Add( wxString(wxT("sub-file=")) + subfile_combo->GetValue() );    }}/***************************************************************************** * Disc panel event methods. *****************************************************************************/void OpenDialog::OnDiscPanelChangeSpin( wxSpinEvent& event ){    wxCommandEvent cevent;    cevent.SetId(event.GetId());    cevent.SetInt(event.GetPosition());    OnDiscPanelChange(cevent);}void OpenDialog::OnDiscPanelChange( wxCommandEvent& event ){    if( event.GetId() == DiscTitle_Event ) i_disc_title = event.GetInt();    if( event.GetId() == DiscChapter_Event ) i_disc_chapter = event.GetInt();    if( event.GetId() == DiscSub_Event ) i_disc_sub = event.GetInt();    if( event.GetId() == DiscAudio_Event ) i_disc_audio = event.GetInt();    UpdateMRL( DISC_ACCESS );}void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event ){    char *psz_device;    switch( disc_type->GetSelection() )    {        case 3:            psz_device = config_GetPsz( p_intf, "cd-audio" );            break;        case 2:            psz_device = config_GetPsz( p_intf, "vcd" );            break;        default:            psz_device = config_GetPsz( p_intf, "dvd" );            break;    }    if ( !psz_device ) psz_device = "";    if( disc_device->GetValue().Cmp( wxL2U( psz_device ) ) )    {        b_disc_device_changed = true;    }    UpdateMRL( DISC_ACCESS );}#ifdef HAVE_LIBCDIO/* Return true if *psz_drive is a drive with a DVD in it. A more complete   check would see if the media looks like a *playable* DVD. This should   go into libcdio. */static bool IsDVD(const char *psz_drive){  CdIo_t *p_cdio = cdio_open (psz_drive, DRIVER_UNKNOWN);  if (p_cdio)  {      discmode_t discmode = cdio_get_discmode(p_cdio);      cdio_destroy(p_cdio);      return cdio_is_discmode_dvd(discmode);  }  return false;}/* Return a device that has a DVD in it. The caller needs to free   the returned string.*/static char * ProbeDVD(const wxChar *device){        /*  char **ppsz_cd_drives;  const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(device);  char *psz_device = (char *) tmp_buf;  if( IsDVD(psz_device) )  {      return strdup(psz_device);  }  ppsz_cd_drives = cdio_get_devices(DRIVER_DEVICE);  if( ppsz_cd_drives )  {      char **c;      for( c = ppsz_cd_drives; *c != NULL; c++ )      {      if( IsDVD(*c) )      {          char *psz_drive = strdup(*c);          cdio_free_device_list(ppsz_cd_drives);          return strdup(psz_drive);          }      }      cdio_free_device_list(ppsz_cd_drives);  }*/  return NULL;}static char * ProbeDevice(char **ppsz_search_devices, cdio_fs_anal_t mask,              bool b_any){    char **ppsz_devices;    if( ppsz_search_devices && !ppsz_search_devices[0] )        ppsz_search_devices = NULL;    /* Start out trying the device that has been entered so far. */    ppsz_devices = cdio_get_devices_with_cap(ppsz_search_devices, mask,                         b_any);    if (ppsz_devices && *ppsz_devices)    {        char *psz_device = strdup(*ppsz_devices);        cdio_free_device_list(ppsz_devices);        return psz_device;    }    /* If there was no device specified on the first try, then give up       now. Otherwise accept any CD-ROM in the class (e.g. VCD or DVD).    */    if( !ppsz_search_devices ) return NULL;    ppsz_devices = cdio_get_devices_with_cap(NULL, mask, true);    if (ppsz_devices && *ppsz_devices)    {        char *psz_device = strdup(*ppsz_devices);        cdio_free_device_list(ppsz_devices);        return psz_device;    }    return NULL;}/* Return a device that has a CD-DA in it. The caller needs to free   the returned string.*/static char * ProbeCDDA(const wxChar *device){        /*   char *ppsz_device[2];   const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(device);   char *psz_device = (char *) tmp_buf;   ppsz_device[0] = (device && *device) ? psz_device : NULL;   ppsz_device[1] = NULL;   return ProbeDevice(ppsz_device, CDIO_FS_AUDIO, false);   */ return NULL;}/* Return a device that has a VCD in it. The caller needs to free   the returned string.*/static char * ProbeVCD(const wxChar *device){/*   char *ppsz_device[2];   const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(device);   char *psz_device = (char *) tmp_buf;   ppsz_device[0] = (device && *device) ? psz_device : NULL;   ppsz_device[1] = NULL;   return ProbeDevice(ppsz_device,                      (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD                       |CDIO_FS_UNKNOWN), true);                       */ return NULL;}/*   Probe (find anywhere) a CD-DA, VCD, or a DVD.   First try the device name that may have been entered for the "disc type"   selected. If that doesn't work we try any device for the disc type.   If that doesn't work, try looking for CD-ROMs or DVD drives. the   disc type, device name and paramter ranges are set to whatever we find.*/void OpenDialog::OnDiscProbe( wxCommandEvent& WXUNUSED(event) ){    wxCommandEvent dummy_event;    char *psz_device = NULL;    bool b_probed_DVD = false;    bool b_probed_VCD = false;    const int i_selection = disc_type->GetSelection();    /* Reduce verbosity of cdio errors. */    cdio_loglevel_default = CDIO_LOG_ERROR; retry:    switch( disc_type->GetSelection() )    {    case SELECTION_DISC_TYPE_DVD_MENUS:    case SELECTION_DISC_TYPE_DVD:

⌨️ 快捷键说明

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