osd: allow sub-text to work even if sub-visibility is disabled

This commit is contained in:
dudemanguy 2018-10-26 09:51:47 -05:00 committed by wm4
parent 1591ccfff5
commit 48740dfec5
3 changed files with 5 additions and 5 deletions

View File

@ -1903,9 +1903,9 @@ Property list
Last known OSD display pixel aspect (can be 0). Last known OSD display pixel aspect (can be 0).
``sub-text`` ``sub-text``
Return the current subtitle text. Formatting is stripped. If a subtitle Return the current subtitle text regardless of sub visibility.
is selected, but no text is currently visible, or the subtitle is not Formatting is stripped. If the subtitle is not text-based
text-based (i.e. DVD/BD subtitles), an empty string is returned. (i.e. DVD/BD subtitles), an empty string is returned.
This property is experimental and might be removed in the future. This property is experimental and might be removed in the future.

View File

@ -98,7 +98,7 @@ static void term_osd_update(struct MPContext *mpctx)
void term_osd_set_subs(struct MPContext *mpctx, const char *text) void term_osd_set_subs(struct MPContext *mpctx, const char *text)
{ {
if (mpctx->video_out || !text) if (mpctx->video_out || !text || !mpctx->opts->subs_rend->sub_visibility)
text = ""; // disable text = ""; // disable
if (strcmp(mpctx->term_osd_subs ? mpctx->term_osd_subs : "", text) == 0) if (strcmp(mpctx->term_osd_subs ? mpctx->term_osd_subs : "", text) == 0)
return; return;

View File

@ -367,7 +367,7 @@ char *sub_get_text(struct dec_sub *sub, double pts)
sub->last_vo_pts = pts; sub->last_vo_pts = pts;
update_segment(sub); update_segment(sub);
if (opts->sub_visibility && sub->sd->driver->get_text) if (sub->sd->driver->get_text)
text = sub->sd->driver->get_text(sub->sd, pts); text = sub->sd->driver->get_text(sub->sd, pts);
pthread_mutex_unlock(&sub->lock); pthread_mutex_unlock(&sub->lock);
return text; return text;