1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-10 19:51:43 +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:
wm4 2018-09-07 21:41:52 +02:00
parent 283362f5c4
commit 4d24ba4f2b
4 changed files with 1 additions and 32 deletions

View File

@ -222,8 +222,6 @@ struct demux_internal {
int64_t last_speed_query; int64_t last_speed_query;
uint64_t bytes_per_second; uint64_t bytes_per_second;
int64_t next_cache_update; int64_t next_cache_update;
// Updated during init only.
char *stream_base_filename;
// -- Access from demuxer thread only // -- Access from demuxer thread only
bool enable_recording; bool enable_recording;
@ -2244,16 +2242,6 @@ void demux_update(demuxer_t *demuxer)
pthread_mutex_unlock(&in->lock); 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) static void demux_init_cuesheet(struct demuxer *demuxer)
{ {
char *cue = mp_tags_get_str(demuxer->metadata, "cuesheet"); 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; in->d_thread->partially_seekable = true;
} }
demux_init_cuesheet(in->d_thread); demux_init_cuesheet(in->d_thread);
demux_init_cache(demuxer);
demux_init_ccs(demuxer, opts); demux_init_ccs(demuxer, opts);
demux_copy(in->d_user, in->d_thread); demux_copy(in->d_user, in->d_thread);
in->duration = in->d_thread->duration; 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; return STREAM_UNSUPPORTED;
*(int64_t *)arg = in->stream_size; *(int64_t *)arg = in->stream_size;
return STREAM_OK; 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; return STREAM_ERROR;
} }

View File

@ -816,14 +816,7 @@ void autoload_external_files(struct MPContext *mpctx, struct mp_cancel *cancel)
return; return;
void *tmp = talloc_new(NULL); void *tmp = talloc_new(NULL);
char *base_filename = mpctx->filename; struct subfn *list = find_external_files(mpctx->global, 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,
mpctx->opts); mpctx->opts);
talloc_steal(tmp, list); talloc_steal(tmp, list);

View File

@ -54,9 +54,6 @@ enum stream_ctrl {
// stream_memory.c // stream_memory.c
STREAM_CTRL_SET_CONTENTS, STREAM_CTRL_SET_CONTENTS,
// stream_libarchive.c
STREAM_CTRL_GET_BASE_FILENAME,
// Certain network protocols // Certain network protocols
STREAM_CTRL_AVSEEK, STREAM_CTRL_AVSEEK,
STREAM_CTRL_HAS_AVSEEK, STREAM_CTRL_HAS_AVSEEK,

View File

@ -460,9 +460,6 @@ static int archive_entry_control(stream_t *s, int cmd, void *arg)
{ {
struct priv *p = s->priv; struct priv *p = s->priv;
switch (cmd) { switch (cmd) {
case STREAM_CTRL_GET_BASE_FILENAME:
*(char **)arg = talloc_strdup(NULL, p->src->url);
return STREAM_OK;
case STREAM_CTRL_GET_SIZE: case STREAM_CTRL_GET_SIZE:
if (p->entry_size < 0) if (p->entry_size < 0)
break; break;