diff --git a/src/devices/cddadevice.cpp b/src/devices/cddadevice.cpp index ced593888..d5e51886c 100644 --- a/src/devices/cddadevice.cpp +++ b/src/devices/cddadevice.cpp @@ -60,8 +60,6 @@ bool CddaDevice::Init() { CddaSongLoader* CddaDevice::loader() { return &cdda_song_loader_; } -CdIo_t* CddaDevice::raw_cdio() { return cdio_; } - bool CddaDevice::IsValid() const { return (cdio_ != nullptr); } void CddaDevice::WatchForDiscChanges(bool watch) { diff --git a/src/devices/cddadevice.h b/src/devices/cddadevice.h index 4a326cbd8..0aaea25b0 100644 --- a/src/devices/cddadevice.h +++ b/src/devices/cddadevice.h @@ -49,8 +49,6 @@ class CddaDevice : public ConnectedDevice { return false; } CddaSongLoader* loader(); - // Access to the raw cdio device handle. - CdIo_t* raw_cdio(); // TODO: not ideal, but Ripper needs this currently // Check whether a valid device handle was opened. bool IsValid() const; void WatchForDiscChanges(bool watch); diff --git a/src/ripper/ripcddialog.cpp b/src/ripper/ripcddialog.cpp index d6ba661c2..48e8d0d67 100644 --- a/src/ripper/ripcddialog.cpp +++ b/src/ripper/ripcddialog.cpp @@ -210,7 +210,7 @@ void RipCDDialog::ClickedRipButton() { ui_->destination->itemData(ui_->destination->currentIndex()).toString()); // create and connect Ripper instance for this task - Ripper* ripper = new Ripper(cdda_device_->raw_cdio(), this); + Ripper* ripper = new Ripper(cdda_device_->song_count(), this); connect(cancel_button_, SIGNAL(clicked()), ripper, SLOT(Cancel())); connect(ripper, &Ripper::Finished, this, diff --git a/src/ripper/ripper.cpp b/src/ripper/ripper.cpp index 2c1151d32..8f0b6d4c7 100644 --- a/src/ripper/ripper.cpp +++ b/src/ripper/ripper.cpp @@ -40,15 +40,15 @@ const char kWavFileTypeFormatChunk[] = "WAVEfmt "; const char kWavDataString[] = "data"; } // namespace -Ripper::Ripper(CdIo_t* cdio, QObject* parent) +Ripper::Ripper(int track_count, QObject* parent) : QObject(parent), - cdio_(cdio), + track_count_(track_count), transcoder_(new Transcoder(this)), cancel_requested_(false), finished_success_(0), finished_failed_(0), files_tagged_(0) { - Q_ASSERT(cdio_); // TODO: error handling + Q_ASSERT(track_count >= 0); transcoder_->set_max_threads(1); // we want transcoder to read only one song // at once from disc to prevent seeking @@ -84,12 +84,7 @@ void Ripper::SetAlbumInformation(const QString& album, const QString& artist, album_.type = type; } -int Ripper::TracksOnDisc() const { - int number_of_tracks = cdio_get_num_tracks(cdio_); - // Return zero tracks if there is an error, e.g. no medium found. - if (number_of_tracks == CDIO_INVALID_TRACK) number_of_tracks = 0; - return number_of_tracks; -} +int Ripper::TracksOnDisc() const { return track_count_; } int Ripper::AddedTracks() const { return tracks_.length(); } diff --git a/src/ripper/ripper.h b/src/ripper/ripper.h index e45bcdee3..e03a1f91b 100644 --- a/src/ripper/ripper.h +++ b/src/ripper/ripper.h @@ -40,7 +40,7 @@ class Ripper : public QObject { Q_OBJECT public: - explicit Ripper(CdIo_t* cdio, QObject* parent = nullptr); + explicit Ripper(int track_count, QObject* parent = nullptr); ~Ripper(); // Adds a track to the rip list if the track number corresponds to a @@ -113,7 +113,7 @@ class Ripper : public QObject { void UpdateProgress(); void TagFiles(); - CdIo_t* cdio_; + int track_count_; Transcoder* transcoder_; bool cancel_requested_; QMutex mutex_;