summaryrefslogtreecommitdiff
path: root/sub
diff options
context:
space:
mode:
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c4
-rw-r--r--sub/dec_sub.c2
-rw-r--r--sub/lavc_conv.c7
-rw-r--r--sub/osd_libass.c7
-rw-r--r--sub/sd_ass.c6
5 files changed, 20 insertions, 6 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 7006d53..03cc557 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -109,8 +109,8 @@ static const int map_ass_level[] = {
MSGL_INFO,
MSGL_V,
MSGL_V,
- MSGL_V, // 5 application recommended level
- MSGL_DEBUG,
+ MSGL_DEBUG, // 5 application recommended level
+ MSGL_TRACE,
MSGL_TRACE, // 7 "verbose DEBUG"
};
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 743a06e..11ab879 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -203,7 +203,7 @@ void sub_preload(struct dec_sub *sub)
static bool is_new_segment(struct dec_sub *sub, struct demux_packet *p)
{
- return p->new_segment &&
+ return p->segmented &&
(p->start != sub->start || p->end != sub->end || p->codec != sub->codec);
}
diff --git a/sub/lavc_conv.c b/sub/lavc_conv.c
index 0f3b18e..06b9756 100644
--- a/sub/lavc_conv.c
+++ b/sub/lavc_conv.c
@@ -57,12 +57,13 @@ static const char *get_lavc_format(const char *format)
// 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, bstr0("\nStyle: "));
+ int n = bstr_find(header, style);
if (n < 0)
break;
header.start[n + 1] = '#'; // turn into a comment
- header = bstr_cut(header, 2);
+ header = bstr_cut(header, n + style.len);
}
}
@@ -237,6 +238,8 @@ char **lavc_conv_decode(struct lavc_conv *priv, struct demux_packet *packet)
avsubtitle_free(&priv->cur);
mp_set_av_packet(&pkt, packet, &avctx->time_base);
+ if (pkt.pts < 0)
+ pkt.pts = 0;
if (strcmp(priv->codec, "webvtt-webm") == 0) {
if (parse_webvtt(&pkt, &parsed_pkt) < 0) {
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 046007d..28a16d6 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -190,6 +190,7 @@ void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function)
static void mangle_ass(bstr *dst, const char *in)
{
+ const char *start = in;
bool escape_ass = true;
while (*in) {
// As used by osd_get_function_sym().
@@ -207,6 +208,12 @@ static void mangle_ass(bstr *dst, const char *in)
}
if (escape_ass && *in == '{')
bstr_xappend(NULL, dst, bstr0("\\"));
+ // Libass will strip leading whitespace
+ if (in[0] == ' ' && (in == start || in[-1] == '\n')) {
+ bstr_xappend(NULL, dst, bstr0("\\h"));
+ in += 1;
+ continue;
+ }
bstr_xappend(NULL, dst, (bstr){(char *)in, 1});
// Break ASS escapes with U+2060 WORD JOINER
if (escape_ass && *in == '\\')
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 8a21ea0..4bc9e15 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -87,10 +87,14 @@ static const char *const font_mimetypes[] = {
"application/vnd.ms-opentype",
"application/x-font-ttf",
"application/x-font", // probably incorrect
+ "font/collection",
+ "font/otf",
+ "font/sfnt",
+ "font/ttf",
NULL
};
-static const char *const font_exts[] = {".ttf", ".ttc", ".otf", NULL};
+static const char *const font_exts[] = {".ttf", ".ttc", ".otf", ".otc", NULL};
static bool attachment_is_font(struct mp_log *log, struct demux_attachment *f)
{