From 32b5654a6e7738211e6aa18ab8089cc6328aa1fa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 1 Nov 2014 13:20:39 +0100 Subject: [PATCH] Decoder, Playlist: ignore URI query string for plugin detection Use the new uri_get_suffix() overload that removes the query string. --- NEWS | 1 + src/DecoderThread.cxx | 3 ++- src/PlaylistRegistry.cxx | 11 ++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 509627858..1cebfd2db 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.18.17 (not yet released) - don't allow empty playlist name - m3u: recognize the file suffix ".m3u8" * decoder + - ignore URI query string for plugin detection - faad: remove workaround for ancient libfaad2 ABI bug - ffmpeg: recognize MIME type audio/aacp diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx index cf21534f0..7ee36faca 100644 --- a/src/DecoderThread.cxx +++ b/src/DecoderThread.cxx @@ -212,7 +212,8 @@ static bool decoder_run_stream_locked(Decoder &decoder, InputStream &is, const char *uri, bool &tried_r) { - const char *const suffix = uri_get_suffix(uri); + UriSuffixBuffer suffix_buffer; + const char *const suffix = uri_get_suffix(uri, suffix_buffer); using namespace std::placeholders; const auto f = std::bind(decoder_run_stream_plugin, diff --git a/src/PlaylistRegistry.cxx b/src/PlaylistRegistry.cxx index 9afbe349d..f81978322 100644 --- a/src/PlaylistRegistry.cxx +++ b/src/PlaylistRegistry.cxx @@ -164,12 +164,12 @@ static SongEnumerator * playlist_list_open_uri_suffix(const char *uri, Mutex &mutex, Cond &cond, const bool *tried) { - const char *suffix; SongEnumerator *playlist = nullptr; assert(uri != nullptr); - suffix = uri_get_suffix(uri); + UriSuffixBuffer suffix_buffer; + const char *const suffix = uri_get_suffix(uri, suffix_buffer); if (suffix == nullptr) return nullptr; @@ -273,8 +273,6 @@ 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(); const char *const mime = is.GetMimeType(); @@ -284,7 +282,10 @@ playlist_list_open_stream(InputStream &is, const char *uri) return playlist; } - suffix = uri != nullptr ? uri_get_suffix(uri) : nullptr; + UriSuffixBuffer suffix_buffer; + const char *suffix = uri != nullptr + ? uri_get_suffix(uri, suffix_buffer) + : nullptr; if (suffix != nullptr) { auto playlist = playlist_list_open_stream_suffix(is, suffix); if (playlist != nullptr)