player/sub: eliminate redundancy when printing terminal subtitles

track->selected works for the primary and secondary subtitle.
This commit is contained in:
Dudemanguy authored and sfan5 committed 2025-02-14 15:21:35 +01:00
1 parent de837aa80b
commit 1b63b33871
1 file changed
+2 -8
+2 -8
View File
@@ -134,15 +134,9 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts,
sub_redecode_cached_packets(dec_sub);
// Handle displaying subtitles on terminal.
if (mpctx->current_track[0][STREAM_SUB] == track && !mpctx->video_out) {
if (track->selected && track->type == STREAM_SUB && !mpctx->video_out) {
char *text = sub_get_text(dec_sub, video_pts, SD_TEXT_TYPE_PLAIN);
term_osd_set_subs(mpctx, text, 0);
talloc_free(text);
}
if (mpctx->current_track[1][STREAM_SUB] == track && !mpctx->video_out) {
char *text = sub_get_text(dec_sub, video_pts, SD_TEXT_TYPE_PLAIN);
term_osd_set_subs(mpctx, text, 1);
term_osd_set_subs(mpctx, text, get_order(mpctx, track));
talloc_free(text);
}