diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2014-08-12 11:49:18 +0200 |
---|---|---|
committer | Alessandro Ghedini <alessandro@ghedini.me> | 2014-08-12 11:49:18 +0200 |
commit | 82426933e01d05934635d2e50b910031515c2b40 (patch) | |
tree | a0aa4a294a1478761606898aab76ad11053a1025 /sub | |
parent | 5a7efa38ba0f5a971e375c01a7f4c5a572bbfe83 (diff) |
Imported Upstream version 0.5.0
Diffstat (limited to 'sub')
-rw-r--r-- | sub/ass_mp.c | 8 | ||||
-rw-r--r-- | sub/find_subfiles.c | 9 | ||||
-rw-r--r-- | sub/sd_microdvd.c | 1 | ||||
-rw-r--r-- | sub/sd_srt.c | 13 |
4 files changed, 14 insertions, 17 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 0217260..f5da319 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -132,18 +132,14 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts, ass_set_margins(priv, dim->mt, dim->mb, dim->ml, dim->mr); int set_use_margins = 0; -#if LIBASS_VERSION >= 0x01010000 int set_sub_pos = 0; -#endif float set_line_spacing = 0; float set_font_scale = 1; int set_hinting = 0; int set_force_override = 0; if (opts->ass_style_override) { set_use_margins = opts->ass_use_margins; -#if LIBASS_VERSION >= 0x01010000 set_sub_pos = 100 - opts->sub_pos; -#endif set_line_spacing = opts->ass_line_spacing; set_hinting = opts->ass_hinting; set_force_override = opts->ass_style_override == 3; @@ -177,7 +173,7 @@ void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts, struct mpv_global *global, struct mp_log *log) { void *tmp = talloc_new(NULL); - char *default_font = mp_find_user_config_file(tmp, global, "subfont.ttf"); + char *default_font = mp_find_config_file(tmp, global, "subfont.ttf"); char *config = mp_find_config_file(tmp, global, "fonts.conf"); if (default_font && !mp_path_exists(default_font)) @@ -249,7 +245,7 @@ static void message_callback(int level, const char *format, va_list va, void *ct ASS_Library *mp_ass_init(struct mpv_global *global, struct mp_log *log) { - char *path = mp_find_user_config_file(NULL, global, "fonts"); + char *path = mp_find_config_file(NULL, global, "fonts"); ASS_Library *priv = ass_library_init(); if (!priv) abort(); diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index a8d6348..b4132aa 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -1,16 +1,17 @@ #include <dirent.h> #include <string.h> +#include <strings.h> #include <stdlib.h> -#include <ctype.h> #include <assert.h> #include "osdep/io.h" +#include "common/common.h" #include "common/global.h" #include "common/msg.h" +#include "misc/ctype.h" #include "options/options.h" #include "options/path.h" -#include "common/common.h" #include "sub/find_subfiles.h" static const char *const sub_exts[] = {"utf", "utf8", "utf-8", "idx", "sub", "srt", @@ -75,7 +76,7 @@ static struct bstr guess_lang_from_filename(struct bstr name) if (name.start[i] == ')' || name.start[i] == ']') i--; - while (i >= 0 && isalpha(name.start[i])) { + while (i >= 0 && mp_isalpha(name.start[i])) { n++; if (n > 3) return (struct bstr){NULL, 0}; @@ -242,7 +243,7 @@ struct subfn *find_text_subtitles(struct mpv_global *global, const char *fname) } // Load subtitles in ~/.mpv/sub limiting sub fuzziness - char *mp_subdir = mp_find_user_config_file(NULL, global, "sub/"); + char *mp_subdir = mp_find_config_file(NULL, global, "sub/"); if (mp_subdir) append_dir_subtitles(global, &slist, &n, bstr0(mp_subdir), fname, 1); talloc_free(mp_subdir); diff --git a/sub/sd_microdvd.c b/sub/sd_microdvd.c index 6e6a9c3..5de9a18 100644 --- a/sub/sd_microdvd.c +++ b/sub/sd_microdvd.c @@ -24,7 +24,6 @@ #include <stdio.h> #include <stdarg.h> #include <stdbool.h> -#include <ctype.h> #include <libavutil/common.h> #include "common/msg.h" diff --git a/sub/sd_srt.c b/sub/sd_srt.c index 733a27d..160f865 100644 --- a/sub/sd_srt.c +++ b/sub/sd_srt.c @@ -19,16 +19,17 @@ */ #include <string.h> +#include <strings.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <stdbool.h> -#include <ctype.h> -#include <libavutil/common.h> +#include "common/common.h" #include "common/msg.h" #include "bstr/bstr.h" +#include "misc/ctype.h" #include "sd.h" struct line { @@ -259,7 +260,7 @@ static int read_attr(char **s, struct bstr *attr, struct bstr *val) attr->start = *s; attr->len = eq - *s; for (int i = 0; i < attr->len; i++) - if (!isalnum(attr->start[i])) + if (!mp_isalnum(attr->start[i])) return -1; val->start = eq + 1; bool quoted = val->start[0] == '"'; @@ -290,7 +291,7 @@ static void convert_subrip(struct sd *sd, const char *orig, while (*line && new_line.len < new_line.bufsize - 1) { char *orig_line = line; - for (int i = 0; i < FF_ARRAY_ELEMS(subrip_basic_tags); i++) { + for (int i = 0; i < MP_ARRAY_SIZE(subrip_basic_tags); i++) { const struct tag_conv *tag = &subrip_basic_tags[i]; int from_len = strlen(tag->from); if (strncmp(line, tag->from, from_len) == 0) { @@ -331,7 +332,7 @@ static void convert_subrip(struct sd *sd, const char *orig, } } } else if (strncmp(line, "<font ", 6) == 0 - && sp + 1 < FF_ARRAY_ELEMS(font_stack)) { + && sp + 1 < MP_ARRAY_SIZE(font_stack)) { /* Opening font tag */ char *potential_font_tag_start = line; int len_backup = new_line.len; @@ -360,7 +361,7 @@ static void convert_subrip(struct sd *sd, const char *orig, int found = 0; // Try to lookup the string in standard web colors - for (int i = 0; i < FF_ARRAY_ELEMS(subrip_web_colors); i++) { + for (int i = 0; i < MP_ARRAY_SIZE(subrip_web_colors); i++) { char *color = subrip_web_colors[i].s; if (bstrcasecmp(val, bstr0(color)) == 0) { uint32_t xcolor = subrip_web_colors[i].v; |