0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

sub: do not apply timeline offset to external subtitles

Now external subtitles essentially use the playback time, instead of
the segment time.

This is more useful when using external subtitles with mkv ordered
chapters. The previous behavior is not necessarily incorrect, and e.g.
makes it easier to use subtitles directly extracted from ordered
chapters segments. But we consider the new behavior more useful.

Also see commit 06e3dc8.
This commit is contained in:
wm4 2012-12-29 23:28:31 +01:00
parent 944be9d24b
commit 46f8429794

View File

@ -1761,21 +1761,26 @@ static void reset_subtitles(struct MPContext *mpctx)
static void update_subtitles(struct MPContext *mpctx, double refpts_tl)
{
mpctx->osd->sub_offset = mpctx->video_offset;
struct MPOpts *opts = &mpctx->opts;
struct sh_video *sh_video = mpctx->sh_video;
struct sh_sub *sh_sub = mpctx->sh_sub;
struct demux_stream *d_sub = sh_sub ? sh_sub->ds : NULL;
double refpts_s = refpts_tl - mpctx->osd->sub_offset;
double curpts_s = refpts_s + sub_delay;
unsigned char *packet = NULL;
int len;
int type = sh_sub ? sh_sub->type : '\0';
mpctx->osd->sub_offset = mpctx->video_offset;
struct track *track = mpctx->current_track[STREAM_SUB];
if (!track)
return;
if (!track->under_timeline)
mpctx->osd->sub_offset = 0;
double refpts_s = refpts_tl - mpctx->osd->sub_offset;
double curpts_s = refpts_s + sub_delay;
// find sub
if (track->subdata) {
if (sub_fps == 0)