From 4d3df1c842532e3a48578ab6daef39076289c8ef Mon Sep 17 00:00:00 2001 From: TheAMM Date: Sat, 29 May 2021 01:28:15 +0300 Subject: recorder: add support for attachments (fonts) Though, only when the output format is matroska, to avoid muxing errors. This is quite useful when the input has ASS subtitles, as they tend to rely on embedded fonts. --- player/loadfile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/loadfile.c b/player/loadfile.c index 6032cf6193..e992df694f 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1959,11 +1959,18 @@ void open_recorder(struct MPContext *mpctx, bool on_init) MP_TARRAY_APPEND(NULL, streams, num_streams, track->stream); } + struct demux_attachment **attachments = talloc_array(NULL, struct demux_attachment*, mpctx->demuxer->num_attachments); + for (int n = 0; n < mpctx->demuxer->num_attachments; n++) { + attachments[n] = &mpctx->demuxer->attachments[n]; + } + mpctx->recorder = mp_recorder_create(mpctx->global, mpctx->opts->record_file, - streams, num_streams); + streams, num_streams, + attachments, mpctx->demuxer->num_attachments); if (!mpctx->recorder) { talloc_free(streams); + talloc_free(attachments); close_recorder_and_error(mpctx); return; } @@ -1987,5 +1994,6 @@ void open_recorder(struct MPContext *mpctx, bool on_init) } talloc_free(streams); + talloc_free(attachments); } -- cgit v1.2.3