diff options
-rw-r--r-- | src/input/plugins/QobuzInputPlugin.cxx | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/input/plugins/QobuzInputPlugin.cxx b/src/input/plugins/QobuzInputPlugin.cxx index bf1c89bf3..0b7ed2c03 100644 --- a/src/input/plugins/QobuzInputPlugin.cxx +++ b/src/input/plugins/QobuzInputPlugin.cxx @@ -163,18 +163,28 @@ FinishQobuzInput() delete qobuz_client; } -static InputStreamPtr -OpenQobuzInput(const char *uri, Mutex &mutex, Cond &cond) +gcc_pure +static const char * +ExtractQobuzTrackId(const char *uri) { - assert(qobuz_client != nullptr); + // TODO: what's the standard "qobuz://" URI syntax? + const char *track_id = StringAfterPrefix(uri, "qobuz://track/"); + if (track_id == nullptr) + return nullptr; - const char *track_id; + if (*track_id == 0) + return nullptr; - // TODO: what's the standard "qobuz://" URI syntax? + return track_id; +} - track_id = StringAfterPrefix(uri, "qobuz://track/"); +static InputStreamPtr +OpenQobuzInput(const char *uri, Mutex &mutex, Cond &cond) +{ + assert(qobuz_client != nullptr); - if (track_id == nullptr || *track_id == 0) + const char *track_id = ExtractQobuzTrackId(uri); + if (track_id == nullptr) return nullptr; // TODO: validate track_id |