diff options
Diffstat (limited to 'src/PlaylistRegistry.cxx')
-rw-r--r-- | src/PlaylistRegistry.cxx | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/PlaylistRegistry.cxx b/src/PlaylistRegistry.cxx index 9afbe349d..2fd3a71a6 100644 --- a/src/PlaylistRegistry.cxx +++ b/src/PlaylistRegistry.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -40,18 +40,18 @@ #include "system/FatalError.hxx" #include "Log.hxx" -#include <glib.h> - #include <assert.h> #include <string.h> const struct playlist_plugin *const playlist_plugins[] = { &extm3u_playlist_plugin, &m3u_playlist_plugin, - &xspf_playlist_plugin, &pls_playlist_plugin, +#ifdef HAVE_EXPAT + &xspf_playlist_plugin, &asx_playlist_plugin, &rss_playlist_plugin, +#endif #ifdef ENABLE_DESPOTIFY &despotify_playlist_plugin, #endif @@ -130,13 +130,12 @@ static SongEnumerator * playlist_list_open_uri_scheme(const char *uri, Mutex &mutex, Cond &cond, bool *tried) { - char *scheme; SongEnumerator *playlist = nullptr; assert(uri != nullptr); - scheme = g_uri_parse_scheme(uri); - if (scheme == nullptr) + const auto scheme = uri_get_scheme(uri); + if (scheme.empty()) return nullptr; for (unsigned i = 0; playlist_plugins[i] != nullptr; ++i) { @@ -146,7 +145,7 @@ playlist_list_open_uri_scheme(const char *uri, Mutex &mutex, Cond &cond, if (playlist_plugins_enabled[i] && plugin->open_uri != nullptr && plugin->schemes != nullptr && - string_array_contains(plugin->schemes, scheme)) { + string_array_contains(plugin->schemes, scheme.c_str())) { playlist = playlist_plugin_open_uri(plugin, uri, mutex, cond); if (playlist != nullptr) @@ -156,7 +155,6 @@ playlist_list_open_uri_scheme(const char *uri, Mutex &mutex, Cond &cond, } } - g_free(scheme); return playlist; } @@ -273,9 +271,7 @@ playlist_list_open_stream_suffix(InputStream &is, const char *suffix) SongEnumerator * playlist_list_open_stream(InputStream &is, const char *uri) { - const char *suffix; - - is.LockWaitReady(); + assert(is.ready); const char *const mime = is.GetMimeType(); if (mime != nullptr) { @@ -284,7 +280,7 @@ playlist_list_open_stream(InputStream &is, const char *uri) return playlist; } - suffix = uri != nullptr ? uri_get_suffix(uri) : nullptr; + const char *suffix = uri != nullptr ? uri_get_suffix(uri) : nullptr; if (suffix != nullptr) { auto playlist = playlist_list_open_stream_suffix(is, suffix); if (playlist != nullptr) @@ -321,7 +317,7 @@ playlist_list_open_path(const char *path_fs, Mutex &mutex, Cond &cond, return nullptr; Error error; - InputStream *is = InputStream::Open(path_fs, mutex, cond, error); + InputStream *is = InputStream::OpenReady(path_fs, mutex, cond, error); if (is == nullptr) { if (error.IsDefined()) LogError(error); @@ -329,8 +325,6 @@ playlist_list_open_path(const char *path_fs, Mutex &mutex, Cond &cond, return nullptr; } - is->LockWaitReady(); - auto playlist = playlist_list_open_stream_suffix(*is, suffix); if (playlist != nullptr) *is_r = is; |