1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 12:02:48 +01:00

Don't constantly refresh the cd device if it doesn't support checking for media changes.

Filter out irrelevant devices on OS X.
This commit is contained in:
John Maguire 2011-08-09 21:30:28 +02:00
parent 83a21f0576
commit 6d9bc9d3f4
2 changed files with 11 additions and 3 deletions

View File

@ -119,7 +119,7 @@ void CddaDevice::Init() {
musicbrainz_client->StartDiscIdRequest(musicbrainz_discid);
g_free(string_mb);
}
// Clean all the Gstreamer objects we have used: we don't need them anymore
gst_element_set_state (pipe, GST_STATE_NULL);
gst_object_unref(GST_OBJECT(pipe));
@ -154,8 +154,8 @@ void CddaDevice::AudioCDTagsLoaded(const QString& artist, const QString& album,
}
void CddaDevice::Refresh() {
if ((cdio_ && cdda_) && /* already init... */
!cdio_get_media_changed(cdio_) /* ...and hasn't change since last time */) {
if ((cdio_ && cdda_) && /* already init... */
cdio_get_media_changed(cdio_) != 1 /* ...and hasn't change since last time */) {
return;
}
// Check if mutex is already token (i.e. init is already taking place)

View File

@ -106,7 +106,15 @@ void CddaLister::Init() {
for (; *devices != NULL; ++devices) {
if (strcmp("/dev/cdrom", *devices) == 0)
continue;
QString device(*devices);
#ifdef Q_OS_DARWIN
// Every track is detected as a separate device on Darwin. The raw disk looks
// like /dev/rdisk1
if (!device.contains(QRegExp("^/dev/rdisk[0-9]$"))) {
continue;
}
#endif
devices_list_ << device;
emit DeviceAdded(device);
}