[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdemultimedia/kioslave/audiocd
From: David Faure <faure () kde ! org>
Date: 2006-01-04 13:31:13
Message-ID: 1136381473.478581.3349.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 494266 by dfaure:
Forwardports:
- Keep the KCompactDisc instance around so that we don't have to read the cd id and \
look it up on cddb for every stat() call. This makes copy/paste of 10 mp3 files much \
faster.
- FreeBSD fix by Ade
- avoid out-of-bounds when there's no CDDB info
M +14 -13 audiocd.cpp
--- trunk/KDE/kdemultimedia/kioslave/audiocd/audiocd.cpp #494265:494266
@@ -103,14 +103,13 @@
class AudioCDProtocol::Private {
public:
- Private() {
+ Private() : cd(KCompactDisc::Asynchronous) {
clearURLargs();
s_info = i18n("Information");
s_fullCD = i18n("Full CD");
}
void clearURLargs() {
- discid = 0;
req_allTracks = false;
which_dir = Unknown;
req_track = -1;
@@ -137,6 +136,7 @@
unsigned discid;
unsigned tracks;
bool trackIsAudio[100];
+ KCompactDisc cd; // keep it around so that we don't assume the disk changed between \
every stat()
// CDDB items
KCDDB::CDDB::Result cddbResult;
@@ -214,19 +214,23 @@
return 0;
// Update our knowledge of the disc
- KCompactDisc cd(KCompactDisc::Asynchronous);
// TODO which one is right?
// qDebug("\"%s\" \"%s\"", drive->cdda_device_name, drive->ioctl_device_name);
- cd.setDevice(drive->cdda_device_name, 50, false);
+#if defined( Q_OS_LINUX )
+ d->cd.setDevice(drive->cdda_device_name, 50, false);
+#elif defined( Q_OS_FREEBSD )
+ d->cd.setDevice(drive->dev->device_path);
+#endif
+
- if (cd.discId() != d->discid && cd.discId() != cd.missingDisc){
- d->discid = cd.discId();
- d->tracks = cd.tracks();
- for(uint i=0; i< cd.tracks(); i++)
- d->trackIsAudio[i] = cd.isAudio(i+1);
+ if (d->cd.discId() != d->discid && d->cd.discId() != d->cd.missingDisc){
+ d->discid = d->cd.discId();
+ d->tracks = d->cd.tracks();
+ for(uint i=0; i< d->cd.tracks(); i++)
+ d->trackIsAudio[i] = d->cd.isAudio(i+1);
KCDDB::Client c;
- d->cddbResult = c.lookup(cd.discSignature());
+ d->cddbResult = c.lookup(d->cd.discSignature());
d->cddbList = c.lookupResponse();
d->cddbBestChoice = d->cddbList.first();
generateTemplateTitles();
@@ -422,9 +426,6 @@
}
encoder->fillSongInfo(info, track, "");
}
- else {
- encoder->fillSongInfo(info, d->req_track+1, \
QString("CDDBDISCID=%1").arg(d->cddbBestChoice.get("discid").toString()));
- }
long totalByteCount = CD_FRAMESIZE_RAW * (lastSector - firstSector + 1);
long time_secs = (8 * totalByteCount) / (44100 * 2 * 16);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic