aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-09-05 00:06:31 +0200
committerMax Kellermann <max@duempel.org>2013-09-05 00:23:14 +0200
commit7d0269d2cec68c7e55df5b6db3d2266741534b17 (patch)
tree613f5d7b03bc9624f15167c76f8f4309603944cc /src/playlist
parent52ffdb0a55e43153fa9fc1189316884a630df700 (diff)
downloadmpd-7d0269d2cec68c7e55df5b6db3d2266741534b17.tar.gz
mpd-7d0269d2cec68c7e55df5b6db3d2266741534b17.tar.xz
mpd-7d0269d2cec68c7e55df5b6db3d2266741534b17.zip
InputLegacy: move functions to the input_stream class
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/AsxPlaylistPlugin.cxx5
-rw-r--r--src/playlist/CuePlaylistPlugin.cxx1
-rw-r--r--src/playlist/LastFMPlaylistPlugin.cxx26
-rw-r--r--src/playlist/PlsPlaylistPlugin.cxx5
-rw-r--r--src/playlist/RssPlaylistPlugin.cxx5
-rw-r--r--src/playlist/SoundCloudPlaylistPlugin.cxx17
-rw-r--r--src/playlist/XspfPlaylistPlugin.cxx5
7 files changed, 29 insertions, 35 deletions
diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx
index 16b187402..c0fc15e07 100644
--- a/src/playlist/AsxPlaylistPlugin.cxx
+++ b/src/playlist/AsxPlaylistPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "AsxPlaylistPlugin.hxx"
#include "MemoryPlaylistProvider.hxx"
-#include "InputLegacy.hxx"
+#include "InputStream.hxx"
#include "Song.hxx"
#include "Tag.hxx"
#include "util/Error.hxx"
@@ -219,8 +219,7 @@ asx_open_stream(struct input_stream *is)
&parser, asx_parser_destroy);
while (true) {
- nbytes = input_stream_lock_read(is, buffer, sizeof(buffer),
- error2);
+ nbytes = is->LockRead(buffer, sizeof(buffer), error2);
if (nbytes == 0) {
if (error2.IsDefined()) {
g_markup_parse_context_free(context);
diff --git a/src/playlist/CuePlaylistPlugin.cxx b/src/playlist/CuePlaylistPlugin.cxx
index 139ab52f4..aa84b1c4a 100644
--- a/src/playlist/CuePlaylistPlugin.cxx
+++ b/src/playlist/CuePlaylistPlugin.cxx
@@ -22,7 +22,6 @@
#include "PlaylistPlugin.hxx"
#include "Tag.hxx"
#include "Song.hxx"
-#include "InputLegacy.hxx"
#include "cue/CueParser.hxx"
#include "TextInputStream.hxx"
diff --git a/src/playlist/LastFMPlaylistPlugin.cxx b/src/playlist/LastFMPlaylistPlugin.cxx
index 5b168ee83..a4952cd1c 100644
--- a/src/playlist/LastFMPlaylistPlugin.cxx
+++ b/src/playlist/LastFMPlaylistPlugin.cxx
@@ -23,7 +23,7 @@
#include "PlaylistRegistry.hxx"
#include "conf.h"
#include "Song.hxx"
-#include "InputLegacy.hxx"
+#include "InputStream.hxx"
#include "util/Error.hxx"
#include <glib.h>
@@ -45,7 +45,7 @@ struct LastfmPlaylist {
~LastfmPlaylist() {
playlist_plugin_close(xspf);
- input_stream_close(is);
+ is->Close();
}
};
@@ -97,7 +97,7 @@ lastfm_get(const char *url, Mutex &mutex, Cond &cond)
char buffer[4096];
size_t length = 0;
- input_stream = input_stream_open(url, mutex, cond, error);
+ input_stream = input_stream::Open(url, mutex, cond, error);
if (input_stream == NULL) {
if (error.IsDefined())
g_warning("%s", error.GetMessage());
@@ -107,22 +107,22 @@ lastfm_get(const char *url, Mutex &mutex, Cond &cond)
mutex.lock();
- input_stream_wait_ready(input_stream);
+ input_stream->WaitReady();
do {
size_t nbytes =
- input_stream_read(input_stream, buffer + length,
- sizeof(buffer) - length, error);
+ input_stream->Read(buffer + length,
+ sizeof(buffer) - length, error);
if (nbytes == 0) {
if (error.IsDefined())
g_warning("%s", error.GetMessage());
- if (input_stream_eof(input_stream))
+ if (input_stream->IsEOF())
break;
/* I/O error */
mutex.unlock();
- input_stream_close(input_stream);
+ input_stream->Close();
return NULL;
}
@@ -131,7 +131,7 @@ lastfm_get(const char *url, Mutex &mutex, Cond &cond)
mutex.unlock();
- input_stream_close(input_stream);
+ input_stream->Close();
return g_strndup(buffer, length);
}
@@ -223,7 +223,7 @@ lastfm_open_uri(const char *uri, Mutex &mutex, Cond &cond)
g_free(session);
Error error;
- const auto is = input_stream_open(p, mutex, cond, error);
+ const auto is = input_stream::Open(p, mutex, cond, error);
g_free(p);
if (is == nullptr) {
@@ -237,11 +237,11 @@ lastfm_open_uri(const char *uri, Mutex &mutex, Cond &cond)
mutex.lock();
- input_stream_wait_ready(is);
+ is->WaitReady();
/* last.fm does not send a MIME type, we have to fake it here
:-( */
- input_stream_override_mime_type(is, "application/xspf+xml");
+ is->OverrideMimeType("application/xspf+xml");
mutex.unlock();
@@ -249,7 +249,7 @@ lastfm_open_uri(const char *uri, Mutex &mutex, Cond &cond)
const auto xspf = playlist_list_open_stream(is, nullptr);
if (xspf == nullptr) {
- input_stream_close(is);
+ is->Close();
g_warning("Failed to parse XSPF playlist");
return NULL;
}
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx
index ab8f93bef..4a0fde45f 100644
--- a/src/playlist/PlsPlaylistPlugin.cxx
+++ b/src/playlist/PlsPlaylistPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "PlsPlaylistPlugin.hxx"
#include "MemoryPlaylistProvider.hxx"
-#include "InputLegacy.hxx"
+#include "InputStream.hxx"
#include "Song.hxx"
#include "Tag.hxx"
#include "util/Error.hxx"
@@ -114,8 +114,7 @@ pls_open_stream(struct input_stream *is)
std::string kf_data;
do {
- nbytes = input_stream_lock_read(is, buffer, sizeof(buffer),
- error2);
+ nbytes = is->LockRead(buffer, sizeof(buffer), error2);
if (nbytes == 0) {
if (error2.IsDefined()) {
g_warning("%s", error2.GetMessage());
diff --git a/src/playlist/RssPlaylistPlugin.cxx b/src/playlist/RssPlaylistPlugin.cxx
index 98f323e66..c045b4df2 100644
--- a/src/playlist/RssPlaylistPlugin.cxx
+++ b/src/playlist/RssPlaylistPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "RssPlaylistPlugin.hxx"
#include "MemoryPlaylistProvider.hxx"
-#include "InputLegacy.hxx"
+#include "InputStream.hxx"
#include "Song.hxx"
#include "Tag.hxx"
#include "util/Error.hxx"
@@ -216,8 +216,7 @@ rss_open_stream(struct input_stream *is)
&parser, rss_parser_destroy);
while (true) {
- nbytes = input_stream_lock_read(is, buffer, sizeof(buffer),
- error2);
+ nbytes = is->LockRead(buffer, sizeof(buffer), error2);
if (nbytes == 0) {
if (error2.IsDefined()) {
g_markup_parse_context_free(context);
diff --git a/src/playlist/SoundCloudPlaylistPlugin.cxx b/src/playlist/SoundCloudPlaylistPlugin.cxx
index b6be4fd30..0b38caeea 100644
--- a/src/playlist/SoundCloudPlaylistPlugin.cxx
+++ b/src/playlist/SoundCloudPlaylistPlugin.cxx
@@ -21,7 +21,7 @@
#include "SoundCloudPlaylistPlugin.hxx"
#include "MemoryPlaylistProvider.hxx"
#include "conf.h"
-#include "InputLegacy.hxx"
+#include "InputStream.hxx"
#include "Song.hxx"
#include "Tag.hxx"
#include "util/Error.hxx"
@@ -249,8 +249,8 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
unsigned char *ubuffer = (unsigned char *)buffer;
Error error;
- input_stream *input_stream = input_stream_open(url, mutex, cond,
- error);
+ input_stream *input_stream = input_stream::Open(url, mutex, cond,
+ error);
if (input_stream == NULL) {
if (error.IsDefined())
g_warning("%s", error.GetMessage());
@@ -258,24 +258,23 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
}
mutex.lock();
- input_stream_wait_ready(input_stream);
+ input_stream->WaitReady();
yajl_status stat;
int done = 0;
while (!done) {
const size_t nbytes =
- input_stream_read(input_stream, buffer, sizeof(buffer),
- error);
+ input_stream->Read(buffer, sizeof(buffer), error);
if (nbytes == 0) {
if (error.IsDefined())
g_warning("%s", error.GetMessage());
- if (input_stream_eof(input_stream)) {
+ if (input_stream->IsEOF()) {
done = true;
} else {
mutex.unlock();
- input_stream_close(input_stream);
+ input_stream->Close();
return -1;
}
}
@@ -303,7 +302,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand,
}
mutex.unlock();
- input_stream_close(input_stream);
+ input_stream->Close();
return 0;
}
diff --git a/src/playlist/XspfPlaylistPlugin.cxx b/src/playlist/XspfPlaylistPlugin.cxx
index f2412897b..667f484b2 100644
--- a/src/playlist/XspfPlaylistPlugin.cxx
+++ b/src/playlist/XspfPlaylistPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "XspfPlaylistPlugin.hxx"
#include "MemoryPlaylistProvider.hxx"
-#include "InputLegacy.hxx"
+#include "InputStream.hxx"
#include "Tag.hxx"
#include "util/Error.hxx"
@@ -235,8 +235,7 @@ xspf_open_stream(struct input_stream *is)
&parser, xspf_parser_destroy);
while (true) {
- nbytes = input_stream_lock_read(is, buffer, sizeof(buffer),
- error2);
+ nbytes = is->LockRead(buffer, sizeof(buffer), error2);
if (nbytes == 0) {
if (error2.IsDefined()) {
g_markup_parse_context_free(context);