summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-17 23:59:44 +0200
committerwm4 <wm4@nowhere>2015-08-17 23:59:55 +0200
commitbf5eac8dd3f142acd0d506407f1ae853ada3c5bc (patch)
treea19ee90daa0d1ca469455bd8dba9d6d6a336e020 /stream
parent41d7989800aef7b52affdddf0a5f539fb2a1d562 (diff)
downloadmpv-bf5eac8dd3f142acd0d506407f1ae853ada3c5bc.tar.bz2
mpv-bf5eac8dd3f142acd0d506407f1ae853ada3c5bc.tar.xz
demux_libarchive: open flat compressed files
Things like .gz etc., which have no real file header. A mixed bag, because it e.g. tends to misdetect mp3 files as compressed files or something (of course it has no mp3 support - I don't know as what it detects them). But requested by someone (or maybe not, I'm not sure how to interpret that).
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_libarchive.c7
-rw-r--r--stream/stream_libarchive.h5
2 files changed, 9 insertions, 3 deletions
diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c
index c2a64dbf63..4dbb7bde08 100644
--- a/stream/stream_libarchive.c
+++ b/stream/stream_libarchive.c
@@ -71,7 +71,8 @@ void mp_archive_free(struct mp_archive *mpa)
talloc_free(mpa);
}
-struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src)
+struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src,
+ int flags)
{
struct mp_archive *mpa = talloc_zero(NULL, struct mp_archive);
mpa->src = src;
@@ -81,6 +82,8 @@ struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src)
goto err;
archive_read_support_format_all(mpa->arch);
archive_read_support_filter_all(mpa->arch);
+ if (flags & MP_ARCHIVE_FLAG_UNSAFE)
+ archive_read_support_format_raw(mpa->arch);
archive_read_set_callback_data(mpa->arch, mpa);
archive_read_set_read_callback(mpa->arch, read_cb);
archive_read_set_skip_callback(mpa->arch, skip_cb);
@@ -106,7 +109,7 @@ static int reopen_archive(stream_t *s)
{
struct priv *p = s->priv;
mp_archive_free(p->mpa);
- p->mpa = mp_archive_new(s->log, p->src);
+ p->mpa = mp_archive_new(s->log, p->src, MP_ARCHIVE_FLAG_UNSAFE);
if (!p->mpa)
return STREAM_ERROR;
diff --git a/stream/stream_libarchive.h b/stream/stream_libarchive.h
index 5d10eb33c5..f69faade72 100644
--- a/stream/stream_libarchive.h
+++ b/stream/stream_libarchive.h
@@ -7,4 +7,7 @@ struct mp_archive {
};
void mp_archive_free(struct mp_archive *mpa);
-struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src);
+
+#define MP_ARCHIVE_FLAG_UNSAFE 1
+struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src,
+ int flags);