1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:42:17 +00:00

player: slightly simplify seeking in external files

For some reason, this checked whether there are external tracks at all
before doing any seeks. Possibly this was to avoid multiple
get_main_demux_pts() calls, but calling this multiple times shouldn't be
too bad.
This commit is contained in:
wm4 2013-12-24 11:08:26 +01:00
parent b796f2bb76
commit 1d86134ec1

View File

@ -299,23 +299,16 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek,
return -1; return -1;
} }
// If audio or demuxer subs come from different files, seek them too: // Seek external, extra files too:
bool have_external_tracks = false;
for (int t = 0; t < mpctx->num_tracks; t++) { for (int t = 0; t < mpctx->num_tracks; t++) {
struct track *track = mpctx->tracks[t]; struct track *track = mpctx->tracks[t];
have_external_tracks |= track->selected && track->is_external && if (track->selected && track->is_external && track->demuxer) {
track->demuxer;
}
if (have_external_tracks) {
double main_new_pos; double main_new_pos;
if (seek.type == MPSEEK_ABSOLUTE) { if (seek.type == MPSEEK_ABSOLUTE) {
main_new_pos = seek.amount - mpctx->video_offset; main_new_pos = seek.amount - mpctx->video_offset;
} else { } else {
main_new_pos = get_main_demux_pts(mpctx); main_new_pos = get_main_demux_pts(mpctx);
} }
for (int t = 0; t < mpctx->num_tracks; t++) {
struct track *track = mpctx->tracks[t];
if (track->selected && track->is_external && track->demuxer)
demux_seek(track->demuxer, main_new_pos, SEEK_ABSOLUTE); demux_seek(track->demuxer, main_new_pos, SEEK_ABSOLUTE);
} }
} }