summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2009-07-10 23:55:02 +0200
committerGrigori Goronzy <greg@blackbox>2009-07-11 00:03:56 +0200
commit613a22ab9b96453c10de6d75b43067652ad6d7db (patch)
tree76405fc5c113cb602f0778c85413fcb421aa127f /libass
parent9305f3815442f8c0bd735e96832b7f72628bfcad (diff)
downloadlibass-613a22ab9b96453c10de6d75b43067652ad6d7db.tar.bz2
libass-613a22ab9b96453c10de6d75b43067652ad6d7db.tar.xz
Replace string defines with real strings
Instead of referencing string defines from help_mp.h, use the strings directly in ass_msg. Consequently, help_mp.h is useless and can be deleted.
Diffstat (limited to 'libass')
-rw-r--r--libass/Makefile.am2
-rw-r--r--libass/ass.c75
-rw-r--r--libass/ass_bitmap.c6
-rw-r--r--libass/ass_cache.c3
-rw-r--r--libass/ass_drawing.c3
-rw-r--r--libass/ass_font.c25
-rw-r--r--libass/ass_fontconfig.c67
-rw-r--r--libass/ass_render.c81
-rw-r--r--libass/ass_utils.c3
-rw-r--r--libass/ass_utils.h2
-rw-r--r--libass/help_mp.h55
11 files changed, 131 insertions, 191 deletions
diff --git a/libass/Makefile.am b/libass/Makefile.am
index 81b8b96..4f84699 100644
--- a/libass/Makefile.am
+++ b/libass/Makefile.am
@@ -7,7 +7,7 @@ libass_la_SOURCES = ass.c ass_cache.c ass_font.c ass_fontconfig.c ass_render.c \
ass_utils.c ass_bitmap.c ass_library.c ass_bitmap.h \
ass_cache.h ass_fontconfig.h ass_font.h ass.h \
ass_library.h ass_types.h ass_utils.h ass_drawing.c \
- ass_drawing.h help_mp.h
+ ass_drawing.h
libass_la_LDFLAGS = -version-info $(LIBASS_LT_CURRENT):$(LIBASS_LT_REVISION):$(LIBASS_LT_AGE)
libass_la_LDFLAGS += -export-symbols $(srcdir)/libass.sym
diff --git a/libass/ass.c b/libass/ass.c
index 5aef144..135232f 100644
--- a/libass/ass.c
+++ b/libass/ass.c
@@ -182,8 +182,9 @@ static int lookup_style(ass_track_t *track, char *name)
return i;
}
i = track->default_style;
- ass_msg(MSGL_WARN, MSGTR_LIBASS_NoStyleNamedXFoundUsingY,
- track, name, track->styles[i].Name);
+ ass_msg(MSGL_WARN,
+ "[%p]: Warning: no style named '%s' found, using '%s'",
+ track, name, track->styles[i].Name);
return i; // use the first style
}
@@ -200,7 +201,7 @@ static long long string2timecode(char *p)
long long tm;
int res = sscanf(p, "%1d:%2d:%2d.%2d", &h, &m, &s, &ms);
if (res < 4) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_BadTimestamp);
+ ass_msg(MSGL_WARN, "Bad timestamp");
return 0;
}
tm = ((h * 60 + m) * 60 + s) * 1000 + ms * 10;
@@ -228,13 +229,13 @@ static int numpad2align(int val)
#define ANYVAL(name,func) \
} else if (strcasecmp(tname, #name) == 0) { \
target->name = func(token); \
- ass_msg(MSGL_DBG2, "%s = %s\n", #name, token);
+ ass_msg(MSGL_DBG2, "%s = %s", #name, token);
#define STRVAL(name) \
} else if (strcasecmp(tname, #name) == 0) { \
if (target->name != NULL) free(target->name); \
target->name = strdup(token); \
- ass_msg(MSGL_DBG2, "%s = %s\n", #name, token);
+ ass_msg(MSGL_DBG2, "%s = %s", #name, token);
#define COLORVAL(name) ANYVAL(name,string2color)
#define INTVAL(name) ANYVAL(name,atoi)
@@ -243,7 +244,7 @@ static int numpad2align(int val)
#define STYLEVAL(name) \
} else if (strcasecmp(tname, #name) == 0) { \
target->name = lookup_style(track, token); \
- ass_msg(MSGL_DBG2, "%s = %s\n", #name, token);
+ ass_msg(MSGL_DBG2, "%s = %s", #name, token);
#define ALIAS(alias,name) \
if (strcasecmp(tname, #alias) == 0) {tname = #name;}
@@ -317,7 +318,7 @@ static int process_event_tail(ass_track_t *track, ass_event_t *event,
if (last >= event->Text && *last == '\r')
*last = 0;
}
- ass_msg(MSGL_DBG2, "Text = %s\n", event->Text);
+ ass_msg(MSGL_DBG2, "Text = %s", event->Text);
event->Duration -= event->Start;
free(format);
return 0; // "Text" is always the last
@@ -457,7 +458,7 @@ static int process_style(ass_track_t *track, char *str)
q = format = strdup(track->style_format);
- ass_msg(MSGL_V, "[%p] Style: %s\n", track, str);
+ ass_msg(MSGL_V, "[%p] Style: %s", track, str);
sid = ass_alloc_style(track);
@@ -534,7 +535,7 @@ static int process_styles_line(ass_track_t *track, char *str)
char *p = str + 7;
skip_spaces(&p);
track->style_format = strdup(p);
- ass_msg(MSGL_DBG2, "Style format: %s\n",
+ ass_msg(MSGL_DBG2, "Style format: %s",
track->style_format);
} else if (!strncmp(str, "Style:", 6)) {
char *p = str + 6;
@@ -571,7 +572,7 @@ static void event_format_fallback(ass_track_t *track)
track->event_format =
strdup
("Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text");
- ass_msg(MSGL_V, "No event format found, using fallback.\n");
+ ass_msg(MSGL_V, "No event format found, using fallback");
}
static int process_events_line(ass_track_t *track, char *str)
@@ -580,8 +581,7 @@ static int process_events_line(ass_track_t *track, char *str)
char *p = str + 7;
skip_spaces(&p);
track->event_format = strdup(p);
- ass_msg(MSGL_DBG2, "Event format: %s\n",
- track->event_format);
+ ass_msg(MSGL_DBG2, "Event format: %s", track->event_format);
} else if (!strncmp(str, "Dialogue:", 9)) {
// This should never be reached for embedded subtitles.
// They have slightly different format and are parsed in ass_process_chunk,
@@ -601,7 +601,7 @@ static int process_events_line(ass_track_t *track, char *str)
process_event_tail(track, event, str, 0);
} else {
- ass_msg(MSGL_V, "Not understood: %s \n", str);
+ ass_msg(MSGL_V, "Not understood: '%s'", str);
}
return 0;
}
@@ -636,11 +636,11 @@ static int decode_font(ass_track_t *track)
int dsize; // decoded size
unsigned char *buf = 0;
- ass_msg(MSGL_V, "font: %d bytes encoded data \n",
+ ass_msg(MSGL_V, "Font: %d bytes encoded data",
track->parser_priv->fontdata_used);
size = track->parser_priv->fontdata_used;
if (size % 4 == 1) {
- ass_msg(MSGL_ERR, MSGTR_LIBASS_BadEncodedDataSize);
+ ass_msg(MSGL_ERR, "Bad encoded data size");
goto error_decode_font;
}
buf = malloc(size / 4 * 3 + 2);
@@ -686,19 +686,19 @@ static int process_fonts_line(ass_track_t *track, char *str)
decode_font(track);
}
track->parser_priv->fontname = strdup(p);
- ass_msg(MSGL_V, "fontname: %s\n",
+ ass_msg(MSGL_V, "Fontname: %s",
track->parser_priv->fontname);
return 0;
}
if (!track->parser_priv->fontname) {
- ass_msg(MSGL_V, "Not understood: %s \n", str);
+ ass_msg(MSGL_V, "Not understood: '%s'", str);
return 0;
}
len = strlen(str);
if (len > 80) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FontLineTooLong, len, str);
+ ass_msg(MSGL_WARN, "Font line too long: %d, %s", len, str);
return 0;
}
if (track->parser_priv->fontdata_used + len >
@@ -801,7 +801,7 @@ void ass_process_data(ass_track_t *track, char *data, int size)
memcpy(str, data, size);
str[size] = '\0';
- ass_msg(MSGL_V, "event: %s\n", str);
+ ass_msg(MSGL_V, "Event: %s", str);
process_text(track, str);
free(str);
}
@@ -852,14 +852,14 @@ void ass_process_chunk(ass_track_t *track, char *data, int size,
ass_event_t *event;
if (!track->event_format) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_EventFormatHeaderMissing);
+ ass_msg(MSGL_WARN, "Event format header missing");
return;
}
str = malloc(size + 1);
memcpy(str, data, size);
str[size] = '\0';
- ass_msg(MSGL_V, "event at %" PRId64 ", +%" PRId64 ": %s \n",
+ ass_msg(MSGL_V, "Event at %" PRId64 ", +%" PRId64 ": %s",
(int64_t) timecode, (int64_t) duration, str);
eid = ass_alloc_event(track);
@@ -918,10 +918,9 @@ static char *sub_recode(char *data, size_t size, char *codepage)
}
#endif
if ((icdsc = iconv_open(tocp, cp_tmp)) != (iconv_t) (-1)) {
- ass_msg(MSGL_V, "LIBSUB: opened iconv descriptor.\n");
+ ass_msg(MSGL_V, "Opened iconv descriptor");
} else
- ass_msg(MSGL_ERR,
- MSGTR_LIBASS_ErrorOpeningIconvDescriptor);
+ ass_msg(MSGL_ERR, "Error opening iconv descriptor");
}
{
@@ -952,8 +951,7 @@ static char *sub_recode(char *data, size_t size, char *codepage)
osize += size;
oleft += size;
} else {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_ErrorRecodingFile);
+ ass_msg(MSGL_WARN, "Error recoding file");
return NULL;
}
} else if (clear)
@@ -965,7 +963,7 @@ static char *sub_recode(char *data, size_t size, char *codepage)
if (icdsc != (iconv_t) (-1)) {
(void) iconv_close(icdsc);
icdsc = (iconv_t) (-1);
- ass_msg(MSGL_V, "LIBSUB: closed iconv descriptor.\n");
+ ass_msg(MSGL_V, "Closed iconv descriptor");
}
return outbuf;
@@ -987,12 +985,12 @@ static char *read_file(char *fname, size_t *bufsize)
FILE *fp = fopen(fname, "rb");
if (!fp) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FopenFailed, fname);
+ ass_msg(MSGL_WARN, "ass_read_file(%s): fopen failed", fname);
return 0;
}
res = fseek(fp, 0, SEEK_END);
if (res == -1) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FseekFailed, fname);
+ ass_msg(MSGL_WARN, "ass_read_file(%s): fseek failed", fname);
fclose(fp);
return 0;
}
@@ -1002,12 +1000,13 @@ static char *read_file(char *fname, size_t *bufsize)
if (sz > 10 * 1024 * 1024) {
ass_msg(MSGL_INFO,
- MSGTR_LIBASS_RefusingToLoadSubtitlesLargerThan10M, fname);
+ "ass_read_file(%s): Refusing to load subtitles "
+ "larger than 10MiB", fname);
fclose(fp);
return 0;
}
- ass_msg(MSGL_V, "file size: %ld\n", sz);
+ ass_msg(MSGL_V, "File size: %ld", sz);
buf = malloc(sz + 1);
assert(buf);
@@ -1015,8 +1014,8 @@ static char *read_file(char *fname, size_t *bufsize)
do {
res = fread(buf + bytes_read, 1, sz - bytes_read, fp);
if (res <= 0) {
- ass_msg(MSGL_INFO, MSGTR_LIBASS_ReadFailed, errno,
- strerror(errno));
+ ass_msg(MSGL_INFO, "Read failed, %d: %s", errno,
+ strerror(errno));
fclose(fp);
free(buf);
return 0;
@@ -1093,8 +1092,9 @@ ass_track_t *ass_read_memory(ass_library_t *library, char *buf,
if (!track)
return 0;
- ass_msg(MSGL_INFO, MSGTR_LIBASS_AddedSubtitleFileMemory,
- track->n_styles, track->n_events);
+ ass_msg(MSGL_INFO, "Added subtitle file: "
+ "<memory> (%d styles, %d events)",
+ track->n_styles, track->n_events);
return track;
}
@@ -1143,10 +1143,9 @@ ass_track_t *ass_read_file(ass_library_t *library, char *fname,
track->name = strdup(fname);
- ass_msg(MSGL_INFO, MSGTR_LIBASS_AddedSubtitleFileFname, fname,
- track->n_styles, track->n_events);
+ ass_msg(MSGL_INFO, "Added subtitle file: '%s' (%d styles, %d events)",
+ fname, track->n_styles, track->n_events);
-// dump_events(forced_tid);
return track;
}
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
index 140cca2..a72caad 100644
--- a/libass/ass_bitmap.c
+++ b/libass/ass_bitmap.c
@@ -173,7 +173,7 @@ static int check_glyph_area(FT_Glyph glyph)
dx = bbox.xMax - bbox.xMin;
dy = bbox.yMax - bbox.yMin;
if (dx * dy > 8000000) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_GlyphBBoxTooLarge,
+ ass_msg(MSGL_WARN, "Glyph bounding box too large: %dx%dpx",
(int) dx, (int) dy);
return 1;
} else
@@ -195,7 +195,7 @@ static bitmap_t *glyph_to_bitmap_internal(FT_Glyph glyph, int bord)
return 0;
error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 0);
if (error) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FT_Glyph_To_BitmapError,
+ ass_msg(MSGL_WARN, "FT_Glyph_To_Bitmap error %d",
error);
return 0;
}
@@ -203,7 +203,7 @@ static bitmap_t *glyph_to_bitmap_internal(FT_Glyph glyph, int bord)
bg = (FT_BitmapGlyph) glyph;
bit = &(bg->bitmap);
if (bit->pixel_mode != FT_PIXEL_MODE_GRAY) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_UnsupportedPixelMode,
+ ass_msg(MSGL_WARN, "Unsupported pixel mode: %d",
(int) (bit->pixel_mode));
FT_Done_Glyph(glyph);
return 0;
diff --git a/libass/ass_cache.c b/libass/ass_cache.c
index fc70b0d..adee0cc 100644
--- a/libass/ass_cache.c
+++ b/libass/ass_cache.c
@@ -73,7 +73,8 @@ void hashmap_done(hashmap_t *map)
// print stats
if (map->count > 0 || map->hit_count + map->miss_count > 0)
ass_msg(MSGL_V,
- "cache statistics: \n total accesses: %d\n hits: %d\n misses: %d\n object count: %d\n",
+ "cache statistics: \n total accesses: %d\n hits: %d\n "
+ "misses: %d\n object count: %d",
map->hit_count + map->miss_count, map->hit_count,
map->miss_count, map->count);
diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c
index 09cf2d0..c05a962 100644
--- a/libass/ass_drawing.c
+++ b/libass/ass_drawing.c
@@ -138,6 +138,9 @@ static void drawing_finish(ass_drawing_t *drawing)
drawing->scale_y);
for (i = 0; i < ol->n_points; i++)
ol->points[i].y += offset;
+
+ ass_msg(MSGL_V, "Parsed drawing with %d points and %d contours",
+ ol->n_points, ol->n_contours);
}
/*
diff --git a/libass/ass_font.c b/libass/ass_font.c
index 0aeeec6..76c4793 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -56,10 +56,10 @@ static void charmap_magic(FT_Face face)
if (!face->charmap) {
if (face->num_charmaps == 0) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_NoCharmaps);
+ ass_msg(MSGL_WARN, "Font face with no charmaps");
return;
}
- ass_msg(MSGL_WARN, MSGTR_LIBASS_NoCharmapAutodetected);
+ ass_msg(MSGL_WARN, "No charmap autodetected, trying the first one");
FT_Set_Charmap(face, face->charmaps[0]);
return;
}
@@ -140,16 +140,14 @@ static int add_face(void *fc_priv, ass_font_t *font, uint32_t ch)
font->library->fontdata[mem_idx].size, 0,
&face);
if (error) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_ErrorOpeningMemoryFont,
- path);
+ ass_msg(MSGL_WARN, "Error opening memory font: '%s'", path);
free(path);
return -1;
}
} else {
error = FT_New_Face(font->ftlibrary, path, index, &face);
if (error) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_ErrorOpeningFont, path,
- index);
+ ass_msg(MSGL_WARN, "Error opening font: '%s', %d", path, index);
free(path);
return -1;
}
@@ -387,16 +385,17 @@ FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ass_font_t *font,
if (index == 0) {
int face_idx;
ass_msg(MSGL_INFO,
- MSGTR_LIBASS_GlyphNotFoundReselectingFont, ch,
- font->desc.family, font->desc.bold, font->desc.italic);
+ "Glyph 0x%X not found, selecting one more "
+ "font for (%s, %d, %d)", ch, font->desc.family,
+ font->desc.bold, font->desc.italic);
face_idx = add_face(fontconfig_priv, font, ch);
if (face_idx >= 0) {
face = font->faces[face_idx];
index = FT_Get_Char_Index(face, ch);
if (index == 0) {
- ass_msg(MSGL_ERR, MSGTR_LIBASS_GlyphNotFound,
- ch, font->desc.family, font->desc.bold,
- font->desc.italic);
+ ass_msg(MSGL_ERR, "Glyph 0x%X not found in font "
+ "for (%s, %d, %d)", ch, font->desc.family,
+ font->desc.bold, font->desc.italic);
}
}
}
@@ -419,7 +418,7 @@ FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ass_font_t *font,
error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags);
if (error) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
+ ass_msg(MSGL_WARN, "Error loading glyph, index %d", index);
return 0;
}
#if (FREETYPE_MAJOR > 2) || \
@@ -433,7 +432,7 @@ FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ass_font_t *font,
#endif
error = FT_Get_Glyph(face->glyph, &glyph);
if (error) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
+ ass_msg(MSGL_WARN, "Error loading glyph, index %d", index);
return 0;
}
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index 2e6377a..e23c4f2 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -194,7 +194,8 @@ static char *_select_font(fc_instance_t *priv, const char *family,
!(r_family && strcasecmp((const char *) r_family, family) == 0) &&
!(r_fullname && strcasecmp((const char *) r_fullname, family) == 0))
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne,
+ "fontconfig: Selected font is not the requested one: "
+ "'%s' != '%s'",
(const char *) (r_fullname ? r_fullname : r_family), family);
result = FcPatternGetString(rpat, FC_STYLE, 0, &r_style);
@@ -214,8 +215,8 @@ static char *_select_font(fc_instance_t *priv, const char *family,
r_embolden = 0;
ass_msg(MSGL_V,
- "[ass] Font info: family '%s', style '%s', fullname '%s',"
- " slant %d, weight %d%s\n", (const char *) r_family,
+ "Font info: family '%s', style '%s', fullname '%s',"
+ " slant %d, weight %d%s", (const char *) r_family,
(const char *) r_style, (const char *) r_fullname, r_slant,
r_weight, r_embolden ? ", embolden" : "");
@@ -258,25 +259,28 @@ char *fontconfig_select(fc_instance_t *priv, const char *family,
_select_font(priv, priv->family_default, 0, bold, italic, index,
code);
if (res)
- ass_msg(MSGL_WARN, MSGTR_LIBASS_UsingDefaultFontFamily,
- family, bold, italic, res, *index);
+ ass_msg(MSGL_WARN, "fontconfig_select: Using default font "
+ "family: (%s, %d, %d) -> %s, %d",
+ family, bold, italic, res, *index);
}
if (!res && priv->path_default) {
res = priv->path_default;
*index = priv->index_default;
- ass_msg(MSGL_WARN, MSGTR_LIBASS_UsingDefaultFont,
- family, bold, italic, res, *index);
+ ass_msg(MSGL_WARN, "fontconfig_select: Using default font: "
+ "(%s, %d, %d) -> %s, %d", family, bold, italic,
+ res, *index);
}
if (!res) {
res = _select_font(priv, "Arial", 0, bold, italic, index, code);
if (res)
- ass_msg(MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily,
- family, bold, italic, res, *index);
+ ass_msg(MSGL_WARN, "fontconfig_select: Using 'Arial' font "
+ "family: (%s, %d, %d) -> %s, %d", family, bold, italic,
+ res, *index);
}
if (res)
ass_msg(MSGL_V,
- "fontconfig_select: (%s, %d, %d) -> %s, %d\n", family, bold,
- italic, res, *index);
+ "fontconfig_select: (%s, %d, %d) -> %s, %d", family, bold,
+ italic, res, *index);
return res;
}
@@ -350,11 +354,11 @@ static void process_fontdata(fc_instance_t *priv, ass_library_t *library,
res = mkdir(fonts_dir);
#endif
if (res) {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FailedToCreateDirectory, fonts_dir);
+ ass_msg(MSGL_WARN, "Failed to create directory '%s'",
+ fonts_dir);
}
} else if (!S_ISDIR(st.st_mode)) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_NotADirectory, fonts_dir);
+ ass_msg(MSGL_WARN, "Not a directory: '%s'", fonts_dir);
}
fname = validate_fname((char *) name);
@@ -380,7 +384,7 @@ static void process_fontdata(fc_instance_t *priv, ass_library_t *library,
rc = FT_New_Memory_Face(ftlibrary, (unsigned char *) data,
data_size, face_index, &face);
if (rc) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_ErrorOpeningMemoryFont,
+ ass_msg(MSGL_WARN, "Error opening memory font: %s",
name);
return;
}
@@ -390,24 +394,21 @@ static void process_fontdata(fc_instance_t *priv, ass_library_t *library,
FcFreeTypeQueryFace(face, (unsigned char *) name, 0,
FcConfigGetBlanks(priv->config));
if (!pattern) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FunctionCallFailed,
- "FcFreeTypeQueryFace");
+ ass_msg(MSGL_WARN, "%s failed", "FcFreeTypeQueryFace");
FT_Done_Face(face);
return;
}
fset = FcConfigGetFonts(priv->config, FcSetSystem); // somehow it failes when asked for FcSetApplication
if (!fset) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FunctionCallFailed,
- "FcConfigGetFonts");
+ ass_msg(MSGL_WARN, "%s failed", "FcConfigGetFonts");
FT_Done_Face(face);
return;
}
res = FcFontSetAdd(fset, pattern);
if (!res) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FunctionCallFailed,
- "FcFontSetAdd");
+ ass_msg(MSGL_WARN, "%s failed", "FcFontSetAdd");
FT_Done_Face(face);
return;
}
@@ -436,7 +437,7 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
if (!fc) {
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
+ "Fontconfig disabled, only default font will be used.");
goto exit;
}
@@ -453,8 +454,7 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
}
if (!rc || !priv->config) {
- ass_msg(MSGL_FATAL,
- MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed);
+ ass_msg(MSGL_FATAL, "%s failed", "FcInitLoadConfigAndFonts");
goto exit;
}
@@ -463,10 +463,10 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
if (dir) {
if (FcDirCacheValid((const FcChar8 *) dir) == FcFalse) {
- ass_msg(MSGL_INFO, MSGTR_LIBASS_UpdatingFontCache);
+ ass_msg(MSGL_INFO, "Updating font cache");
if (FcGetVersion() >= 20390 && FcGetVersion() < 20400)
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_BetaVersionsOfFontconfigAreNotSupported);
+ ass_msg(MSGL_WARN, "Beta versions of fontconfig are not "
+ "supported. Update before reporting any bugs");
// FontConfig >= 2.4.0 updates cache automatically in FcConfigAppFontAddDir()
if (FcGetVersion() < 20390) {
FcFontSet *fcs;
@@ -475,8 +475,7 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
fss = FcStrSetCreate();
rc = FcStrSetAdd(fss, (const FcChar8 *) dir);
if (!rc) {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FcStrSetAddFailed);
+ ass_msg(MSGL_WARN, "%s failed", "FcStrSetAdd");
goto ErrorFontCache;
}
@@ -484,14 +483,13 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
FcConfigGetBlanks(priv->config),
(const FcChar8 *) dir, FcFalse);
if (!rc) {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FcDirScanFailed);
+ ass_msg(MSGL_WARN, "%s failed", "FcDirScan");
goto ErrorFontCache;
}
rc = FcDirSave(fcs, fss, (const FcChar8 *) dir);
if (!rc) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FcDirSave);
+ ass_msg(MSGL_WARN, "%s failed", "FcDirSave");
goto ErrorFontCache;
}
ErrorFontCache:
@@ -501,8 +499,7 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
rc = FcConfigAppFontAddDir(priv->config, (const FcChar8 *) dir);
if (!rc) {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FcConfigAppFontAddDirFailed);
+ ass_msg(MSGL_WARN, "%s failed", "FcConfigAppFontAddDir");
}
}
@@ -531,7 +528,7 @@ fc_instance_t *fontconfig_init(ass_library_t *library,
fc_instance_t *priv;
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
+ "Fontconfig disabled, only default font will be used.");
priv = calloc(1, sizeof(fc_instance_t));
diff --git a/libass/ass_render.c b/libass/ass_render.c
index f442b89..c5d7d06 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -246,7 +246,7 @@ static void ass_lazy_track_init(ass_renderer_t *render_priv)
return;
if (!track->PlayResX && !track->PlayResY) {
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_NeitherPlayResXNorPlayResYDefined);
+ "Neither PlayResX nor PlayResY defined. Assuming 384x288");
track->PlayResX = 384;
track->PlayResY = 288;
} else {
@@ -257,19 +257,19 @@ static void ass_lazy_track_init(ass_renderer_t *render_priv)
if (!track->PlayResY && track->PlayResX == 1280) {
track->PlayResY = 1024;
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_PlayResYUndefinedSettingY, track->PlayResY);
+ "PlayResY undefined, setting to %d", track->PlayResY);
} else if (!track->PlayResY) {
track->PlayResY = track->PlayResX / orig_aspect + .5;
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_PlayResYUndefinedSettingY, track->PlayResY);
+ "PlayResY undefined, setting to %d", track->PlayResY);
} else if (!track->PlayResX && track->PlayResY == 1024) {
track->PlayResX = 1280;
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_PlayResXUndefinedSettingX, track->PlayResX);
+ "PlayResX undefined, setting to %d", track->PlayResX);
} else if (!track->PlayResX) {
track->PlayResX = track->PlayResY * orig_aspect + .5;
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_PlayResXUndefinedSettingX, track->PlayResX);
+ "PlayResX undefined, setting to %d", track->PlayResX);
}
}
}
@@ -283,14 +283,14 @@ ass_renderer_t *ass_renderer_init(ass_library_t *library)
error = FT_Init_FreeType(&ft);
if (error) {
- ass_msg(MSGL_FATAL, MSGTR_LIBASS_FT_Init_FreeTypeFailed);
+ ass_msg(MSGL_FATAL, "%s failed", "FT_Init_FreeType");
goto ass_init_exit;
}
FT_Library_Version(ft, &vmajor, &vminor, &vpatch);
- ass_msg(MSGL_V, "FreeType library version: %d.%d.%d\n",
+ ass_msg(MSGL_V, "FreeType library version: %d.%d.%d",
vmajor, vminor, vpatch);
- ass_msg(MSGL_V, "FreeType headers version: %d.%d.%d\n",
+ ass_msg(MSGL_V, "FreeType headers version: %d.%d.%d",
FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
priv = calloc(1, sizeof(ass_renderer_t));
@@ -318,9 +318,9 @@ ass_renderer_t *ass_renderer_init(ass_library_t *library)
ass_init_exit:
if (priv)
- ass_msg(MSGL_INFO, MSGTR_LIBASS_Init);
+ ass_msg(MSGL_INFO, "Init");
else
- ass_msg(MSGL_ERR, MSGTR_LIBASS_InitFailed);
+ ass_msg(MSGL_ERR, "Init failed");
return priv;
}
@@ -527,22 +527,22 @@ static ass_image_t **render_glyph(ass_renderer_t *render_priv,
tmp = dst_x - clip_x0;
if (tmp < 0) {
- ass_msg(MSGL_DBG2, "clip left\n");
+ ass_msg(MSGL_DBG2, "clip left");
b_x0 = -tmp;
}
tmp = dst_y - clip_y0;
if (tmp < 0) {
- ass_msg(MSGL_DBG2, "clip top\n");
+ ass_msg(MSGL_DBG2, "clip top");
b_y0 = -tmp;
}
tmp = clip_x1 - dst_x - bm->w;
if (tmp < 0) {
- ass_msg(MSGL_DBG2, "clip right\n");
+ ass_msg(MSGL_DBG2, "clip right");
b_x1 = bm->w + tmp;
}
tmp = clip_y1 - dst_y - bm->h;
if (tmp < 0) {
- ass_msg(MSGL_DBG2, "clip bottom\n");
+ ass_msg(MSGL_DBG2, "clip bottom");
b_y1 = bm->h + tmp;
}
@@ -939,7 +939,7 @@ static void change_border(ass_renderer_t *render_priv, double border_x,
memory, &render_priv->state.stroker);
#endif
if (error) {
- ass_msg(MSGL_V, "failed to get stroker\n");
+ ass_msg(MSGL_V, "failed to get stroker");
render_priv->state.stroker = 0;
}
}
@@ -1180,7 +1180,7 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
t1 = 0;
t2 = render_priv->state.event->Duration;
ass_msg(MSGL_DBG2,
- "movement: (%f, %f) -> (%f, %f)\n", x1, y1, x2, y2);
+ "movement: (%f, %f) -> (%f, %f)", x1, y1, x2, y2);
}
skip(')');
delta_t = t2 - t1;
@@ -1260,12 +1260,12 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
int val;
if (mystrtoi(&p, &val) && val) {
int v = (val - 1) / 3; // 0, 1 or 2 for vertical alignment
- ass_msg(MSGL_DBG2, "an %d\n", val);
+ ass_msg(MSGL_DBG2, "an %d", val);
if (v != 0)
v = 3 - v;
val = ((val - 1) % 3) + 1; // horizontal alignment
val += v * 4;
- ass_msg(MSGL_DBG2, "align %d\n", val);
+ ass_msg(MSGL_DBG2, "align %d", val);
render_priv->state.alignment = val;
} else
render_priv->state.alignment =
@@ -1284,10 +1284,10 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
skip(',');
mystrtod(&p, &v2);
skip(')');
- ass_msg(MSGL_DBG2, "pos(%f, %f)\n", v1, v2);
+ ass_msg(MSGL_DBG2, "pos(%f, %f)", v1, v2);
if (render_priv->state.evt_type == EVENT_POSITIONED) {
ass_msg(MSGL_V, "Subtitle has a new \\pos "
- "after \\move or \\pos, ignoring\n");
+ "after \\move or \\pos, ignoring");
} else {
render_priv->state.evt_type = EVENT_POSITIONED;
render_priv->state.detect_collisions = 0;
@@ -1339,8 +1339,7 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
skip(',');
mystrtoi(&p, &v2);
skip(')');
- ass_msg(MSGL_DBG2, "org(%d, %d)\n", v1, v2);
- // render_priv->state.evt_type = EVENT_POSITIONED;
+ ass_msg(MSGL_DBG2, "org(%d, %d)", v1, v2);
if (!render_priv->state.have_origin) {
render_priv->state.org_x = v1;
render_priv->state.org_y = v2;
@@ -1428,7 +1427,7 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
uint32_t val;
if (!strtocolor(&p, &val))
val = render_priv->state.style->PrimaryColour;
- ass_msg(MSGL_DBG2, "color: %X\n", val);
+ ass_msg(MSGL_DBG2, "color: %X", val);
change_color(&render_priv->state.c[0], val, pwr);
} else if ((*p >= '1') && (*p <= '4') && (++p)
&& (mystrcmp(&p, "c") || mystrcmp(&p, "a"))) {
@@ -1463,10 +1462,10 @@ static char *parse_tag(ass_renderer_t *render_priv, char *p, double pwr)
change_alpha(render_priv->state.c + cidx, val >> 24, pwr);
break;
default:
- ass_msg(MSGL_WARN, MSGTR_LIBASS_BadCommand, n, cmd);
+ ass_msg(MSGL_WARN, "Bad command: %c%c", n, cmd);
break;
}
- ass_msg(MSGL_DBG2, "single c/a at %f: %c%c = %X \n",
+ ass_msg(MSGL_DBG2, "single c/a at %f: %c%c = %X",
pwr, n, cmd, render_priv->state.c[cidx]);
} else if (mystrcmp(&p, "r")) {
reset_render_context(render_priv);
@@ -1580,7 +1579,7 @@ static unsigned get_next_char(ass_renderer_t *render_priv, char **str)
} else
break;
} else if (*p != '\\')
- ass_msg(MSGL_V, "Unable to parse: \"%s\" \n", p);
+ ass_msg(MSGL_V, "Unable to parse: '%s'", p);
if (*p == 0)
break;
}
@@ -1626,7 +1625,7 @@ apply_transition_effects(ass_renderer_t *render_priv, ass_event_t *event)
if (strncmp(event->Effect, "Banner;", 7) == 0) {
int delay;
if (cnt < 1) {
- ass_msg(MSGL_V, "Error parsing effect: %s \n",
+ ass_msg(MSGL_V, "Error parsing effect: '%s'",
event->Effect);
return;
}
@@ -1649,7 +1648,7 @@ apply_transition_effects(ass_renderer_t *render_priv, ass_event_t *event)
} else if (strncmp(event->Effect, "Scroll down;", 12) == 0) {
render_priv->state.scroll_direction = SCROLL_TB;
} else {
- ass_msg(MSGL_V, "Unknown transition effect: %s \n",
+ ass_msg(MSGL_V, "Unknown transition effect: '%s'",
event->Effect);
return;
}
@@ -1658,7 +1657,7 @@ apply_transition_effects(ass_renderer_t *render_priv, ass_event_t *event)
int delay;
int y0, y1;
if (cnt < 3) {
- ass_msg(MSGL_V, "Error parsing effect: %s \n",
+ ass_msg(MSGL_V, "Error parsing effect: '%s'",
event->Effect);
return;
}
@@ -1865,7 +1864,7 @@ static void stroke_outline_glyph(ass_renderer_t *render_priv,
error = FT_Glyph_StrokeBorder((FT_Glyph *) glyph,
render_priv->state.stroker, 0, 1);
if (error)
- ass_msg(MSGL_WARN, MSGTR_LIBASS_FT_Glyph_Stroke_Error, error);
+ ass_msg(MSGL_WARN, "FT_Glyph_Stroke error: %d", error);
// "Stroke" with the outline emboldener in two passes.
// The outlines look uglier, but the emboldening never adds any points
@@ -2134,7 +2133,7 @@ wrap_lines_smart(ass_renderer_t *render_priv, double max_text_width)
if (cur->symbol == '\n') {
break_type = 2;
break_at = i;
- ass_msg(MSGL_DBG2, "forced line break at %d\n",