diff options
Diffstat (limited to 'sub')
-rw-r--r-- | sub/ass_mp.c | 3 | ||||
-rw-r--r-- | sub/dec_sub.c | 25 | ||||
-rw-r--r-- | sub/dec_sub.h | 7 | ||||
-rw-r--r-- | sub/find_subfiles.c | 1 | ||||
-rw-r--r-- | sub/osd_font.otf | bin | 0 -> 2276 bytes | |||
-rw-r--r-- | sub/osd_font.pfb | bin | 8322 -> 0 bytes | |||
-rw-r--r-- | sub/osd_libass.c | 6 | ||||
-rw-r--r-- | sub/sd.h | 1 | ||||
-rw-r--r-- | sub/sd_ass.c | 17 | ||||
-rw-r--r-- | sub/sd_lavc.c | 35 | ||||
-rw-r--r-- | sub/sub.c | 1 | ||||
-rw-r--r-- | sub/sub.h | 1 | ||||
-rw-r--r-- | sub/subassconvert.c | 197 | ||||
-rw-r--r-- | sub/subreader.c | 17 | ||||
-rw-r--r-- | sub/subreader.h | 1 |
15 files changed, 253 insertions, 59 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 35883da84b..497e307953 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -69,6 +69,9 @@ void mp_ass_set_style(ASS_Style *style, struct osd_style_opts *opts) style->MarginV = opts->margin_y * scale; style->ScaleX = 1.; style->ScaleY = 1.; +#if LIBASS_VERSION >= 0x01020000 + style->Blur = opts->blur; +#endif } ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts) diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 4e703e7dc0..d3cedea80d 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -30,17 +30,36 @@ extern const struct sd_functions sd_ass; extern const struct sd_functions sd_lavc; +bool is_text_sub(const char *t) +{ + return t && (is_ass_sub(t) || + strcmp(t, "text") == 0 || + strcmp(t, "subrip") == 0 || + strcmp(t, "mov_text") == 0); +} + +bool is_ass_sub(const char *t) +{ + return t && (strcmp(t, "ass") == 0 || + strcmp(t, "ssa") == 0); +} + +bool is_dvd_sub(const char *t) +{ + return t && strcmp(t, "dvd_subtitle") == 0; +} + void sub_init(struct sh_sub *sh, struct osd_state *osd) { struct MPOpts *opts = sh->opts; assert(!osd->sh_sub); + if (sd_lavc.probe(sh)) + sh->sd_driver = &sd_lavc; #ifdef CONFIG_ASS - if (opts->ass_enabled && is_text_sub(sh->type)) + if (opts->ass_enabled && sd_ass.probe(sh)) sh->sd_driver = &sd_ass; #endif - if (strchr("bpxv", sh->type)) - sh->sd_driver = &sd_lavc; if (sh->sd_driver) { if (sh->sd_driver->init(sh, osd) < 0) return; diff --git a/sub/dec_sub.h b/sub/dec_sub.h index f66f05c021..593eac1e03 100644 --- a/sub/dec_sub.h +++ b/sub/dec_sub.h @@ -10,10 +10,9 @@ struct sh_sub; struct ass_track; struct MPOpts; -static inline bool is_text_sub(int type) -{ - return type == 't' || type == 'm' || type == 'a'; -} +bool is_text_sub(const char *t); +bool is_ass_sub(const char *t); +bool is_dvd_sub(const char *t); void sub_decode(struct sh_sub *sh, struct osd_state *osd, void *data, int data_len, double pts, double duration); diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index aa8df2ea49..e77015114b 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -69,7 +69,6 @@ static struct bstr guess_lang_from_filename(struct bstr name) struct sub_list { struct subfn subs[MAX_SUBTITLE_FILES]; - int sid; void *ctx; }; diff --git a/sub/osd_font.otf b/sub/osd_font.otf Binary files differnew file mode 100644 index 0000000000..d8ebec0ad8 --- /dev/null +++ b/sub/osd_font.otf diff --git a/sub/osd_font.pfb b/sub/osd_font.pfb Binary files differdeleted file mode 100644 index a4a65a143b..0000000000 --- a/sub/osd_font.pfb +++ /dev/null diff --git a/sub/osd_libass.c b/sub/osd_libass.c index e359501dc9..495bce2b73 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -54,6 +54,12 @@ void osd_init_backend(struct osd_state *osd) void osd_destroy_backend(struct osd_state *osd) { + for (int n = 0; n < MAX_OSD_PARTS; n++) { + struct osd_object *obj = osd->objs[n]; + if (obj->osd_track) + ass_free_track(obj->osd_track); + obj->osd_track = NULL; + } if (osd->osd_render) ass_renderer_done(osd->osd_render); osd->osd_render = NULL; @@ -4,6 +4,7 @@ #include "dec_sub.h" struct sd_functions { + bool (*probe)(struct sh_sub *sh); int (*init)(struct sh_sub *sh, struct osd_state *osd); void (*decode)(struct sh_sub *sh, struct osd_state *osd, void *data, int data_len, double pts, double duration); diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 00f2f8d796..8d17835809 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -41,6 +41,11 @@ struct sd_ass_priv { bool flush_on_seek; }; +static bool probe(struct sh_sub *sh) +{ + return is_text_sub(sh->gsh->codec); +} + static void free_last_event(ASS_Track *track) { assert(track->n_events > 0); @@ -51,13 +56,14 @@ static void free_last_event(ASS_Track *track) static int init(struct sh_sub *sh, struct osd_state *osd) { struct sd_ass_priv *ctx; + bool ass = is_ass_sub(sh->gsh->codec); if (sh->initialized) { ctx = sh->context; } else { ctx = talloc_zero(NULL, struct sd_ass_priv); sh->context = ctx; - if (sh->type == 'a') { + if (ass) { ctx->ass_track = ass_new_track(osd->ass_library); if (sh->extradata) ass_process_codec_private(ctx->ass_track, sh->extradata, @@ -66,7 +72,7 @@ static int init(struct sh_sub *sh, struct osd_state *osd) ctx->ass_track = mp_ass_default_track(osd->ass_library, sh->opts); } - ctx->vsfilter_aspect = sh->type == 'a'; + ctx->vsfilter_aspect = ass; return 0; } @@ -77,7 +83,7 @@ static void decode(struct sh_sub *sh, struct osd_state *osd, void *data, struct sd_ass_priv *ctx = sh->context; ASS_Track *track = ctx->ass_track; - if (sh->type == 'a') { // ssa/ass subs + if (is_ass_sub(sh->gsh->codec)) { if (bstr_startswith0((bstr){data, data_len}, "Dialogue: ")) { // broken ffmpeg ASS packet format ctx->flush_on_seek = true; @@ -177,6 +183,7 @@ static void uninit(struct sh_sub *sh) } const struct sd_functions sd_ass = { + .probe = probe, .init = init, .decode = decode, .get_bitmaps = get_bitmaps, @@ -199,7 +206,9 @@ struct sh_sub *sd_ass_create_from_track(struct ass_track *track, talloc_set_destructor(sh, sd_ass_track_destructor); *sh = (struct sh_sub) { .opts = opts, - .type = 'a', + .gsh = talloc_struct(sh, struct sh_stream, { + .codec = "ass", + }), .sd_driver = &sd_ass, .context = talloc_struct(sh, struct sd_ass_priv, { .ass_track = track, diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index e3f7af408a..1665e36749 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -22,6 +22,7 @@ #include "talloc.h" #include "core/mp_msg.h" +#include "core/av_common.h" #include "demux/stheader.h" #include "sd.h" #include "dec_sub.h" @@ -40,9 +41,24 @@ struct sd_lavc_priv { double endpts; }; -static void guess_resolution(char type, int *w, int *h) +static bool probe(struct sh_sub *sh) { - if (type == 'v') { + enum AVCodecID cid = mp_codec_to_av_codec_id(sh->gsh->codec); + // Supported codecs must be known to decode to paletted bitmaps + switch (cid) { + case AV_CODEC_ID_DVB_SUBTITLE: + case AV_CODEC_ID_HDMV_PGS_SUBTITLE: + case AV_CODEC_ID_XSUB: + case AV_CODEC_ID_DVD_SUBTITLE: + return true; + default: + return false; + } +} + +static void guess_resolution(enum AVCodecID type, int *w, int *h) +{ + if (type == AV_CODEC_ID_DVD_SUBTITLE) { /* XXX Although the video frame is some size, the SPU frame is always maximum size i.e. 720 wide and 576 or 480 high */ // For HD files in MKV the VobSub resolution can be higher though, @@ -65,17 +81,7 @@ static int init(struct sh_sub *sh, struct osd_state *osd) if (sh->initialized) return 0; struct sd_lavc_priv *priv = talloc_zero(NULL, struct sd_lavc_priv); - enum AVCodecID cid = AV_CODEC_ID_NONE; - switch (sh->type) { - case 'b': - cid = AV_CODEC_ID_DVB_SUBTITLE; break; - case 'p': - cid = AV_CODEC_ID_HDMV_PGS_SUBTITLE; break; - case 'x': - cid = AV_CODEC_ID_XSUB; break; - case 'v': - cid = AV_CODEC_ID_DVD_SUBTITLE; break; - } + enum AVCodecID cid = mp_codec_to_av_codec_id(sh->gsh->codec); AVCodecContext *ctx = NULL; AVCodec *sub_codec = avcodec_find_decoder(cid); if (!sub_codec) @@ -194,7 +200,7 @@ static void get_bitmaps(struct sh_sub *sh, struct osd_state *osd, talloc_get_size(priv->inbitmaps)); int inw = priv->avctx->width; int inh = priv->avctx->height; - guess_resolution(sh->type, &inw, &inh); + guess_resolution(priv->avctx->codec_id, &inw, &inh); double xscale = (double) (d.w - d.ml - d.mr) / inw; double yscale = (double) (d.h - d.mt - d.mb) / inh; for (int i = 0; i < priv->count; i++) { @@ -235,6 +241,7 @@ static void uninit(struct sh_sub *sh) } const struct sd_functions sd_lavc = { + .probe = probe, .init = init, .decode = decode, .get_bitmaps = get_bitmaps, @@ -79,6 +79,7 @@ const struct m_sub_options osd_style_conf = { OPT_FLOATRANGE("spacing", spacing, 0, -10, 10), OPT_INTRANGE("margin-x", margin_x, 0, 0, 300), OPT_INTRANGE("margin-y", margin_y, 0, 0, 600), + OPT_FLOATRANGE("blur", blur, 0, 0, 20), {0} }, .size = sizeof(struct osd_style_opts), @@ -192,6 +192,7 @@ struct osd_style_opts { float spacing; int margin_x; int margin_y; + float blur; }; extern const struct m_sub_options osd_style_conf; diff --git a/sub/subassconvert.c b/sub/subassconvert.c index 1d05096c15..c665750682 100644 --- a/sub/subassconvert.c +++ b/sub/subassconvert.c @@ -55,6 +55,11 @@ static void append_text(struct line *dst, char *fmt, ...) va_end(va); } +static void append_text_n(struct line *dst, char *start, size_t length) +{ + append_text(dst, "%.*s", (int)length, start); +} + static int indexof(const char *s, int c) { char *f = strchr(s, c); @@ -88,7 +93,7 @@ static const struct tag_conv { {"<b>", "{\\b1}"}, {"</b>", "{\\b0}"}, {"<u>", "{\\u1}"}, {"</u>", "{\\u0}"}, {"<s>", "{\\s1}"}, {"</s>", "{\\s0}"}, - {"{", "\\{"}, {"}", "\\}"}, + {"}", "\\}"}, {"\r\n", "\\N"}, {"\n", "\\N"}, {"\r", "\\N"}, }; @@ -96,29 +101,155 @@ static const struct { char *s; uint32_t v; } subrip_web_colors[] = { - /* Named CSS3 colors in BGR format; a subset of those + /* Named CSS3 colors in RGB format; a subset of those at http://www.w3.org/TR/css3-color/#svg-color */ - {"aqua", 0xffff00}, - {"black", 0x000000}, - {"blue", 0xff0000}, - {"cyan", 0xffff00}, - {"fuchsia", 0xff00ff}, - {"gray", 0x808080}, - {"green", 0x008000}, - {"grey", 0x808080}, - {"lime", 0x00ff00}, - {"magenta", 0xff00ff}, - {"maroon", 0x000080}, - {"navy", 0x800000}, - {"olive", 0x008080}, - {"orange", 0x00a5ff}, - {"pink", 0xcbc0ff}, - {"purple", 0x800080}, - {"red", 0x0000ff}, - {"silver", 0xc0c0c0}, - {"teal", 0x808000}, - {"white", 0xffffff}, - {"yellow", 0x00ffff}, + {"aliceblue", 0xF0F8FF}, + {"antiquewhite", 0xFAEBD7}, + {"aqua", 0x00FFFF}, + {"aquamarine", 0x7FFFD4}, + {"azure", 0xF0FFFF}, + {"beige", 0xF5F5DC}, + {"bisque", 0xFFE4C4}, + {"black", 0x000000}, + {"blanchedalmond", 0xFFEBCD}, + {"blue", 0x0000FF}, + {"blueviolet", 0x8A2BE2}, + {"brown", 0xA52A2A}, + {"burlywood", 0xDEB887}, + {"cadetblue", 0x5F9EA0}, + {"chartreuse", 0x7FFF00}, + {"chocolate", 0xD2691E}, + {"coral", 0xFF7F50}, + {"cornflowerblue", 0x6495ED}, + {"cornsilk", 0xFFF8DC}, + {"crimson", 0xDC143C}, + {"cyan", 0x00FFFF}, + {"darkblue", 0x00008B}, + {"darkcyan", 0x008B8B}, + {"darkgoldenrod", 0xB8860B}, + {"darkgray", 0xA9A9A9}, + {"darkgreen", 0x006400}, + {"darkgrey", 0xA9A9A9}, + {"darkkhaki", 0xBDB76B}, + {"darkmagenta", 0x8B008B}, + {"darkolivegreen", 0x556B2F}, + {"darkorange", 0xFF8C00}, + {"darkorchid", 0x9932CC}, + {"darkred", 0x8B0000}, + {"darksalmon", 0xE9967A}, + {"darkseagreen", 0x8FBC8F}, + {"darkslateblue", 0x483D8B}, + {"darkslategray", 0x2F4F4F}, + {"darkslategrey", 0x2F4F4F}, + {"darkturquoise", 0x00CED1}, + {"darkviolet", 0x9400D3}, + {"deeppink", 0xFF1493}, + {"deepskyblue", 0x00BFFF}, + {"dimgray", 0x696969}, + {"dimgrey", 0x696969}, + {"dodgerblue", 0x1E90FF}, + {"firebrick", 0xB22222}, + {"floralwhite", 0xFFFAF0}, + {"forestgreen", 0x228B22}, + {"fuchsia", 0xFF00FF}, + {"gainsboro", 0xDCDCDC}, + {"ghostwhite", 0xF8F8FF}, + {"gold", 0xFFD700}, + {"goldenrod", 0xDAA520}, + {"gray", 0x808080}, + {"green", 0x008000}, + {"greenyellow", 0xADFF2F}, + {"grey", 0x808080}, + {"honeydew", 0xF0FFF0}, + {"hotpink", 0xFF69B4}, + {"indianred", 0xCD5C5C}, + {"indigo", 0x4B0082}, + {"ivory", 0xFFFFF0}, + {"khaki", 0xF0E68C}, + {"lavender", 0xE6E6FA}, + {"lavenderblush", 0xFFF0F5}, + {"lawngreen", 0x7CFC00}, + {"lemonchiffon", 0xFFFACD}, + {"lightblue", 0xADD8E6}, + {"lightcoral", 0xF08080}, + {"lightcyan", 0xE0FFFF}, + {"lightgoldenrodyellow", 0xFAFAD2}, + {"lightgray", 0xD3D3D3}, + {"lightgreen", 0x90EE90}, + {"lightgrey", 0xD3D3D3}, + {"lightpink", 0xFFB6C1}, + {"lightsalmon", 0xFFA07A}, + {"lightseagreen", 0x20B2AA}, + {"lightskyblue", 0x87CEFA}, + {"lightslategray", 0x778899}, + {"lightslategrey", 0x778899}, + {"lightsteelblue", 0xB0C4DE}, + {"lightyellow", 0xFFFFE0}, + {"lime", 0x00FF00}, + {"limegreen", 0x32CD32}, + {"linen", 0xFAF0E6}, + {"magenta", 0xFF00FF}, + {"maroon", 0x800000}, + {"mediumaquamarine", 0x66CDAA}, + {"mediumblue", 0x0000CD}, + {"mediumorchid", 0xBA55D3}, + {"mediumpurple", 0x9370DB}, + {"mediumseagreen", 0x3CB371}, + {"mediumslateblue", 0x7B68EE}, + {"mediumspringgreen", 0x00FA9A}, + {"mediumturquoise", 0x48D1CC}, + {"mediumvioletred", 0xC71585}, + {"midnightblue", 0x191970}, + {"mintcream", 0xF5FFFA}, + {"mistyrose", 0xFFE4E1}, + {"moccasin", 0xFFE4B5}, + {"navajowhite", 0xFFDEAD}, + {"navy", 0x000080}, + {"oldlace", 0xFDF5E6}, + {"olive", 0x808000}, + {"olivedrab", 0x6B8E23}, + {"orange", 0xFFA500}, + {"orangered", 0xFF4500}, + {"orchid", 0xDA70D6}, + {"palegoldenrod", 0xEEE8AA}, + {"palegreen", 0x98FB98}, + {"paleturquoise", 0xAFEEEE}, + {"palevioletred", 0xDB7093}, + {"papayawhip", 0xFFEFD5}, + {"peachpuff", 0xFFDAB9}, + {"peru", 0xCD853F}, + {"pink", 0xFFC0CB}, + {"plum", 0xDDA0DD}, + {"powderblue", 0xB0E0E6}, + {"purple", 0x800080}, + {"red", 0xFF0000}, + {"rosybrown", 0xBC8F8F}, + {"royalblue", 0x4169E1}, + {"saddlebrown", 0x8B4513}, + {"salmon", 0xFA8072}, + {"sandybrown", 0xF4A460}, + {"seagreen", 0x2E8B57}, + {"seashell", 0xFFF5EE}, + {"sienna", 0xA0522D}, + {"silver", 0xC0C0C0}, + {"skyblue", 0x87CEEB}, + {"slateblue", 0x6A5ACD}, + {"slategray", 0x708090}, + {"slategrey", 0x708090}, + {"snow", 0xFFFAFA}, + {"springgreen", 0x00FF7F}, + {"steelblue", 0x4682B4}, + {"tan", 0xD2B48C}, + {"teal", 0x008080}, + {"thistle", 0xD8BFD8}, + {"tomato", 0xFF6347}, + {"turquoise", 0x40E0D0}, + {"violet", 0xEE82EE}, + {"wheat", 0xF5DEB3}, + {"white", 0xFFFFFF}, + {"whitesmoke", 0xF5F5F5}, + {"yellow", 0xFFFF00}, + {"yellowgreen", 0x9ACD32}, }; #define SUBRIP_MAX_STACKED_FONT_TAGS 16 @@ -238,7 +369,10 @@ void subassconvert_subrip(const char *orig, char *dest, int dest_buffer_size) for (int i = 0; i < FF_ARRAY_ELEMS(subrip_web_colors); i++) { char *color = subrip_web_colors[i].s; if (bstrcasecmp(val, bstr0(color)) == 0) { - tag->color = subrip_web_colors[i].v; + uint32_t color = subrip_web_colors[i].v; + tag->color = ((color & 0xff) << 16) + | (color & 0xff00) + | ((color & 0xff0000) >> 16); found = 1; } } @@ -264,7 +398,7 @@ void subassconvert_subrip(const char *orig, char *dest, int dest_buffer_size) } else { // We didn't find any matching color mp_tmsg(MSGT_SUBREADER, MSGL_WARN, - "SubRip: unknown font color in subtitle: %s\n", + "SubRip: unknown font color in subtitle: >%s<\n", orig); append_text(&new_line, "{\\c}"); } @@ -288,6 +422,19 @@ void subassconvert_subrip(const char *orig, char *dest, int dest_buffer_size) sp++; line++; } + } else if (*line == '{') { + char *end = strchr(line, '}'); + if (line[1] == '\\' && end) { + // Likely ASS tag, pass them through + // Note that ASS tags like {something\an8} are legal too (i.e. + // the first character after '{' doesn't have to be '\'), but + // consider these fringe cases not worth supporting. + append_text_n(&new_line, line, end - line + 1); + line = end + 1; + } else { + append_text(&new_line, "\\{"); + line++; + } } /* Tag conversion code didn't match */ diff --git a/sub/subreader.c b/sub/subreader.c index bdcc79a64a..090cd0a8b4 100644 --- a/sub/subreader.c +++ b/sub/subreader.c @@ -386,14 +386,14 @@ static subtitle *sub_ass_read_line_subviewer(stream_t *st, subtitle *current, int a1, a2, a3, a4, b1, b2, b3, b4, j = 0; while (!current->text[0]) { - char line[LINE_LEN + 1], full_line[LINE_LEN + 1], sep; + char line[LINE_LEN + 1], full_line[LINE_LEN + 1]; int i; /* Parse SubRip header */ if (!stream_read_line(st, line, LINE_LEN, utf16)) return NULL; - if (sscanf(line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", - &a1, &a2, &a3, &sep, &a4, &b1, &b2, &b3, &sep, &b4) < 10) + if (sscanf(line, "%d:%d:%d%*1[,.:]%d --> %d:%d:%d%*1[,.:]%d", + &a1, &a2, &a3, &a4, &b1, &b2, &b3, &b4) < 8) continue; current->start = a1 * 360000 + a2 * 6000 + a3 * 100 + a4 / 10; @@ -450,7 +450,7 @@ static subtitle *sub_read_line_subviewer(stream_t *st,subtitle *current, return sub_ass_read_line_subviewer(st, current, args); while (!current->text[0]) { if (!stream_read_line (st, line, LINE_LEN, utf16)) return NULL; - if ((len=sscanf (line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d",&a1,&a2,&a3,(char *)&i,&a4,&b1,&b2,&b3,(char *)&i,&b4)) < 10) + if ((len=sscanf (line, "%d:%d:%d%*1[,.:]%d --> %d:%d:%d%*1[,.:]%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8) continue; current->start = a1*360000+a2*6000+a3*100+a4/10; current->end = b1*360000+b2*6000+b3*100+b4/10; @@ -1074,7 +1074,7 @@ static int sub_autodetect (stream_t* st, int *uses_time, int utf16) { {*uses_time=1;return SUB_MPL2;} if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d", &i, &i, &i, &i, &i, &i, &i, &i)==8) {*uses_time=1;return SUB_SUBRIP;} - if (sscanf (line, "%d:%d:%d%[,.:]%d --> %d:%d:%d%[,.:]%d", &i, &i, &i, (char *)&i, &i, &i, &i, &i, (char *)&i, &i)==10) + if (sscanf (line, "%d:%d:%d%*1[,.:]%d --> %d:%d:%d%*1[,.:]%d", &i, &i, &i, &i, &i, &i, &i, &i) == 8) {*uses_time=1;return SUB_SUBVIEWER;} if (sscanf (line, "{T %d:%d:%d:%d",&i, &i, &i, &i)==4) {*uses_time=1;return SUB_SUBVIEWER2;} @@ -1324,8 +1324,8 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts) static const struct subreader sr[]= { { sub_read_line_microdvd, NULL, "microdvd" }, - { sub_read_line_subrip, NULL, "subrip" }, - { sub_read_line_subviewer, NULL, "subviewer" }, + { sub_read_line_subrip, NULL, "subviewer" }, + { sub_read_line_subviewer, NULL, "subrip" }, { sub_read_line_sami, NULL, "sami" }, { sub_read_line_vplayer, NULL, "vplayer" }, { sub_read_line_rt, NULL, "rt" }, @@ -1511,7 +1511,7 @@ if ((suboverlap_enabled == 2) || // from a block of sub_to_add+1 subs placeholder = malloc(sizeof(int *) * counter); for (i = 0; i < counter; ++i) { - placeholder[i] = malloc(sizeof(int) * lines_to_add); + placeholder[i] = malloc(sizeof(int) * lines_to_add + 1); for (j = 0; j < lines_to_add; ++j) { placeholder[i][j] = -1; } @@ -1684,6 +1684,7 @@ if ((suboverlap_enabled == 2) || if (return_sub == NULL) return NULL; subt_data = talloc_zero(NULL, sub_data); talloc_set_destructor(subt_data, sub_destroy); + subt_data->codec = srp->name; subt_data->filename = strdup(filename); subt_data->sub_uses_time = uses_time; subt_data->sub_num = sub_num; diff --git a/sub/subreader.h b/sub/subreader.h index 4584f2366a..7a2316bdf1 100644 --- a/sub/subreader.h +++ b/sub/subreader.h @@ -72,6 +72,7 @@ typedef struct subtitle { } subtitle; typedef struct sub_data { + const char *codec; subtitle *subtitles; char *filename; int sub_uses_time; |