mirror of https://github.com/mpv-player/mpv
player: make redraw_sub flag work on a per track basis
There can be multiple subtitle tracks (secondary subs) so this logic should be handled separately.
This commit is contained in:
parent
fe758a1761
commit
0721b87237
|
@ -141,6 +141,9 @@ struct track {
|
||||||
// Current subtitle state (or cached state if selected==false).
|
// Current subtitle state (or cached state if selected==false).
|
||||||
struct dec_sub *d_sub;
|
struct dec_sub *d_sub;
|
||||||
|
|
||||||
|
/* Heuristic for potentially redrawing subs. */
|
||||||
|
bool redraw_subs;
|
||||||
|
|
||||||
// Current decoding state (NULL if selected==false)
|
// Current decoding state (NULL if selected==false)
|
||||||
struct mp_decoder_wrapper *dec;
|
struct mp_decoder_wrapper *dec;
|
||||||
|
|
||||||
|
@ -408,9 +411,6 @@ typedef struct MPContext {
|
||||||
int last_chapter_seek;
|
int last_chapter_seek;
|
||||||
bool last_chapter_flag;
|
bool last_chapter_flag;
|
||||||
|
|
||||||
/* Heuristic for potentially redrawing subs. */
|
|
||||||
bool redraw_subs;
|
|
||||||
|
|
||||||
bool paused; // internal pause state
|
bool paused; // internal pause state
|
||||||
bool playback_active; // not paused, restarting, loading, unloading
|
bool playback_active; // not paused, restarting, loading, unloading
|
||||||
bool in_playloop;
|
bool in_playloop;
|
||||||
|
|
|
@ -60,8 +60,7 @@ void redraw_subs(struct MPContext *mpctx)
|
||||||
if (mpctx->current_track[n][STREAM_SUB] &&
|
if (mpctx->current_track[n][STREAM_SUB] &&
|
||||||
mpctx->current_track[n][STREAM_SUB]->d_sub)
|
mpctx->current_track[n][STREAM_SUB]->d_sub)
|
||||||
{
|
{
|
||||||
mpctx->redraw_subs = true;
|
mpctx->current_track[n][STREAM_SUB]->redraw_subs = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,9 +128,9 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts,
|
||||||
|
|
||||||
// Check if we need to update subtitles for these special cases. Always
|
// Check if we need to update subtitles for these special cases. Always
|
||||||
// update on discontinuities like seeking or a new file.
|
// update on discontinuities like seeking or a new file.
|
||||||
if (sub_updated || mpctx->redraw_subs || osd_pts == MP_NOPTS_VALUE) {
|
if (sub_updated || track->redraw_subs || osd_pts == MP_NOPTS_VALUE) {
|
||||||
// Always force a redecode of all packets if we seek on a still image.
|
// Always force a redecode of all packets if we seek on a still image.
|
||||||
if (mpctx->redraw_subs && still_image)
|
if (track->redraw_subs && still_image)
|
||||||
sub_redecode_cached_packets(dec_sub);
|
sub_redecode_cached_packets(dec_sub);
|
||||||
|
|
||||||
// Handle displaying subtitles on terminal; never done for secondary subs
|
// Handle displaying subtitles on terminal; never done for secondary subs
|
||||||
|
@ -153,7 +152,7 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mpctx->redraw_subs = false;
|
track->redraw_subs = false;
|
||||||
return packets_read;
|
return packets_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue