aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-18 09:26:10 +0100
committerMax Kellermann <max@duempel.org>2010-01-18 10:18:41 +0100
commit9cb7760c5eb63cb6b7034ec9d2cdf9af2f198652 (patch)
treec15ed352beb3637c4186f3000152bf1a39008896 /src/input
parentfb9bd53328e3ff57ea4b3cfee24068f9fb54927b (diff)
downloadmpd-9cb7760c5eb63cb6b7034ec9d2cdf9af2f198652.tar.gz
mpd-9cb7760c5eb63cb6b7034ec9d2cdf9af2f198652.tar.xz
mpd-9cb7760c5eb63cb6b7034ec9d2cdf9af2f198652.zip
input_stream: added attribute "uri"
Diffstat (limited to '')
-rw-r--r--src/input/curl_input_plugin.c2
-rw-r--r--src/input/file_input_plugin.c2
-rw-r--r--src/input/mms_input_plugin.c2
-rw-r--r--src/input/rewind_input_plugin.c2
-rw-r--r--src/input_stream.h11
5 files changed, 14 insertions, 5 deletions
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index 1b759b4fc..839c98074 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -801,7 +801,7 @@ input_curl_open(const char *url, GError **error_r)
return NULL;
c = g_new0(struct input_curl, 1);
- input_stream_init(&c->base, &input_plugin_curl);
+ input_stream_init(&c->base, &input_plugin_curl, url);
c->url = g_strdup(url);
c->buffers = g_queue_new();
diff --git a/src/input/file_input_plugin.c b/src/input/file_input_plugin.c
index 173b7c2e8..a18de67b8 100644
--- a/src/input/file_input_plugin.c
+++ b/src/input/file_input_plugin.c
@@ -84,7 +84,7 @@ input_file_open(const char *filename, GError **error_r)
#endif
fis = g_new(struct file_input_stream, 1);
- input_stream_init(&fis->base, &input_plugin_file);
+ input_stream_init(&fis->base, &input_plugin_file, filename);
fis->base.size = st.st_size;
fis->base.seekable = true;
diff --git a/src/input/mms_input_plugin.c b/src/input/mms_input_plugin.c
index 31a75fdba..8d4f7591d 100644
--- a/src/input/mms_input_plugin.c
+++ b/src/input/mms_input_plugin.c
@@ -56,7 +56,7 @@ input_mms_open(const char *url, GError **error_r)
return NULL;
m = g_new(struct input_mms, 1);
- input_stream_init(&m->base, &input_plugin_mms);
+ input_stream_init(&m->base, &input_plugin_mms, url);
m->mms = mmsx_connect(NULL, NULL, url, 128 * 1024);
if (m->mms == NULL) {
diff --git a/src/input/rewind_input_plugin.c b/src/input/rewind_input_plugin.c
index e82d4ecb9..eea59096b 100644
--- a/src/input/rewind_input_plugin.c
+++ b/src/input/rewind_input_plugin.c
@@ -227,7 +227,7 @@ input_rewind_open(struct input_stream *is)
return is;
c = g_new(struct input_rewind, 1);
- input_stream_init(&c->base, &rewind_input_plugin);
+ input_stream_init(&c->base, &rewind_input_plugin, is->uri);
c->tail = 0;
c->input = is;
diff --git a/src/input_stream.h b/src/input_stream.h
index 05ef257f9..056d008a7 100644
--- a/src/input_stream.h
+++ b/src/input_stream.h
@@ -39,6 +39,12 @@ struct input_stream {
const struct input_plugin *plugin;
/**
+ * The absolute URI which was used to open this stream. May
+ * be NULL if this is unknown.
+ */
+ char *uri;
+
+ /**
* indicates whether the stream is ready for reading and
* whether the other attributes in this struct are valid
*/
@@ -66,9 +72,11 @@ struct input_stream {
};
static inline void
-input_stream_init(struct input_stream *is, const struct input_plugin *plugin)
+input_stream_init(struct input_stream *is, const struct input_plugin *plugin,
+ const char *uri)
{
is->plugin = plugin;
+ is->uri = g_strdup(uri);
is->ready = false;
is->seekable = false;
is->size = -1;
@@ -79,6 +87,7 @@ input_stream_init(struct input_stream *is, const struct input_plugin *plugin)
static inline void
input_stream_deinit(struct input_stream *is)
{
+ g_free(is->uri);
g_free(is->mime);
}