From 598d5be3ad6c53edb7c9db47ec04ca9b006e1056 Mon Sep 17 00:00:00 2001 From: kraymer Date: Sun, 19 Nov 2006 22:35:17 +0000 Subject: MSGTRs for libass git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21082 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass.c | 30 +++++++++++++++--------------- libass/ass_bitmap.c | 4 ++-- libass/ass_cache.c | 4 ++-- libass/ass_fontconfig.c | 25 ++++++++++++------------- libass/ass_render.c | 32 ++++++++++++++++---------------- libass/mputils.h | 1 + 6 files changed, 48 insertions(+), 48 deletions(-) (limited to 'libass') diff --git a/libass/ass.c b/libass/ass.c index 87d699a4d3..b0d148a1a6 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -167,7 +167,7 @@ static int lookup_style(ass_track_t* track, char* name) { return i; } i = track->default_style; - mp_msg(MSGT_ASS, MSGL_WARN, "[%p] Warning: no style named '%s' found, using '%s'\n", track, name, track->styles[i].Name); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NoStyleNamedXFoundUsingY, track, name, track->styles[i].Name); return i; // use the first style } @@ -182,7 +182,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) { - mp_msg(MSGT_ASS, MSGL_WARN, "bad timestamp\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_BadTimestamp); return 0; } tm = ((h * 60 + m) * 60 + s) * 1000 + ms * 10; @@ -553,7 +553,7 @@ static int decode_font(ass_track_t* track) mp_msg(MSGT_ASS, MSGL_V, "font: %d bytes encoded data \n", track->parser_priv->fontdata_used); size = track->parser_priv->fontdata_used; if (size % 4 == 1) { - mp_msg(MSGT_ASS, MSGL_ERR, "bad encoded data size\n"); + mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_BadEncodedDataSize); goto error_decode_font; } buf = malloc(size / 4 * 3 + 2); @@ -607,7 +607,7 @@ static int process_fonts_line(ass_track_t* track, char *str) len = strlen(str); if (len > 80) { - mp_msg(MSGT_ASS, MSGL_WARN, "Font line too long: %d, %s\n", len, str); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FontLineTooLong, len, str); return 0; } if (track->parser_priv->fontdata_used + len > track->parser_priv->fontdata_size) { @@ -747,7 +747,7 @@ void ass_process_chunk(ass_track_t* track, char *data, int size, long long timec ass_event_t* event; if (!track->event_format) { - mp_msg(MSGT_ASS, MSGL_WARN, "Event format header missing\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_EventFormatHeaderMissing); return; } @@ -811,7 +811,7 @@ static char* sub_recode(char* data, size_t size, char* codepage) if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){ mp_msg(MSGT_ASS,MSGL_V,"LIBSUB: opened iconv descriptor.\n"); } else - mp_msg(MSGT_ASS,MSGL_ERR,"LIBSUB: error opening iconv descriptor.\n"); + mp_msg(MSGT_ASS,MSGL_ERR,MSGTR_LIBASS_ErrorOpeningIconvDescriptor); #ifdef HAVE_ENCA if (cp_tmp) free(cp_tmp); #endif @@ -839,7 +839,7 @@ static char* sub_recode(char* data, size_t size, char* codepage) osize += size; oleft += size; } else { - mp_msg(MSGT_ASS, MSGL_WARN, "LIBSUB: error recoding file.\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorRecodingFile); return NULL; } } @@ -872,12 +872,12 @@ static char* read_file(char* fname, size_t *bufsize) FILE* fp = fopen(fname, "rb"); if (!fp) { - mp_msg(MSGT_ASS, MSGL_WARN, "ass_read_file(%s): fopen failed\n", fname); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FopenFailed, fname); return 0; } res = fseek(fp, 0, SEEK_END); if (res == -1) { - mp_msg(MSGT_ASS, MSGL_WARN, "ass_read_file(%s): fseek failed\n", fname); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FseekFailed, fname); fclose(fp); return 0; } @@ -886,7 +886,7 @@ static char* read_file(char* fname, size_t *bufsize) rewind(fp); if (sz > 10*1024*1024) { - mp_msg(MSGT_ASS, MSGL_INFO, "ass_read_file(%s): Refusing to load subtitles larger than 10M\n", fname); + mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_RefusingToLoadSubtitlesLargerThan10M, fname); fclose(fp); return 0; } @@ -899,7 +899,7 @@ static char* read_file(char* fname, size_t *bufsize) do { res = fread(buf + bytes_read, 1, sz - bytes_read, fp); if (res <= 0) { - mp_msg(MSGT_ASS, MSGL_INFO, "Read failed, %d: %s\n", errno, strerror(errno)); + mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_ReadFailed, errno, strerror(errno)); fclose(fp); free(buf); return 0; @@ -975,7 +975,7 @@ ass_track_t* ass_read_memory(ass_library_t* library, char* buf, size_t bufsize, if (!track) return 0; - mp_msg(MSGT_ASS, MSGL_INFO, "LIBASS: added subtitle file: (%d styles, %d events)\n", track->n_styles, track->n_events); + mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_AddedSubtitleFileMemory, track->n_styles, track->n_events); return track; } @@ -1011,7 +1011,7 @@ ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage) track->name = strdup(fname); - mp_msg(MSGT_ASS, MSGL_INFO, "LIBASS: added subtitle file: %s (%d styles, %d events)\n", fname, track->n_styles, track->n_events); + mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_AddedSubtitleFileFname, fname, track->n_styles, track->n_events); // dump_events(forced_tid); return track; @@ -1110,10 +1110,10 @@ void ass_process_font(ass_library_t* library, const char* name, char* data, int res = mkdir(fonts_dir); #endif if (res) { - mp_msg(MSGT_ASS, MSGL_WARN, "Failed to create: %s\n", fonts_dir); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FailedToCreateDirectory, fonts_dir); } } else if (!S_ISDIR(st.st_mode)) { - mp_msg(MSGT_ASS, MSGL_WARN, "Not a directory: %s\n", fonts_dir); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NotADirectory, fonts_dir); } fname = validate_fname((char*)name); diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c index 0f031572a1..6a686673c7 100644 --- a/libass/ass_bitmap.c +++ b/libass/ass_bitmap.c @@ -163,14 +163,14 @@ static bitmap_t* glyph_to_bitmap_internal(FT_Glyph glyph, int bord) error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 0); if (error) { - mp_msg(MSGT_ASS, MSGL_WARN, "FT_Glyph_To_Bitmap error %d \n", error); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FT_Glyph_To_BitmapError, error); return 0; } bg = (FT_BitmapGlyph)glyph; bit = &(bg->bitmap); if (bit->pixel_mode != FT_PIXEL_MODE_GRAY) { - mp_msg(MSGT_ASS, MSGL_WARN, "Unsupported pixel mode: %d\n", (int)(bit->pixel_mode)); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UnsupportedPixelMode, (int)(bit->pixel_mode)); FT_Done_Glyph(glyph); return 0; } diff --git a/libass/ass_cache.c b/libass/ass_cache.c index ada9519e9c..d7d5e9f21e 100644 --- a/libass/ass_cache.c +++ b/libass/ass_cache.c @@ -96,7 +96,7 @@ int ass_new_face(FT_Library library, void* fontconfig_priv, face_desc_t* desc, / } if (face_cache_size == MAX_FACE_CACHE_SIZE) { - mp_msg(MSGT_ASS, MSGL_FATAL, "Too many fonts\n"); + mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_TooManyFonts); return 1; } @@ -105,7 +105,7 @@ int ass_new_face(FT_Library library, void* fontconfig_priv, face_desc_t* desc, / error = FT_New_Face(library, path, index, face); if (error) { if (!no_more_font_messages) - mp_msg(MSGT_ASS, MSGL_WARN, "Error opening font: %s, %d\n", path, index); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorOpeningFont, path, index); no_more_font_messages = 1; return 1; } diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c index c1701758db..f859a254d7 100644 --- a/libass/ass_fontconfig.c +++ b/libass/ass_fontconfig.c @@ -101,7 +101,7 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold return 0; if (strcasecmp((const char*)val_s, family) != 0) - mp_msg(MSGT_ASS, MSGL_WARN, "fontconfig: selected font family is not the requested one: '%s' != '%s'\n", + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_SelectedFontFamilyIsNotTheRequestedOne, (const char*)val_s, family); result = FcPatternGetString(rpat, FC_FILE, 0, &val_s); @@ -128,20 +128,20 @@ char* fontconfig_select(fc_instance_t* priv, const char* family, unsigned bold, if (!res && priv->family_default) { res = _select_font(priv, priv->family_default, bold, italic, index); if (res && !no_more_font_messages) - mp_msg(MSGT_ASS, MSGL_WARN, "fontconfig_select: using default font family: (%s, %d, %d) -> %s, %d\n", + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFontFamily, family, bold, italic, res, *index); } if (!res && priv->path_default) { res = priv->path_default; *index = priv->index_default; if (!no_more_font_messages) - mp_msg(MSGT_ASS, MSGL_WARN, "fontconfig_select: using default font: (%s, %d, %d) -> %s, %d\n", + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFont, family, bold, italic, res, *index); } if (!res) { res = _select_font(priv, "Arial", bold, italic, index); if (res && !no_more_font_messages) - mp_msg(MSGT_ASS, MSGL_WARN, "fontconfig_select: using 'Arial' font family: (%s, %d, %d) -> %s, %d\n", + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily, family, bold, italic, res, *index); } if (res) @@ -168,17 +168,16 @@ fc_instance_t* fontconfig_init(const char* dir, const char* family, const char* priv->config = FcConfigGetCurrent(); if (!priv->config) { - mp_msg(MSGT_ASS, MSGL_FATAL, "FcInitLoadConfigAndFonts failed\n"); + mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FcInitLoadConfigAndFontsFailed); return 0; } if (FcDirCacheValid((const FcChar8 *)dir) == FcFalse) { - mp_msg(MSGT_ASS, MSGL_INFO, "[ass] Updating font cache\n"); + mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_UpdatingFontCache); if (FcGetVersion() >= 20390 && FcGetVersion() < 20400) mp_msg(MSGT_ASS, MSGL_WARN, - "[ass] beta versions of fontconfig are not supported\n" - " update before reporting any bugs\n"); + MSGTR_LIBASS_BetaVersionsOfFontconfigAreNotSupported); // FontConfig >= 2.4.0 updates cache automatically in FcConfigAppFontAddDir() if (FcGetVersion() < 20390) { FcFontSet* fcs; @@ -187,19 +186,19 @@ fc_instance_t* fontconfig_init(const char* dir, const char* family, const char* fss = FcStrSetCreate(); rc = FcStrSetAdd(fss, (const FcChar8*)dir); if (!rc) { - mp_msg(MSGT_ASS, MSGL_WARN, "FcStrSetAdd failed\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcStrSetAddFailed); goto ErrorFontCache; } rc = FcDirScan(fcs, fss, NULL, FcConfigGetBlanks(priv->config), (const FcChar8 *)dir, FcFalse); if (!rc) { - mp_msg(MSGT_ASS, MSGL_WARN, "FcDirScan failed\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcDirScanFailed); goto ErrorFontCache; } rc = FcDirSave(fcs, fss, (const FcChar8 *)dir); if (!rc) { - mp_msg(MSGT_ASS, MSGL_WARN, "FcDirSave failed\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcDirSave); goto ErrorFontCache; } ErrorFontCache: @@ -209,7 +208,7 @@ fc_instance_t* fontconfig_init(const char* dir, const char* family, const char* rc = FcConfigAppFontAddDir(priv->config, (const FcChar8*)dir); if (!rc) { - mp_msg(MSGT_ASS, MSGL_WARN, "FcConfigAppFontAddDir failed\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FcConfigAppFontAddDirFailed); } priv->family_default = family ? strdup(family) : 0; @@ -236,7 +235,7 @@ fc_instance_t* fontconfig_init(const char* dir, const char* family, const char* { fc_instance_t* priv; - mp_msg(MSGT_ASS, MSGL_WARN, "Fontconfig disabled, only default font will be used\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed); priv = calloc(1, sizeof(fc_instance_t)); diff --git a/libass/ass_render.c b/libass/ass_render.c index df68ae03a1..4a65033d37 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -203,7 +203,7 @@ static void ass_lazy_track_init(void) if (track->PlayResX && track->PlayResY) return; if (!track->PlayResX && !track->PlayResY) { - mp_msg(MSGT_ASS, MSGL_WARN, "Neither PlayResX nor PlayResY defined. Assuming 384x288. \n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NeitherPlayResXNorPlayResYDefined); track->PlayResX = 384; track->PlayResY = 288; } else { @@ -211,10 +211,10 @@ static void ass_lazy_track_init(void) frame_context.orig_height / frame_context.width; if (!track->PlayResY) { track->PlayResY = track->PlayResX / orig_aspect + .5; - mp_msg(MSGT_ASS, MSGL_WARN, "PlayResY undefined, setting %d \n", track->PlayResY); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_PlayResYUndefinedSettingY, track->PlayResY); } else if (!track->PlayResX) { track->PlayResX = track->PlayResY * orig_aspect + .5; - mp_msg(MSGT_ASS, MSGL_WARN, "PlayResX undefined, setting %d \n", track->PlayResX); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_PlayResXUndefinedSettingX, track->PlayResX); } } } @@ -231,7 +231,7 @@ ass_renderer_t* ass_renderer_init(ass_library_t* library) error = FT_Init_FreeType( &ft ); if ( error ) { - mp_msg(MSGT_ASS, MSGL_FATAL, "FT_Init_FreeType failed\n"); + mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FT_Init_FreeTypeFailed); goto ass_init_exit; } @@ -253,8 +253,8 @@ ass_renderer_t* ass_renderer_init(ass_library_t* library) text_info.glyphs = calloc(MAX_GLYPHS, sizeof(glyph_info_t)); ass_init_exit: - if (priv) mp_msg(MSGT_ASS, MSGL_INFO, "[ass] Init\n"); - else mp_msg(MSGT_ASS, MSGL_ERR, "[ass] Init failed\n"); + if (priv) mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_Init); + else mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_InitFailed); return priv; } @@ -960,7 +960,7 @@ static char* parse_tag(char* p, double pwr) { switch (cmd) { case 'c': change_color(render_context.c + cidx, val, pwr); break; case 'a': change_alpha(render_context.c + cidx, val >> 24, pwr); break; - default: mp_msg(MSGT_ASS, MSGL_WARN, "Bad command: %c%c\n", n, cmd); break; + default: mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_BadCommand, n, cmd); break; } mp_msg(MSGT_ASS, MSGL_DBG2, "single c/a at %f: %c%c = %X \n", pwr, n, cmd, render_context.c[cidx]); } else if (mystrcmp(&p, "r")) { @@ -1239,7 +1239,7 @@ static int get_glyph(int index, int symbol, glyph_info_t* info, FT_Vector* advan error = FT_Load_Glyph(render_context.face, index, FT_LOAD_NO_BITMAP ); if (error) { - mp_msg(MSGT_ASS, MSGL_WARN, "Error loading glyph\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph); return error; } @@ -1254,7 +1254,7 @@ static int get_glyph(int index, int symbol, glyph_info_t* info, FT_Vector* advan #endif error = FT_Get_Glyph(render_context.face->glyph, &(info->glyph)); if (error) { - mp_msg(MSGT_ASS, MSGL_WARN, "Error getting glyph\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph); return error; } @@ -1265,7 +1265,7 @@ static int get_glyph(int index, int symbol, glyph_info_t* info, FT_Vector* advan info->outline_glyph = info->glyph; error = FT_Glyph_Stroke( &(info->outline_glyph), render_context.stroker, 0 ); // don't destroy original if (error) { - mp_msg(MSGT_ASS, MSGL_WARN, "FT_Glyph_Stroke error %d \n", error); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FT_Glyph_Stroke_Error, error); } } else { info->outline_glyph = 0; @@ -1493,7 +1493,7 @@ static void process_karaoke_effects(void) dt /= (tm_end - tm_start); x = x_start + (x_end - x_start) * dt; } else { - mp_msg(MSGT_ASS, MSGL_ERR, "Unknown effect type (internal error) \n"); + mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_UnknownEffectType_InternalError); continue; } @@ -1586,11 +1586,11 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images) int device_x = 0, device_y = 0; if (event->Style >= frame_context.track->n_styles) { - mp_msg(MSGT_ASS, MSGL_WARN, "No style found!\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NoStyleFound); return 1; } if (!event->Text) { - mp_msg(MSGT_ASS, MSGL_WARN, "Empty event!\n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_EmptyEvent); return 1; } @@ -1620,7 +1620,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images) use_kerning = FT_HAS_KERNING(render_context.face); if (text_info.length >= MAX_GLYPHS) { - mp_msg(MSGT_ASS, MSGL_WARN, "\nMAX_GLYPHS reached: event %d, start = %llu, duration = %llu\n Text = %s\n", + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_MAX_GLYPHS_Reached, (int)(event - frame_context.track->events), event->Start, event->Duration, event->Text); break; } @@ -2129,7 +2129,7 @@ static void fix_collisions(event_images_t* imgs, int cnt) s.a = priv->top; s.b = priv->top + priv->height; if (priv->height != imgs[i].height) { // no, it's not - mp_msg(MSGT_ASS, MSGL_WARN, "Achtung! Event height has changed! \n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_EventHeightHasChanged); priv->top = 0; priv->height = 0; } @@ -2195,7 +2195,7 @@ ass_image_t* ass_render_frame(ass_renderer_t *priv, ass_track_t* track, long lon rc = ass_render_event(event, eimg + cnt); if (!rc) ++cnt; } else { - mp_msg(MSGT_ASS, MSGL_WARN, "Too many simultaneous events \n"); + mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_TooManySimultaneousEvents); break; } } diff --git a/libass/mputils.h b/libass/mputils.h index a36e570eca..5ed1be527e 100644 --- a/libass/mputils.h +++ b/libass/mputils.h @@ -2,6 +2,7 @@ #define __ASS_MPUTILS_H__ #include "mp_msg.h" +#include "help_mp.h" #include "libvo/font_load.h" // for blur() #include "subreader.h" // for guess_buffer_cp #include "libvo/sub.h" // for utf8_get_char -- cgit v1.2.3