diff options
Diffstat (limited to 'src/playlist')
-rw-r--r-- | src/playlist/plugins/SoundCloudPlaylistPlugin.cxx | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx index 9813c58ed..ad88868b1 100644 --- a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx +++ b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx @@ -22,6 +22,7 @@ #include "../PlaylistPlugin.hxx" #include "../MemorySongEnumerator.hxx" #include "lib/yajl/Handle.hxx" +#include "lib/yajl/ParseInputStream.hxx" #include "config/Block.hxx" #include "input/InputStream.hxx" #include "tag/Builder.hxx" @@ -227,23 +228,7 @@ soundcloud_parse_json(const char *url, Yajl::Handle &handle, Mutex &mutex, Cond &cond) { auto input_stream = InputStream::OpenReady(url, mutex, cond); - - const std::lock_guard<Mutex> protect(mutex); - - bool done = false; - - while (!done) { - unsigned char buffer[4096]; - const size_t nbytes = - input_stream->Read(buffer, sizeof(buffer)); - if (nbytes == 0) - done = true; - - if (done) { - handle.CompleteParse(); - } else - handle.Parse(buffer, nbytes); - } + Yajl::ParseInputStream(handle, *input_stream); } /** |