📄 open.cpp
字号:
/* If not a DVD then try for a VCD. If VCD fails it will try for a CD-DA. */ if (!psz_device) psz_device = ProbeDVD(disc_device->GetValue()); if (!psz_device) { b_probed_DVD = true; disc_type->SetSelection(SELECTION_DISC_TYPE_VCD); OnDiscTypeChange( dummy_event ); goto retry; } disc_device->SetValue( wxL2U(psz_device) ); break; case SELECTION_DISC_TYPE_VCD: /* VCD probe of some sort */ if(!psz_device) psz_device = ProbeVCD(disc_device->GetValue()); if( psz_device ) {#ifdef HAVE_VCDX#if LIBVCD_VERSION_NUM > 23 vcdinfo_obj_t *p_vcdinfo; /* Set LID or entry range accurately if possible. */ if( vcdinfo_open(&p_vcdinfo, &psz_device, DRIVER_DEVICE, NULL) == VCDINFO_OPEN_VCD) { if (config_GetInt( p_intf, "vcdx-PBC" )) { /* Set largest LID. */; disc_title->SetRange( 0, vcdinfo_get_num_LIDs(p_vcdinfo) ); } else { /* Set largest Entry */ disc_title->SetRange( 0, vcdinfo_get_num_entries(p_vcdinfo)-1 ); } vcdinfo_close(p_vcdinfo); }#endif /* LIBVCD_VERSION_NUM > 23 */ disc_device->SetValue( wxL2U(psz_device) );#else CdIo_t *p_cdio = cdio_open (psz_device, DRIVER_UNKNOWN); disc_device->SetValue( wxL2U(psz_device) ); /* Set track range accurately if possible. */ if (p_cdio) { track_t i_last_track = cdio_get_last_track_num(p_cdio); disc_title->SetRange( 0, i_last_track-1 ); } cdio_destroy(p_cdio);#endif break; } b_probed_VCD = true; /* Not a VCD. Try for a DVD unless we've been there before. */ if( !b_probed_DVD && (psz_device = ProbeDVD(disc_device->GetValue())) ) { disc_type->SetSelection(SELECTION_DISC_TYPE_DVD_MENUS); OnDiscTypeChange( dummy_event ); goto retry; } b_probed_DVD = true; /* Couldn't find a VCD or DVD. See if we can find a CD-DA. */ psz_device = ProbeCDDA(disc_device->GetValue()); if( psz_device ) { disc_type->SetSelection(SELECTION_DISC_TYPE_CDDA); OnDiscTypeChange( dummy_event ); goto retry; } /* Couldn't find a VCD, DVD or CD-DA. Null out the Device name and set to original selection. */ disc_device->SetValue( wxL2U("") ); disc_type->SetSelection(i_selection); OnDiscTypeChange( dummy_event ); break; case SELECTION_DISC_TYPE_CDDA: if(!psz_device) psz_device = ProbeCDDA(disc_device->GetValue()); if( psz_device ) { CdIo_t *p_cdio = cdio_open (psz_device, DRIVER_UNKNOWN); disc_device->SetValue( wxL2U(psz_device) ); if (p_cdio) { track_t i_last_track = cdio_get_last_track_num(p_cdio); disc_title->SetRange( 0, i_last_track );#if 0 MediaInsertCDDA( p_intf, p_cdio, i_last_track );#endif } cdio_destroy(p_cdio); break; } /* Not a CD-DA. Try for a DVD unless we've been there before. */ if( !b_probed_DVD && (psz_device = ProbeDVD(disc_device->GetValue())) ) { disc_type->SetSelection(SELECTION_DISC_TYPE_DVD_MENUS); OnDiscTypeChange( dummy_event ); goto retry; } /* Couldn't find a CD-DA or DVD. See if we can find a VCD, unless we've tried that before. */ if (!b_probed_VCD) psz_device = ProbeVCD(disc_device->GetValue()); if( psz_device ) { disc_type->SetSelection(SELECTION_DISC_TYPE_VCD); OnDiscTypeChange( dummy_event ); goto retry; } disc_device->SetValue( wxL2U("") ); break; default: msg_Err( p_intf, "invalid Disc type selection (%d)", disc_type->GetSelection() ); break; } free(psz_device); disc_probe->SetValue(FALSE); UpdateMRL( DISC_ACCESS );}#endif /* HAVE_LIBCDIO */void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) ){ char *psz_device = NULL; switch( disc_type->GetSelection() ) { case SELECTION_DISC_TYPE_DVD_MENUS: case SELECTION_DISC_TYPE_DVD: disc_sub->Enable(); disc_sub_label->Enable(); disc_audio->Enable(); disc_audio_label->Enable(); disc_chapter->Enable(); disc_chapter_label->Enable(); disc_title_label->SetLabel ( wxU(_("Title")) ); psz_device = config_GetPsz( p_intf, "dvd" ); if( !b_disc_device_changed ) { if( psz_device ) disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") ); } disc_title->SetRange( 0, 255 ); disc_sub->SetRange( -1, 31 ); // up to 32 subtitles -1: no subtitle disc_audio->SetRange( 0, 7 ); // up to 8 audio channels disc_chapter->SetRange( 0, 255 ); disc_title->SetToolTip( wxU(_("Title number.")) ); disc_sub->SetToolTip( wxU(_( "DVD's can have up to 32 subtitles numbered 0..31. " "Note this is not the same thing as a subtitle name (e.g. 'en'). " "If a value -1 is used, no subtitle will be shown." )) ); disc_audio->SetToolTip( wxU(_("Audio track number. " "DVD's can have up to 8 audio tracks numbered 0..7." )) ); break; case SELECTION_DISC_TYPE_VCD: disc_sub->Enable(); disc_sub_label->Enable(); disc_audio->Enable(); disc_audio_label->Enable(); disc_chapter->Disable(); disc_chapter_label->Disable(); psz_device = config_GetPsz( p_intf, "vcd" ); if( !b_disc_device_changed ) { if( psz_device ) disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") ); }#ifdef HAVE_VCDX if (config_GetInt( p_intf, "vcdx-PBC" )) { disc_title_label->SetLabel ( wxT("Playback LID") ); disc_title->SetToolTip( wxU(_( "Playback control (PBC) usually starts with number 1." )) ); } else { disc_title_label->SetLabel ( wxT("Entry") ); disc_title->SetToolTip( wxU(_( "The first entry (the beginning of the first MPEG track) is 0." )) ); }#else disc_title_label->SetLabel ( wxU(_("Track")) ); disc_title->SetToolTip( wxU(_("Track number.")) );#endif disc_title->SetRange( 0, 99 ); // only 100 tracks allowed on VCDs disc_sub->SetRange( -1, 3 ); // up to 4 subtitles -1 = no subtitle disc_audio->SetRange( 0, 1 ); // up to 2 audio tracks disc_sub->SetToolTip( wxU(_( "SVCD's can have up to 4 subtitles numbered 0..3. " "If a value -1 is used, no subtitle will be shown." )) ); disc_audio->SetToolTip( wxU(_("Audio track number. " "VCD's can have up to 2 audio tracks numbered 0 or 1. " )) ); break; case SELECTION_DISC_TYPE_CDDA: disc_sub->Disable(); disc_sub_label->Disable(); disc_chapter->Disable(); disc_chapter_label->Disable(); disc_audio->Disable(); disc_audio_label->Disable(); disc_title_label->SetLabel ( wxU(_("Track")) );#ifdef HAVE_CDDAX disc_title->SetToolTip( wxU(_( "Audio CDs can have up to 100 tracks, the first track is usually 1. " "If 0 is given, then all tracks are played.")) );#else disc_title->SetToolTip( wxU(_( "Audio CDs can have up to 100 tracks, the first track is usually 1." )) );#endif psz_device = config_GetPsz( p_intf, "cd-audio" ); if( !b_disc_device_changed ) { if( psz_device ) disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") ); } /* There are at most 100 tracks in a CD-DA */ disc_title->SetRange( 0, 100 ); break; default: msg_Err( p_intf, "invalid Disc type selection (%d)", disc_type->GetSelection() ); break; } disc_title->SetValue( 0 ); i_disc_title = 0; disc_chapter->SetValue( 0 ); i_disc_chapter = 0; if( psz_device ) free( psz_device ); UpdateMRL( DISC_ACCESS );}/***************************************************************************** * Net panel event methods. *****************************************************************************/void OpenDialog::OnNetPanelChangeSpin( wxSpinEvent& event ){ wxCommandEvent cevent; cevent.SetId(event.GetId()); cevent.SetInt(event.GetPosition()); OnNetPanelChange(cevent);}void OpenDialog::OnNetPanelChange( wxCommandEvent& event ){ if( event.GetId() >= NetPort1_Event && event.GetId() <= NetPort3_Event ) { i_net_ports[event.GetId() - NetPort1_Event] = event.GetInt(); } UpdateMRL( NET_ACCESS );}void OpenDialog::OnNetTypeChange( wxCommandEvent& event ){ int i; i_net_type = event.GetId() - NetRadio1_Event; for(i=0; i<4; i++) { net_radios[i]->SetValue( event.GetId() == (NetRadio1_Event+i) ); net_subpanels[i]->Enable( event.GetId() == (NetRadio1_Event+i) ); } /* UDP Unicast or multicast -> timeshift */ if( i_net_type == 0 || i_net_type == 1 ) net_timeshift->Enable(); else net_timeshift->Disable(); UpdateMRL( NET_ACCESS );}/***************************************************************************** * Subtitles file event methods. *****************************************************************************/void OpenDialog::OnSubsFileEnable( wxCommandEvent& event ){ subsfile_button->Enable( event.GetInt() != 0 ); subbrowse_button->Enable( event.GetInt() != 0 ); subfile_combo->Enable( event.GetInt() != 0 );}void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( subsfile_dialog == NULL ) subsfile_dialog = new SubsFileDialog( p_intf, this ); if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK ) { subsfile_mrl.Empty(); subsfile_mrl.Add( wxString(wxT("sub-file=")) + subfile_combo->GetValue() ); if( subsfile_dialog->encoding_combo ) { subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) + subsfile_dialog->encoding_combo->GetValue() ); } if( subsfile_dialog->align_combo ) { subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"), (int)subsfile_dialog->align_combo->GetClientData( subsfile_dialog->align_combo->GetSelection()) ) ); } if( subsfile_dialog->size_combo ) { subsfile_mrl.Add( wxString::Format( wxT("freetype-rel-fontsize=%i"), (int)subsfile_dialog->size_combo->GetClientData( subsfile_dialog->size_combo->GetSelection()) ) ); } subsfile_mrl.Add( wxString( wxT("sub-fps="))+ subsfile_dialog->fps_ctrl->GetValue() ); subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"), subsfile_dialog->delay_spinctrl->GetValue() ) ); }}/***************************************************************************** * Stream output event methods. *****************************************************************************/void OpenDialog::OnSoutEnable( wxCommandEvent& event ){ sout_button->Enable( event.GetInt() != 0 );}void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( sout_dialog == NULL ) sout_dialog = new SoutDialog( p_intf, this ); if( sout_dialog && sout_dialog->ShowModal() == wxID_OK ) { sout_mrl = sout_dialog->GetOptions(); }}/***************************************************************************** * Caching event methods. *****************************************************************************/void OpenDialog::OnCachingEnable( wxCommandEvent& event ){ caching_value->Enable( event.GetInt() != 0 ); i_caching = caching_value->GetValue(); UpdateMRL();}void OpenDialog::OnCachingChangeSpin( wxSpinEvent& event ){ wxCommandEvent cevent; OnCachingChange(cevent);}void OpenDialog::OnCachingChange( wxCommandEvent& event ){ i_caching = event.GetInt(); UpdateMRL();}/***************************************************************************** * Utility functions. *************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -