mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
stream_libarchive: remove base filename stuff
Apparently this was so that when playing a video file from a .rar file, it would load external subtitles with the same name (instead of looking for mpv's rar:// mangled URL). This was requested on github almost 5 years ago. Seems like a shit feature, and why should I give a fuck? Drop it, because it complicates some in progress change.
This commit is contained in:
parent
283362f5c4
commit
4d24ba4f2b
@ -222,8 +222,6 @@ struct demux_internal {
|
||||
int64_t last_speed_query;
|
||||
uint64_t bytes_per_second;
|
||||
int64_t next_cache_update;
|
||||
// Updated during init only.
|
||||
char *stream_base_filename;
|
||||
|
||||
// -- Access from demuxer thread only
|
||||
bool enable_recording;
|
||||
@ -2244,16 +2242,6 @@ void demux_update(demuxer_t *demuxer)
|
||||
pthread_mutex_unlock(&in->lock);
|
||||
}
|
||||
|
||||
static void demux_init_cache(struct demuxer *demuxer)
|
||||
{
|
||||
struct demux_internal *in = demuxer->in;
|
||||
struct stream *stream = demuxer->stream;
|
||||
|
||||
char *base = NULL;
|
||||
stream_control(stream, STREAM_CTRL_GET_BASE_FILENAME, &base);
|
||||
in->stream_base_filename = talloc_steal(demuxer, base);
|
||||
}
|
||||
|
||||
static void demux_init_cuesheet(struct demuxer *demuxer)
|
||||
{
|
||||
char *cue = mp_tags_get_str(demuxer->metadata, "cuesheet");
|
||||
@ -2417,7 +2405,6 @@ static struct demuxer *open_given_type(struct mpv_global *global,
|
||||
in->d_thread->partially_seekable = true;
|
||||
}
|
||||
demux_init_cuesheet(in->d_thread);
|
||||
demux_init_cache(demuxer);
|
||||
demux_init_ccs(demuxer, opts);
|
||||
demux_copy(in->d_user, in->d_thread);
|
||||
in->duration = in->d_thread->duration;
|
||||
@ -3137,11 +3124,6 @@ static int cached_stream_control(struct demux_internal *in, int cmd, void *arg)
|
||||
return STREAM_UNSUPPORTED;
|
||||
*(int64_t *)arg = in->stream_size;
|
||||
return STREAM_OK;
|
||||
case STREAM_CTRL_GET_BASE_FILENAME:
|
||||
if (!in->stream_base_filename)
|
||||
return STREAM_UNSUPPORTED;
|
||||
*(char **)arg = talloc_strdup(NULL, in->stream_base_filename);
|
||||
return STREAM_OK;
|
||||
}
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
|
@ -816,14 +816,7 @@ void autoload_external_files(struct MPContext *mpctx, struct mp_cancel *cancel)
|
||||
return;
|
||||
|
||||
void *tmp = talloc_new(NULL);
|
||||
char *base_filename = mpctx->filename;
|
||||
char *stream_filename = NULL;
|
||||
if (mpctx->demuxer) {
|
||||
if (demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_BASE_FILENAME,
|
||||
&stream_filename) > 0)
|
||||
base_filename = talloc_steal(tmp, stream_filename);
|
||||
}
|
||||
struct subfn *list = find_external_files(mpctx->global, base_filename,
|
||||
struct subfn *list = find_external_files(mpctx->global, mpctx->filename,
|
||||
mpctx->opts);
|
||||
talloc_steal(tmp, list);
|
||||
|
||||
|
@ -54,9 +54,6 @@ enum stream_ctrl {
|
||||
// stream_memory.c
|
||||
STREAM_CTRL_SET_CONTENTS,
|
||||
|
||||
// stream_libarchive.c
|
||||
STREAM_CTRL_GET_BASE_FILENAME,
|
||||
|
||||
// Certain network protocols
|
||||
STREAM_CTRL_AVSEEK,
|
||||
STREAM_CTRL_HAS_AVSEEK,
|
||||
|
@ -460,9 +460,6 @@ static int archive_entry_control(stream_t *s, int cmd, void *arg)
|
||||
{
|
||||
struct priv *p = s->priv;
|
||||
switch (cmd) {
|
||||
case STREAM_CTRL_GET_BASE_FILENAME:
|
||||
*(char **)arg = talloc_strdup(NULL, p->src->url);
|
||||
return STREAM_OK;
|
||||
case STREAM_CTRL_GET_SIZE:
|
||||
if (p->entry_size < 0)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user