diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 3e32c86e02cfb..17a32c7f8ef20 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -75,6 +75,7 @@ struct dec_sub { struct mp_codec_params *codec; double start, end; + char *lang; double last_vo_pts; struct sd *sd; @@ -171,6 +172,7 @@ static struct sd *init_decoder(struct dec_sub *sub) .order = sub->order, .attachments = sub->attachments, .codec = sub->codec, + .lang = sub->lang, .preload_ok = true, }; @@ -204,6 +206,7 @@ struct dec_sub *sub_create(struct mpv_global *global, struct track *track, .shared_opts_cache = m_config_cache_alloc(sub, global, &mp_subtitle_shared_sub_opts), .sh = track->stream, .codec = track->stream->codec, + .lang = track->lang, .attachments = talloc_steal(sub, attachments), .play_dir = 1, .order = order, diff --git a/sub/sd.h b/sub/sd.h index 8db7c41dd8dae..ccd472f9de959 100644 --- a/sub/sd.h +++ b/sub/sd.h @@ -29,6 +29,7 @@ struct sd { struct attachment_list *attachments; struct mp_codec_params *codec; + const char *lang; // Set to false as soon as the decoder discards old subtitle events. // (only needed if sd_functions.accept_packets_in_advance == false) diff --git a/sub/sd_sbr.c b/sub/sd_sbr.c index 58dce3b493288..3d7f595062480 100644 --- a/sub/sd_sbr.c +++ b/sub/sd_sbr.c @@ -148,7 +148,7 @@ static void decode(struct sd *sd, struct demux_packet *packet) packet->buffer, packet->len, fmt, - NULL + sd->lang ); // Since `demux_sbr` only ever sends us one packet,