Removing Ripper dependence on cdio
and therefore no longer exposing cdio through CddaDevice
This commit is contained in:
parent
0895297297
commit
cefe81d0c1
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(); }
|
||||
|
||||
|
|
|
@ -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_;
|
||||
|
|
Loading…
Reference in New Issue