mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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:
@@ -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