[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-27 0:19:31
Message-ID: 1261873171.301239.19683.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1066402 by aacid:
keeping the KCompactDisc around is really a bad idea since it keeps a fd open on the cdrom \
drive and makes you unable to open the cd tray and i can tell you my mother was quite unpleased \
she had to reboot the computer each time she wanted to change of CD
M +36 -37 audiocd.cpp
--- trunk/KDE/kdemultimedia/kioslave/audiocd/audiocd.cpp #1066401:1066402
@@ -103,11 +103,10 @@
class AudioCDProtocol::Private {
public:
- Private() : cd(KCompactDisc::Asynchronous) {
+ Private() {
clearURLargs();
s_info = i18n("Information");
s_fullCD = i18n("Full CD");
- discid = 0;
}
void clearURLargs() {
@@ -157,10 +156,8 @@
// Current CD
TOC disc_toc[MAXTRK];
- 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::Result cddbResult;
@@ -218,32 +215,10 @@
return encoderFromExtension(filename.right(len - pos));
}
-struct cdrom_drive * AudioCDProtocol::initRequest(const KUrl & url)
+static void setDeviceToCd(KCompactDisc *cd, struct cdrom_drive *drive)
{
- if (url.hasHost())
- {
- error(KIO::ERR_UNSUPPORTED_ACTION,
- i18n("You cannot specify a host with this protocol. "
- "Please use the audiocd:/ format instead."));
- return 0;
- }
-
- // Load OUR Settings.
- loadSettings();
- // Then url parameters can overrule our settings.
- parseURLArgs(url);
-
- struct cdrom_drive * drive = getDrive();
- if (0 == drive)
- return 0;
-
- // Update our knowledge of the disc
#if defined(HAVE_CDDA_IOCTL_DEVICE)
- if (d->cd.deviceName() != drive->ioctl_device_name || d->tocsAreDifferent(drive))
- {
- d->cd.setDevice(drive->ioctl_device_name, 50, false);
- d->setToc(drive);
- }
+ cd->setDevice(drive->ioctl_device_name, 50, false);
#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
@@ -257,14 +232,14 @@
// user selected value, even if there is none.
//
kWarning(7117) << "Found an ATAPI device, assuming it is the one specified by the user.";
- d->cd.setDevice( d->device );
+ cd->setDevice( d->device );
}
else
{
kDebug(7117) << "Found a SCSI or ATAPICAM device.";
if ( strlen(drive->dev->device_path) > 0 )
{
- d->cd.setDevice( drive->dev->device_path );
+ cd->setDevice( drive->dev->device_path );
}
else
{
@@ -276,7 +251,7 @@
.arg( drive->dev->given_dev_name )
.arg( drive->dev->given_unit_number ) ;
kDebug(7117) << " Using derived name " << devname;
- d->cd.setDevice( devname );
+ cd->setDevice( devname );
}
}
#else
@@ -284,16 +259,40 @@
#warning audiocd ioslave is not going to work for you
#endif
#endif
+}
+struct cdrom_drive * AudioCDProtocol::initRequest(const KUrl & url)
+{
+ if (url.hasHost())
+ {
+ error(KIO::ERR_UNSUPPORTED_ACTION,
+ i18n("You cannot specify a host with this protocol. "
+ "Please use the audiocd:/ format instead."));
+ return 0;
+ }
- if (d->cd.discId() != d->discid && !d->cd.isNoDisc()) {
- 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);
+ // Load OUR Settings.
+ loadSettings();
+ // Then url parameters can overrule our settings.
+ parseURLArgs(url);
+ struct cdrom_drive * drive = getDrive();
+ if (0 == drive)
+ return 0;
+
+ if (d->tocsAreDifferent(drive))
+ {
+ // Update our knowledge of the disc
+ KCompactDisc cd(KCompactDisc::Asynchronous);
+ setDeviceToCd(&cd, drive);
+ d->setToc(drive);
+
+ d->tracks = cd.tracks();
+ for(uint i=0; i< cd.tracks(); i++)
+ d->trackIsAudio[i] = cd.isAudio(i+1);
+
KCDDB::Client c;
- d->cddbResult = c.lookup(d->cd.discSignature());
+ d->cddbResult = c.lookup(cd.discSignature());
if (d->cddbResult == Success)
{
d->cddbList = c.lookupResponse();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic