aboutsummaryrefslogtreecommitdiff
path: root/src/playlist
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert-lists@gmx.net>2012-03-19 21:16:48 +0100
committerMax Kellermann <max@duempel.org>2012-03-19 21:16:48 +0100
commit281b8714efbf930a80eb3ab6056240ae0882aa22 (patch)
tree1d2c6168d55d1dd7afe3f0c899ef4ef22de4c2b6 /src/playlist
parentd5be3cce9cb3f198c7b36ac09400e963555066c8 (diff)
playlist/soundcloud: support libyajl2
[mk: backwars compatibility and autoconf check]
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/soundcloud_playlist_plugin.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/playlist/soundcloud_playlist_plugin.c b/src/playlist/soundcloud_playlist_plugin.c
index ddaf4e96..30d486e6 100644
--- a/src/playlist/soundcloud_playlist_plugin.c
+++ b/src/playlist/soundcloud_playlist_plugin.c
@@ -110,7 +110,12 @@ struct parse_data {
GSList* songs;
};
-static int handle_integer(void *ctx, long intval)
+static int handle_integer(void *ctx,
+ long
+#ifndef HAVE_YAJL1
+ long
+#endif
+ intval)
{
struct parse_data *data = (struct parse_data *) ctx;
@@ -269,13 +274,20 @@ soundcloud_parse_json(const char *url, yajl_handle hand, GMutex* mutex, GCond* c
}
}
- if (done)
+ if (done) {
+#ifdef HAVE_YAJL1
stat = yajl_parse_complete(hand);
- else
+#else
+ stat = yajl_complete_parse(hand);
+#endif
+ } else
stat = yajl_parse(hand, ubuffer, nbytes);
- if (stat != yajl_status_ok &&
- stat != yajl_status_insufficient_data)
+ if (stat != yajl_status_ok
+#ifdef HAVE_YAJL1
+ && stat != yajl_status_insufficient_data
+#endif
+ )
{
unsigned char *str = yajl_get_error(hand, 1, ubuffer, nbytes);
g_warning("%s", str);
@@ -356,7 +368,11 @@ soundcloud_open_uri(const char *uri, GMutex *mutex, GCond *cond)
data.songs = NULL;
data.title = NULL;
data.stream_url = NULL;
+#ifdef HAVE_YAJL1
hand = yajl_alloc(&parse_callbacks, NULL, NULL, (void *) &data);
+#else
+ hand = yajl_alloc(&parse_callbacks, NULL, (void *) &data);
+#endif
int ret = soundcloud_parse_json(u, hand, mutex, cond);