From c6369933f1d9cd204b09be95ef7d4ed1351610e2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 14 May 2020 22:14:49 +0200 Subject: command: add property to return text subtitles in ASS See manpage additions. This was requested, sort of. Although what has been requested might be something completely different. So this is speculative. This also changes sub_get_text() to return an allocated copy, because the buffer shit was too damn messy. --- player/sub.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'player/sub.c') diff --git a/player/sub.c b/player/sub.c index a40a6d5e9d..ae2a85ac1c 100644 --- a/player/sub.c +++ b/player/sub.c @@ -105,8 +105,11 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts, return false; // Handle displaying subtitles on terminal; never done for secondary subs - if (mpctx->current_track[0][STREAM_SUB] == track && !mpctx->video_out) - term_osd_set_subs(mpctx, sub_get_text(dec_sub, video_pts)); + if (mpctx->current_track[0][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); + talloc_free(text); + } // Handle displaying subtitles on VO with no video being played. This is // quite different, because normally subtitles are redrawn on new video -- cgit v1.2.3