summaryrefslogtreecommitdiff
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-11 20:02:01 +0100
committerMax Kellermann <max@musicpd.org>2018-01-11 20:08:02 +0100
commit26b1573cbe738c90f66e5883efaa631aa0eb7dee (patch)
tree4c58dc8c56ec247259f859c6173603ee1731fd44 /src/playlist
parent7fe07324d7f7174f9e3868a74c3d3ce2a8073632 (diff)
playlist/SoundCloud: move code to Yajl::Parse(InputStream&)
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/plugins/SoundCloudPlaylistPlugin.cxx19
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);
}
/**