summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-24 11:30:22 +0100
committerwm4 <wm4@nowhere>2013-12-24 17:45:06 +0100
commit2b87415f6f38e93358b9d3034dcf5af6a70f43cc (patch)
tree01c8f21232fef2f9f6c5080273e6a4cd3efc09e5 /player/loadfile.c
parent1d86134ec1c454cc8a5fed2e58eef7110759b0af (diff)
downloadmpv-2b87415f6f38e93358b9d3034dcf5af6a70f43cc.tar.bz2
mpv-2b87415f6f38e93358b9d3034dcf5af6a70f43cc.tar.xz
player: do initial seek for external tracks only once
Normally, there can be only one demuxer stream active for each demuxer of an external file, but this assumption will be broken for multiple subtitles support.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 389a205dc8..2ebea2bd32 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -274,13 +274,23 @@ void reselect_demux_streams(struct MPContext *mpctx)
}
// External demuxers might need a seek to the current playback position.
-// Also return the stream for convenience.
-struct sh_stream *init_demux_stream(struct MPContext *mpctx, struct track *track)
+static void external_track_seek(struct MPContext *mpctx, struct track *track)
{
if (track && track->demuxer && track->selected && track->is_external) {
+ for (int t = 0; t < mpctx->num_tracks; t++) {
+ struct track *other = mpctx->tracks[t];
+ if (other->demuxer == track->demuxer &&
+ demuxer_stream_is_selected(other->demuxer, other->stream))
+ return;
+ }
double pts = get_main_demux_pts(mpctx);
demux_seek(track->demuxer, pts, SEEK_ABSOLUTE);
}
+}
+
+struct sh_stream *init_demux_stream(struct MPContext *mpctx, struct track *track)
+{
+ external_track_seek(mpctx, track);
return track ? track->stream : NULL;
}