path: root/player/sub.c
diff options
authorwm4 <wm4@nowhere>2020-05-14 22:14:49 +0200
committerwm4 <wm4@nowhere>2020-05-14 22:14:49 +0200
commitc6369933f1d9cd204b09be95ef7d4ed1351610e2 (patch)
treed7b45307780aef2dafde89795f49d564c7aed313 /player/sub.c
parent0049ea38be72884fabeee3ce52e2d6796c3abd53 (diff)
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.
Diffstat (limited to 'player/sub.c')
1 files changed, 5 insertions, 2 deletions
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