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).
This commit is contained in:
1 parent
41d7989800
commit
bf5eac8dd3
3 files changed
+13
-4
No files matched your search
@@ -32,7 +32,10 @@ static int cmp_filename(const void *a, const void *b)
|
||||
|
||||
static int open_file(struct demuxer *demuxer, enum demux_check check)
|
||||
{
|
||||
struct mp_archive *mpa = mp_archive_new(demuxer->log, demuxer->stream);
|
||||
int flags = 0;
|
||||
if (check <= DEMUX_CHECK_REQUEST)
|
||||
flags |= MP_ARCHIVE_FLAG_UNSAFE;
|
||||
struct mp_archive *mpa = mp_archive_new(demuxer->log, demuxer->stream, flags);
|
||||
if (!mpa)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
Reference in new issue
Block a user