0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

stream: don't mark stdin as a filesystem file

Also rename the field to appropriately reflect what it is supposed to be
used for. The only other use of this was to search for ordered chapter
sources, and that makes no sense for mkv files from stdin.

This also fixes autocreate-playlist loading in the current directory
when the input file is stdin.
This commit is contained in:
llyyr 2024-08-22 22:53:10 +05:30 committed by Kacper Michajłow
parent d2f3b66439
commit d84a7c5112
4 changed files with 6 additions and 4 deletions

View File

@ -259,7 +259,7 @@ static void find_ordered_chapter_sources(struct tl_ctx *ctx)
MP_TARRAY_APPEND(tmp, filenames, num_filenames, MP_TARRAY_APPEND(tmp, filenames, num_filenames,
pl->entries[n]->filename); pl->entries[n]->filename);
} }
} else if (!ctx->demuxer->stream->is_local_file) { } else if (!ctx->demuxer->stream->is_local_fs) {
MP_WARN(ctx, "Playback source is not a " MP_WARN(ctx, "Playback source is not a "
"normal disk file. Will not search for related files.\n"); "normal disk file. Will not search for related files.\n");
} else { } else {

View File

@ -515,7 +515,7 @@ static int parse_dir(struct pl_parser *p)
struct stream *stream = p->real_stream; struct stream *stream = p->real_stream;
enum autocreate_mode autocreate = AUTO_NONE; enum autocreate_mode autocreate = AUTO_NONE;
p->pl->playlist_dir = NULL; p->pl->playlist_dir = NULL;
if (p->autocreate_playlist && p->real_stream->is_local_file && !p->real_stream->is_directory) { if (p->autocreate_playlist && p->real_stream->is_local_fs && !p->real_stream->is_directory) {
bstr ext = bstr_get_ext(bstr0(p->real_stream->url)); bstr ext = bstr_get_ext(bstr0(p->real_stream->url));
switch (p->autocreate_playlist) { switch (p->autocreate_playlist) {
case 1: // filter case 1: // filter

View File

@ -152,7 +152,7 @@ typedef struct stream {
bool seekable : 1; // presence of general byte seeking support bool seekable : 1; // presence of general byte seeking support
bool fast_skip : 1; // consider stream fast enough to fw-seek by skipping bool fast_skip : 1; // consider stream fast enough to fw-seek by skipping
bool is_network : 1; // I really don't know what this is for bool is_network : 1; // I really don't know what this is for
bool is_local_file : 1; // from the filesystem bool is_local_fs : 1; // from the filesystem
bool is_directory : 1; // directory on the filesystem bool is_directory : 1; // directory on the filesystem
bool access_references : 1; // open other streams bool access_references : 1; // open other streams
struct mp_log *log; struct mp_log *log;

View File

@ -280,7 +280,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
.fd = -1, .fd = -1,
}; };
stream->priv = p; stream->priv = p;
stream->is_local_file = true; stream->is_local_fs = true;
bool strict_fs = args->flags & STREAM_LOCAL_FS_ONLY; bool strict_fs = args->flags & STREAM_LOCAL_FS_ONLY;
bool write = stream->mode == STREAM_WRITE; bool write = stream->mode == STREAM_WRITE;
@ -297,6 +297,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
bool is_fdclose = strncmp(url, "fdclose://", 10) == 0; bool is_fdclose = strncmp(url, "fdclose://", 10) == 0;
if (strncmp(url, "fd://", 5) == 0 || is_fdclose) { if (strncmp(url, "fd://", 5) == 0 || is_fdclose) {
stream->is_local_fs = false;
char *begin = strstr(stream->url, "://") + 3, *end = NULL; char *begin = strstr(stream->url, "://") + 3, *end = NULL;
p->fd = strtol(begin, &end, 0); p->fd = strtol(begin, &end, 0);
if (!end || end == begin || end[0] || p->fd < 0) { if (!end || end == begin || end[0] || p->fd < 0) {
@ -312,6 +313,7 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
if (is_fdclose) if (is_fdclose)
p->close = true; p->close = true;
} else if (!strict_fs && !strcmp(filename, "-")) { } else if (!strict_fs && !strcmp(filename, "-")) {
stream->is_local_fs = false;
if (!write) { if (!write) {
MP_INFO(stream, "Reading from stdin...\n"); MP_INFO(stream, "Reading from stdin...\n");
p->fd = 0; p->fd = 0;