diff --git a/configure.ac b/configure.ac index 0037351f6c85546bacdbcc17a2276cf2795e08b1..36615d31c2986fe67e7d785553f4ec6ffbe47c9d 100644 --- a/configure.ac +++ b/configure.ac @@ -3645,8 +3645,16 @@ then if test "${ac_cv_cxx_fpermissive}" = "yes"; then VLC_ADD_CXXFLAGS([wxwindows],-fpermissive) fi - VLC_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags`]) - VLC_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`]) + PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.71, + [ + AC_DEFINE(HAVE_LIBCDIO, [], [Define for the CD-DA plugin using libcdio]) + VLC_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags` $LIBCDIO_CFLAGS]) + VLC_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`] $LIBCDIO_LIBS)], + [AC_MSG_WARN(libcdio library not found - Probe disc disabled) + VLC_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags`]) + VLC_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`]) + HAVE_LIBCDIO=no]) + # now look for the wxprec.h header CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}" ac_cv_wx_headers=yes diff --git a/modules/access/cdda/info.c b/modules/access/cdda/info.c index 697edb9de12be899e7170df4ab5136efd511eebd..9d6138a660d9dd3e5d9b4ce0202a55528d101ad5 100644 --- a/modules/access/cdda/info.c +++ b/modules/access/cdda/info.c @@ -116,13 +116,14 @@ GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda ) { track_t i_track = p_cdda->i_first_track + i; cddb_track_t *t = cddb_track_new(); - t->frame_offset = cdio_get_track_lba(p_cdio, i_track); + cddb_track_set_frame_offset(t, + cdio_get_track_lba(p_cdio, i_track)); cddb_disc_add_track(p_cdda->cddb.disc, t); } - p_cdda->cddb.disc->length = - cdio_get_track_lba(p_cdio, CDIO_CDROM_LEADOUT_TRACK) - / CDIO_CD_FRAMES_PER_SEC; + cddb_disc_set_length(p_cdda->cddb.disc, + cdio_get_track_lba(p_cdio, CDIO_CDROM_LEADOUT_TRACK) + / CDIO_CD_FRAMES_PER_SEC); if (!cddb_disc_calc_discid(p_cdda->cddb.disc)) { diff --git a/modules/gui/wxwindows/open.cpp b/modules/gui/wxwindows/open.cpp index 306a698150186a2c5a687dc14c21a782dcc82a30..887293df8aff8c43ae643375288d4d3dc05634a5 100644 --- a/modules/gui/wxwindows/open.cpp +++ b/modules/gui/wxwindows/open.cpp @@ -30,6 +30,10 @@ #include <stdio.h> #include <vlc/vlc.h> +#ifdef HAVE_LIBCDIO +#include <cdio/cdio.h> +#include <cdio/cd_types.h> +#endif /* HAVE_LIBCDIO */ #include <wx/combobox.h> #include <wx/statline.h> @@ -60,6 +64,9 @@ enum FileName_Event, DiscType_Event, +#ifdef HAVE_LIBCDIO + DiscProbe_Event, +#endif DiscDevice_Event, DiscTitle_Event, DiscChapter_Event, @@ -99,6 +106,9 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog) /* Events generated by the disc panel */ EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange) +#ifdef HAVE_LIBCDIO + EVT_CHECKBOX(DiscProbe_Event, OpenDialog::OnDiscProbe) +#endif EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscDeviceChange) EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscPanelChange) EVT_TEXT(DiscTitle_Event, OpenDialog::OnDiscPanelChange) @@ -653,7 +663,13 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent ) WXSIZEOF(disc_type_array), disc_type_array, WXSIZEOF(disc_type_array), wxRA_SPECIFY_COLS ); +#ifdef HAVE_LIBCDIO + disc_probe = new wxCheckBox( panel, DiscProbe_Event, + wxU(_("Probe Disc")) ); +#endif + sizer_row->Add( disc_type, i_disc_type_selection, wxEXPAND | wxALL, 5 ); + sizer_row->Add( disc_probe, 0, wxEXPAND | wxALL ); wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Device name")) ); disc_device = new wxTextCtrl( panel, DiscDevice_Event, wxT(""), @@ -1225,6 +1241,221 @@ void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event ) UpdateMRL( DISC_ACCESS ); } +#ifdef HAVE_LIBCDIO + +/* Return a device that has a DVD in it. The caller needs to free + the returned string. +*/ +static char * ProbeDVD() +{ + char **ppsz_cd_drives = cdio_get_devices(DRIVER_DEVICE); + if (ppsz_cd_drives) + { + char **c; + for( c = ppsz_cd_drives; *c != NULL; c++ ) + { + CdIo_t *p_cdio = cdio_open (*c, DRIVER_UNKNOWN); + if (p_cdio) + { + discmode_t discmode = cdio_get_discmode(p_cdio); + cdio_destroy(p_cdio); + if( cdio_is_discmode_dvd(discmode) ) + { + 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 **search_devices, cdio_fs_anal_t mask, + bool b_any) +{ + char **ppsz_devices; + + /* Start out trying the device that has been entered so far. */ + ppsz_devices = cdio_get_devices_with_cap(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 (!search_devices[0]) return NULL; + + ppsz_devices = cdio_get_devices_with_cap(NULL, mask, b_any); + + 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 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); +} + + +/* + Probe (find anywhere) a CD-DA, VCD, or a DVD. + First we try the device name that may have been entered for the media class + selected. If that doesn't work we try any device for the media class. + If that doesn't work the try looking for CD-ROMs or DVD drives and set the + media selection 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; + + retry: + switch( disc_type->GetSelection() ) + { + + case 0: /* DVD with menus */ + case 1: /* DVD without menus */ + /* 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(); + if (!psz_device) + { + b_probed_DVD = true; + disc_type->SetSelection(2); + OnDiscTypeChange( dummy_event ); + goto retry; + } + disc_device->SetValue( wxL2U(psz_device) ); + free(psz_device); + break; + + case 2: /* VCD probe of some sort */ + if(!psz_device) psz_device = ProbeVCD(disc_device->GetValue()); + if( psz_device ) + { + 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 ); + } + free(psz_device); + cdio_destroy(p_cdio); + 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_type->SetSelection(0); + 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(3); + OnDiscTypeChange( dummy_event ); + goto retry; + } + break; + + case 3: /* CD-DA Probe */ + 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 ); + } + free(psz_device); + 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_type->SetSelection(0); + 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(2); + OnDiscTypeChange( dummy_event ); + goto retry; + } + break; + + default: + msg_Err( p_intf, "invalid Disc type selection (%d)", + disc_type->GetSelection() ); + break; + } + + disc_probe->SetValue(FALSE); + + UpdateMRL( DISC_ACCESS ); +} +#endif /* HAVE_LIBCDIO */ + void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) ) { char *psz_device = NULL; diff --git a/modules/gui/wxwindows/wxwindows.h b/modules/gui/wxwindows/wxwindows.h index b3b94ce88b3c767c374db0554ef1951bbc30a25d..5936b3ddf36c445b8132ac8fa0a590675af129ae 100644 --- a/modules/gui/wxwindows/wxwindows.h +++ b/modules/gui/wxwindows/wxwindows.h @@ -480,6 +480,9 @@ private: void OnDiscPanelChangeSpin( wxSpinEvent& event ); void OnDiscPanelChange( wxCommandEvent& event ); void OnDiscTypeChange( wxCommandEvent& event ); +#ifdef HAVE_LIBCDIO + void OnDiscProbe( wxCommandEvent& event ); +#endif void OnDiscDeviceChange( wxCommandEvent& event ); /* Event handlers for the net page */ @@ -519,6 +522,7 @@ private: /* Controls for the disc panel */ wxRadioBox *disc_type; + wxCheckBox *disc_probe; wxTextCtrl *disc_device; wxSpinCtrl *disc_title; int i_disc_title; wxSpinCtrl *disc_chapter; int i_disc_chapter; diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 8ea5b725354fc525ab60ebac54d712ac554e6b7c..ada8bb4ffa3580e35d9d069bb518796b333a3b37 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -32,7 +32,7 @@ mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ -MSGMERGE = @MSGMERGE@ +MSGMERGE = msgmerge MSGMERGE_UPDATE = @MSGMERGE@ --update MSGINIT = msginit MSGCONV = msgconv