[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdemultimedia/kioslave/audiocd
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2009-12-26 23:26:21
Message-ID: 1261869981.960741.19399.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1066390 by aacid:

If TOCs are different we need to call setDevice again so the disc info is refreshed
More or less fixes bug 188284, now you can refresh the disc info by pressing the Reload/F5 \
action Though if you go to the url bar and enter audiocd:/ again it is not refreshed since the \
                ioslave is not called, probably hitting some cache somewhere, will see if we \
                can fix this too
BUGS: 188284


 M  +27 -1     audiocd.cpp  


--- trunk/KDE/kdemultimedia/kioslave/audiocd/audiocd.cpp #1066389:1066390
@@ -116,6 +116,28 @@
 		req_track = -1;
 		cddbUserChoice = -1;
 	}
+	
+	bool tocsAreDifferent(struct cdrom_drive *drive)
+	{
+		if (tracks != (uint)drive->tracks) return true;
+		for (int i = 0; i < drive->tracks; ++i)
+		{
+			if (disc_toc[i].dwStartSector != drive->disc_toc[i].dwStartSector || 
+			    disc_toc[i].bFlags != drive->disc_toc[i].bFlags ||
+			    disc_toc[i].bTrack != drive->disc_toc[i].bTrack) return true;
+		}
+		return false;
+	}
+	
+	void setToc(struct cdrom_drive *drive)
+	{
+		for (int i = 0; i < drive->tracks; ++i)
+		{
+			disc_toc[i].dwStartSector = drive->disc_toc[i].dwStartSector;
+			disc_toc[i].bFlags = drive->disc_toc[i].bFlags;
+			disc_toc[i].bTrack = drive->disc_toc[i].bTrack;
+		}
+	}
 
 	// The type/which of request
 	bool req_allTracks;
@@ -134,6 +156,7 @@
 	QString s_fullCD;
 
 	// Current CD
+	TOC disc_toc[MAXTRK];
 	unsigned discid;
 	unsigned tracks;
 	bool trackIsAudio[100];
@@ -216,8 +239,11 @@
 
 	// Update our knowledge of the disc
 #if defined(HAVE_CDDA_IOCTL_DEVICE)
-	if (d->cd.deviceName() != drive->ioctl_device_name)
+	if (d->cd.deviceName() != drive->ioctl_device_name || d->tocsAreDifferent(drive))
+	{
 		d->cd.setDevice(drive->ioctl_device_name, 50, false);
+		d->setToc(drive);
+	}
 #elif defined(__FreeBSD__) || defined(__DragonFly__)
 	// FreeBSD's cdparanoia as of january 5th 2006 has rather broken
 	// support for non-SCSI devices. Although it finds ATA cdroms just


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic