aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/audiocd/linux/linux-audiocd.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/backends/audiocd/linux/linux-audiocd.cpp b/backends/audiocd/linux/linux-audiocd.cpp
index 917546cfa5..fe3ae1e58b 100644
--- a/backends/audiocd/linux/linux-audiocd.cpp
+++ b/backends/audiocd/linux/linux-audiocd.cpp
@@ -256,6 +256,9 @@ public:
void closeCD();
void playCD(int track, int numLoops, int startFrame, int duration);
+protected:
+ bool openCD(const Common::String &drive);
+
private:
struct Device {
Device(const Common::String &n, dev_t d) : name(n), device(d) {}
@@ -320,6 +323,23 @@ bool LinuxAudioCDManager::openCD(int drive) {
return true;
}
+bool LinuxAudioCDManager::openCD(const Common::String &drive) {
+ DeviceList devices;
+ if (!tryAddDrive(devices, drive) && !tryAddPath(devices, drive))
+ return false;
+
+ _fd = open(devices[0].name.c_str(), O_RDONLY | O_NONBLOCK, 0);
+ if (_fd < 0)
+ return false;
+
+ if (!loadTOC()) {
+ closeCD();
+ return false;
+ }
+
+ return true;
+}
+
void LinuxAudioCDManager::closeCD() {
if (_fd < 0)
return;