mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
1d86134ec1
commit
2b87415f6f
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue