aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_queue.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-30 23:27:37 +0100
committerMax Kellermann <max@duempel.org>2010-01-01 17:25:07 +0100
commitd3b763a48c09a60a0c0b5ccb6cccd9376875c470 (patch)
tree83b8794f78ef8941806cf5757888d8abf2eaa126 /src/playlist_queue.c
parent816b6ad4a71c3ade95e62b62396f2b0415c03f20 (diff)
downloadmpd-d3b763a48c09a60a0c0b5ccb6cccd9376875c470.tar.gz
mpd-d3b763a48c09a60a0c0b5ccb6cccd9376875c470.tar.xz
mpd-d3b763a48c09a60a0c0b5ccb6cccd9376875c470.zip
input_stream: return allocated input_stream objects
Major API redesign: don't let the caller allocate the input_stream object. Let each input plugin allocate its own (derived/extended) input_stream pointer. The "data" attribute can now be removed, and all input plugins simply cast the input_stream pointer to their own structure (with an "struct input_stream base" as the first attribute).
Diffstat (limited to 'src/playlist_queue.c')
-rw-r--r--src/playlist_queue.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/playlist_queue.c b/src/playlist_queue.c
index 5c000b148..327cdcacc 100644
--- a/src/playlist_queue.c
+++ b/src/playlist_queue.c
@@ -163,16 +163,15 @@ playlist_open_remote_into_queue(const char *uri, struct playlist *dest)
{
GError *error = NULL;
struct playlist_provider *playlist;
- bool stream = false;
- struct input_stream is;
+ struct input_stream *is = NULL;
enum playlist_result result;
assert(uri_has_scheme(uri));
playlist = playlist_list_open_uri(uri);
if (playlist == NULL) {
- stream = input_stream_open(&is, uri, &error);
- if (!stream) {
+ is = input_stream_open(uri, &error);
+ if (is == NULL) {
if (error != NULL) {
g_warning("Failed to open %s: %s",
uri, error->message);
@@ -182,9 +181,9 @@ playlist_open_remote_into_queue(const char *uri, struct playlist *dest)
return PLAYLIST_RESULT_NO_SUCH_LIST;
}
- playlist = playlist_list_open_stream(&is, uri);
+ playlist = playlist_list_open_stream(is, uri);
if (playlist == NULL) {
- input_stream_close(&is);
+ input_stream_close(is);
return PLAYLIST_RESULT_NO_SUCH_LIST;
}
}
@@ -192,8 +191,8 @@ playlist_open_remote_into_queue(const char *uri, struct playlist *dest)
result = playlist_load_into_queue(uri, playlist, dest);
playlist_plugin_close(playlist);
- if (stream)
- input_stream_close(&is);
+ if (is != NULL)
+ input_stream_close(is);
return result;
}
@@ -203,15 +202,13 @@ playlist_open_path_into_queue(const char *path_fs, const char *uri,
struct playlist *dest)
{
struct playlist_provider *playlist;
- struct input_stream is;
enum playlist_result result;
if ((playlist = playlist_list_open_uri(path_fs)) != NULL)
result = playlist_load_into_queue(uri, playlist, dest);
- else if ((playlist = playlist_list_open_path(&is, path_fs)) != NULL) {
+ else if ((playlist = playlist_list_open_path(path_fs)) != NULL)
result = playlist_load_into_queue(uri, playlist, dest);
- input_stream_close(&is);
- } else
+ else
return PLAYLIST_RESULT_NO_SUCH_LIST;
playlist_plugin_close(playlist);