mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 03:32:50 +00:00
sub/lavc_conv: don't strip ASS style header
This fixes converted subtitles that are styled.
This reverts commit 5e2c211a4e
.
Most of the subtitle decoders in libavcodec sets meaningful style
values. For the rest we can conditionally strip style.
This commit is contained in:
parent
4aa7588e44
commit
d8378dc226
@ -53,20 +53,6 @@ static const char *get_lavc_format(const char *format)
|
||||
return format;
|
||||
}
|
||||
|
||||
// Disable style definitions generated by the libavcodec converter.
|
||||
// We always want the user defined style instead.
|
||||
static void disable_styles(bstr header)
|
||||
{
|
||||
bstr style = bstr0("\nStyle: ");
|
||||
while (header.len) {
|
||||
int n = bstr_find(header, style);
|
||||
if (n < 0)
|
||||
break;
|
||||
header.start[n + 1] = '#'; // turn into a comment
|
||||
header = bstr_cut(header, n + style.len);
|
||||
}
|
||||
}
|
||||
|
||||
struct lavc_conv *lavc_conv_create(struct sd *sd)
|
||||
{
|
||||
struct lavc_conv *priv = talloc_zero(NULL, struct lavc_conv);
|
||||
@ -116,7 +102,6 @@ struct lavc_conv *lavc_conv_create(struct sd *sd)
|
||||
priv->avctx = avctx;
|
||||
priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
|
||||
avctx->subtitle_header_size);
|
||||
disable_styles(bstr0(priv->extradata));
|
||||
return priv;
|
||||
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user