diff options
author | wm4 <wm4@nowhere> | 2016-02-23 22:12:11 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-23 23:08:01 +0100 |
commit | 36c6c0f79b84b7e82da468126e160dffce92e1c5 (patch) | |
tree | 6ab5d224d43234344e3e7af79a70dce05990705f /player/loadfile.c | |
parent | 2f562825e03148de470e14aff275faac17b1b0c1 (diff) | |
download | mpv-36c6c0f79b84b7e82da468126e160dffce92e1c5.tar.bz2 mpv-36c6c0f79b84b7e82da468126e160dffce92e1c5.tar.xz |
player: remove MPContext.sources fields
Some oddity that is not needed anymore. The only thing which still
referenced them was avoiding loading external files more than once,
which is now prevented by checking the list of tracks instead.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r-- | player/loadfile.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/player/loadfile.c b/player/loadfile.c index 60a595c3da..7513e0b0b4 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -81,10 +81,6 @@ static void uninit_demuxer(struct MPContext *mpctx) free_demuxer_and_stream(mpctx->demuxer); mpctx->demuxer = NULL; - - talloc_free(mpctx->sources); - mpctx->sources = NULL; - mpctx->num_sources = 0; } static void uninit_stream(struct MPContext *mpctx) @@ -576,15 +572,8 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track) for (int n = mpctx->num_tracks - 1; n >= 0 && !in_use; n--) in_use |= mpctx->tracks[n]->demuxer == d; - if (!in_use) { - for (int n = 0; n < mpctx->num_sources; n++) { - if (mpctx->sources[n] == d) { - MP_TARRAY_REMOVE_AT(mpctx->sources, mpctx->num_sources, n); - break; - } - } + if (!in_use) free_demuxer_and_stream(d); - } mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); @@ -642,7 +631,6 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename, goto err_out; } - MP_TARRAY_APPEND(NULL, mpctx->sources, mpctx->num_sources, demuxer); if (mpctx->playback_initialized) enable_demux_thread(mpctx); return first; @@ -684,8 +672,9 @@ void autoload_external_files(struct MPContext *mpctx) for (int i = 0; list && list[i].fname; i++) { char *filename = list[i].fname; char *lang = list[i].lang; - for (int n = 0; n < mpctx->num_sources; n++) { - if (strcmp(mpctx->sources[n]->stream->url, filename) == 0) + 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) goto skip; } if (list[i].type == STREAM_SUB && !sc[STREAM_VIDEO] && !sc[STREAM_AUDIO]) |