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
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
}
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;
#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)
#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;}
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
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);
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;
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)
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,
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;
}
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);
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 >
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);
}
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);
}
#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");
}
{
osize += size;
oleft += size;
} else {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_ErrorRecodingFile);
+ ass_msg(MSGL_WARN, "Error recoding file");
return NULL;
}
} else if (clear)
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;
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;
}
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);
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;
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;
}
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;
}
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
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;
}
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;
// 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);
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);
}
/*
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;
}
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;
}
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);
}
}
}
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) || \
#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;
}
!(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);
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" : "");
_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;
}
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);
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;
}
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;
}
if (!fc) {
ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
+ "Fontconfig disabled, only default font will be used.");
goto exit;
}
}
if (!rc || !priv->config) {
- ass_msg(MSGL_FATAL,
- MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed);
+ ass_msg(MSGL_FATAL, "%s failed", "FcInitLoadConfigAndFonts");
goto exit;
}
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;
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;
}
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:
rc = FcConfigAppFontAddDir(priv->config, (const FcChar8 *) dir);
if (!rc) {
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_FcConfigAppFontAddDirFailed);
+ ass_msg(MSGL_WARN, "%s failed", "FcConfigAppFontAddDir");
}
}
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));
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 {
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);
}
}
}
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));
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;
}
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;
}
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;
}
}
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;
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 =
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;
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;
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"))) {
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);
} 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;
}
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;
}
} 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;
}
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;
}
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
if (cur->symbol == '\n') {
break_type = 2;
break_at = i;
- ass_msg(MSGL_DBG2, "forced line break at %d\n",
+ ass_msg(MSGL_DBG2, "forced line break at %d",
break_at);
}
break_at = i - 1;
if (break_at == -1)
break_at = 0;
- ass_msg(MSGL_DBG2, "overfill at %d\n", i);
- ass_msg(MSGL_DBG2, "line break at %d\n", break_at);
+ ass_msg(MSGL_DBG2, "overfill at %d", i);
+ ass_msg(MSGL_DBG2, "line break at %d", break_at);
}
if (break_at != -1) {
pen_shift_x = d6_to_double(-cur->pos.x);
pen_shift_y += height + render_priv->settings.line_spacing;
ass_msg(MSGL_DBG2,
- "shifting from %d to %d by (%f, %f)\n", i,
+ "shifting from %d to %d by (%f, %f)", i,
text_info->length - 1, pen_shift_x, pen_shift_y);
}
cur->pos.x += double_to_d6(pen_shift_x);
dt /= (tm_end - tm_start);
x = x_start + (x_end - x_start) * dt;
} else {
- ass_msg(MSGL_ERR,
- MSGTR_LIBASS_UnknownEffectType_InternalError);
+ ass_msg(MSGL_ERR, "Unknown effect type");
continue;
}
ass_drawing_t *drawing;
if (event->Style >= render_priv->track->n_styles) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_NoStyleFound);
+ ass_msg(MSGL_WARN, "No style found");
return 1;
}
if (!event->Text) {
- ass_msg(MSGL_WARN, MSGTR_LIBASS_EmptyEvent);
+ ass_msg(MSGL_WARN, "Empty event");
return 1;
}
double scr_y;
if (valign != VALIGN_SUB)
ass_msg(MSGL_V,
- "Invalid valign, supposing 0 (subtitle)\n");
+ "Invalid valign, supposing 0 (subtitle)");
scr_y =
y2scr_sub(render_priv,
render_priv->track->PlayResY - MarginV);
if (render_priv->state.evt_type == EVENT_POSITIONED) {
double base_x = 0;
double base_y = 0;
- ass_msg(MSGL_DBG2, "positioned event at %f, %f\n",
+ ass_msg(MSGL_DBG2, "positioned event at %f, %f",
render_priv->state.pos_x, render_priv->state.pos_y);
get_base_point(&bbox, alignment, &base_x, &base_y);
device_x =
s.a = priv->top;
s.b = priv->top + priv->height;
if (priv->height != imgs[i].height) { // no, it's not
- ass_msg(MSGL_WARN,
- MSGTR_LIBASS_EventHeightHasChanged);
+ ass_msg(MSGL_WARN, "Warning! Event height has changed");
priv->top = 0;
priv->height = 0;
}
int mystrtoi(char **p, int *res)
{
- // NOTE: base argument is ignored, but not used in libass anyway
double temp_res;
char *start = *p;
temp_res = strtod(*p, p);
if (lvl > MSGL_INFO)
return;
va_start(va, fmt);
+ printf("[ass] ");
vprintf(fmt, va);
+ printf("\n");
va_end(va);
}
#include <enca.h>
#endif
-#include "help_mp.h"
-
#define MSGL_FATAL 0
#define MSGL_ERR 1
#define MSGL_WARN 2
+++ /dev/null
-#ifndef __LIBASS_HELP_MP_H__
-#define __LIBASS_HELP_MP_H__
-#define MSGTR_LIBASS_FT_Glyph_To_BitmapError "[ass] FT_Glyph_To_Bitmap error %d \n"
-#define MSGTR_LIBASS_UnsupportedPixelMode "[ass] Unsupported pixel mode: %d\n"
-#define MSGTR_LIBASS_GlyphBBoxTooLarge "[ass] Glyph bounding box too large: %dx%dpx\n"
-#define MSGTR_LIBASS_NoStyleNamedXFoundUsingY "[ass] [%p] Warning: no style named '%s' found, using '%s'\n"
-#define MSGTR_LIBASS_BadTimestamp "[ass] bad timestamp\n"
-#define MSGTR_LIBASS_BadEncodedDataSize "[ass] bad encoded data size\n"
-#define MSGTR_LIBASS_FontLineTooLong "[ass] Font line too long: %d, %s\n"
-#define MSGTR_LIBASS_EventFormatHeaderMissing "[ass] Event format header missing\n"
-#define MSGTR_LIBASS_ErrorOpeningIconvDescriptor "[ass] error opening iconv descriptor.\n"
-#define MSGTR_LIBASS_ErrorRecodingFile "[ass] error recoding file.\n"
-#define MSGTR_LIBASS_FopenFailed "[ass] ass_read_file(%s): fopen failed\n"
-#define MSGTR_LIBASS_FseekFailed "[ass] ass_read_file(%s): fseek failed\n"
-#define MSGTR_LIBASS_RefusingToLoadSubtitlesLargerThan10M "[ass] ass_read_file(%s): Refusing to load subtitles larger than 10M\n"
-#define MSGTR_LIBASS_ReadFailed "Read failed, %d: %s\n"
-#define MSGTR_LIBASS_AddedSubtitleFileMemory "[ass] Added subtitle file: <memory> (%d styles, %d events)\n"
-#define MSGTR_LIBASS_AddedSubtitleFileFname "[ass] Added subtitle file: %s (%d styles, %d events)\n"
-#define MSGTR_LIBASS_FailedToCreateDirectory "[ass] Failed to create directory %s\n"
-#define MSGTR_LIBASS_NotADirectory "[ass] Not a directory: %s\n"
-#define MSGTR_LIBASS_TooManyFonts "[ass] Too many fonts\n"
-#define MSGTR_LIBASS_ErrorOpeningFont "[ass] Error opening font: %s, %d\n"
-#define MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne "[ass] fontconfig: Selected font is not the requested one: '%s' != '%s'\n"
-#define MSGTR_LIBASS_UsingDefaultFontFamily "[ass] fontconfig_select: Using default font family: (%s, %d, %d) -> %s, %d\n"
-#define MSGTR_LIBASS_UsingDefaultFont "[ass] fontconfig_select: Using default font: (%s, %d, %d) -> %s, %d\n"
-#define MSGTR_LIBASS_UsingArialFontFamily "[ass] fontconfig_select: Using 'Arial' font family: (%s, %d, %d) -> %s, %d\n"
-#define MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed "[ass] FcInitLoadConfigAndFonts failed.\n"
-#define MSGTR_LIBASS_UpdatingFontCache "[ass] Updating font cache.\n"
-#define MSGTR_LIBASS_BetaVersionsOfFontconfigAreNotSupported "[ass] Beta versions of fontconfig are not supported.\n[ass] Update before reporting any bugs.\n"
-#define MSGTR_LIBASS_FcStrSetAddFailed "[ass] FcStrSetAdd failed.\n"
-#define MSGTR_LIBASS_FcDirScanFailed "[ass] FcDirScan failed.\n"
-#define MSGTR_LIBASS_FcDirSave "[ass] FcDirSave failed.\n"
-#define MSGTR_LIBASS_FcConfigAppFontAddDirFailed "[ass] FcConfigAppFontAddDir failed\n"
-#define MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed "[ass] Fontconfig disabled, only default font will be used.\n"
-#define MSGTR_LIBASS_FunctionCallFailed "[ass] %s failed\n"
-#define MSGTR_LIBASS_NeitherPlayResXNorPlayResYDefined "[ass] Neither PlayResX nor PlayResY defined. Assuming 384x288.\n"
-#define MSGTR_LIBASS_PlayResYUndefinedSettingY "[ass] PlayResY undefined, setting %d.\n"
-#define MSGTR_LIBASS_PlayResXUndefinedSettingX "[ass] PlayResX undefined, setting %d.\n"
-#define MSGTR_LIBASS_FT_Init_FreeTypeFailed "[ass] FT_Init_FreeType failed.\n"
-#define MSGTR_LIBASS_Init "[ass] Init\n"
-#define MSGTR_LIBASS_InitFailed "[ass] Init failed.\n"
-#define MSGTR_LIBASS_BadCommand "[ass] Bad command: %c%c\n"
-#define MSGTR_LIBASS_ErrorLoadingGlyph "[ass] Error loading glyph.\n"
-#define MSGTR_LIBASS_FT_Glyph_Stroke_Error "[ass] FT_Glyph_Stroke error %d \n"
-#define MSGTR_LIBASS_UnknownEffectType_InternalError "[ass] Unknown effect type (internal error)\n"
-#define MSGTR_LIBASS_NoStyleFound "[ass] No style found!\n"
-#define MSGTR_LIBASS_EmptyEvent "[ass] Empty event!\n"
-#define MSGTR_LIBASS_MAX_GLYPHS_Reached "[ass] MAX_GLYPHS reached: event %d, start = %llu, duration = %llu\n Text = %s\n"
-#define MSGTR_LIBASS_EventHeightHasChanged "[ass] Warning! Event height has changed! \n"
-#define MSGTR_LIBASS_GlyphNotFoundReselectingFont "[ass] Glyph 0x%X not found, selecting one more font for (%s, %d, %d)\n"
-#define MSGTR_LIBASS_GlyphNotFound "[ass] Glyph 0x%X not found in font for (%s, %d, %d)\n"
-#define MSGTR_LIBASS_ErrorOpeningMemoryFont "[ass] Error opening memory font: %s\n"
-#define MSGTR_LIBASS_NoCharmaps "[ass] font face with no charmaps\n"
-#define MSGTR_LIBASS_NoCharmapAutodetected "[ass] no charmap autodetected, trying the first one\n"
-#endif