diff options
author | wm4 <wm4@nowhere> | 2016-08-26 12:31:09 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-26 13:33:38 +0200 |
commit | 4121016689668921538317449c0ea9063fc086fc (patch) | |
tree | b95cb98b22a89271af627464894f05f855346dc2 /player | |
parent | b636b1905822272bdde10ebe5d997396751892bf (diff) | |
download | mpv-4121016689668921538317449c0ea9063fc086fc.tar.bz2 mpv-4121016689668921538317449c0ea9063fc086fc.tar.xz |
player: don't directly access demuxer->stream
Cleaner and makes it easier to change the underlying stream.
mp_property_stream_capture() still directly accesses it directly via
demux_run_on_thread(). This is evil, but still somewhat sane and is not
getting into the way here.
Not sure if I got all field accesses.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 6 | ||||
-rw-r--r-- | player/loadfile.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/player/command.c b/player/command.c index e9a051db8c..f4c10d48b9 100644 --- a/player/command.c +++ b/player/command.c @@ -429,11 +429,9 @@ static int mp_property_stream_path(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - // demuxer->stream as well as stream->url are immutable -> ok to access - struct stream *stream = mpctx->demuxer ? mpctx->demuxer->stream : NULL; - if (!stream || !stream->url) + if (!mpctx->demuxer || !mpctx->demuxer->filename) return M_PROPERTY_UNAVAILABLE; - return m_property_strdup_ro(action, arg, stream->url); + return m_property_strdup_ro(action, arg, mpctx->demuxer->filename); } struct change_stream_capture_args { diff --git a/player/loadfile.c b/player/loadfile.c index c41ff4367a..b42b8f14e3 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -634,7 +634,7 @@ void autoload_external_files(struct MPContext *mpctx) char *lang = list[i].lang; for (int n = 0; n < mpctx->num_tracks; n++) { struct track *t = mpctx->tracks[n]; - if (t->demuxer && strcmp(t->demuxer->stream->url, filename) == 0) + if (t->demuxer && strcmp(t->demuxer->filename, filename) == 0) goto skip; } if (list[i].type == STREAM_SUB && !sc[STREAM_VIDEO] && !sc[STREAM_AUDIO]) @@ -1029,7 +1029,7 @@ reopen_file: int entry_stream_flags = 0; if (!pl->disable_safety) { entry_stream_flags = STREAM_SAFE_ONLY; - if (mpctx->demuxer->stream->is_network) + if (mpctx->demuxer->is_network) entry_stream_flags |= STREAM_NETWORK_ONLY; } for (struct playlist_entry *e = pl->first; e; e = e->next) |