input_stream: added attribute "uri"
This commit is contained in:
parent
fb9bd53328
commit
9cb7760c5e
@ -168,13 +168,12 @@ bz2_close(struct archive_file *file)
|
||||
/* single archive handling */
|
||||
|
||||
static struct input_stream *
|
||||
bz2_open_stream(struct archive_file *file,
|
||||
G_GNUC_UNUSED const char *path, GError **error_r)
|
||||
bz2_open_stream(struct archive_file *file, const char *path, GError **error_r)
|
||||
{
|
||||
struct bz2_archive_file *context = (struct bz2_archive_file *) file;
|
||||
struct bz2_input_stream *bis = g_new(struct bz2_input_stream, 1);
|
||||
|
||||
input_stream_init(&bis->base, &bz2_inputplugin);
|
||||
input_stream_init(&bis->base, &bz2_inputplugin, path);
|
||||
|
||||
bis->archive = context;
|
||||
|
||||
|
@ -180,7 +180,7 @@ iso9660_archive_open_stream(struct archive_file *file,
|
||||
struct iso9660_input_stream *iis;
|
||||
|
||||
iis = g_new(struct iso9660_input_stream, 1);
|
||||
input_stream_init(&iis->base, &iso9660_input_plugin);
|
||||
input_stream_init(&iis->base, &iso9660_input_plugin, pathname);
|
||||
|
||||
iis->archive = context;
|
||||
iis->statbuf = iso9660_ifs_stat_translate(context->iso, pathname);
|
||||
|
@ -141,7 +141,7 @@ zzip_archive_open_stream(struct archive_file *file,
|
||||
ZZIP_STAT z_stat;
|
||||
|
||||
zis = g_new(struct zzip_input_stream, 1);
|
||||
input_stream_init(&zis->base, &zzip_input_plugin);
|
||||
input_stream_init(&zis->base, &zzip_input_plugin, pathname);
|
||||
|
||||
zis->archive = context;
|
||||
zis->file = zzip_file_open(context->dir, pathname, 0);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -38,6 +38,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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user