summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-07-07 02:26:13 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-07-07 02:34:35 +0300
commit0eb321bf2c1cc0e048faff26a01f86cdd3ec254f (patch)
tree71cb9bd9ed121156d3382066c0722c73189afe04 /libass
parent6d908205fbadbdf7ccdc6c5e0eb918f0b43f16e0 (diff)
downloadmpv-0eb321bf2c1cc0e048faff26a01f86cdd3ec254f.tar.bz2
mpv-0eb321bf2c1cc0e048faff26a01f86cdd3ec254f.tar.xz
Remove trailing whitespace from most files
Diffstat (limited to 'libass')
-rw-r--r--libass/ass.c89
-rw-r--r--libass/ass.h2
-rw-r--r--libass/ass_bitmap.c5
-rw-r--r--libass/ass_cache.c7
-rw-r--r--libass/ass_cache.h2
-rw-r--r--libass/ass_font.c18
-rw-r--r--libass/ass_fontconfig.c32
-rw-r--r--libass/ass_library.c12
-rw-r--r--libass/ass_mp.c2
-rw-r--r--libass/ass_render.c109
-rw-r--r--libass/ass_types.h4
-rw-r--r--libass/ass_utils.c10
12 files changed, 143 insertions, 149 deletions
diff --git a/libass/ass.c b/libass/ass.c
index b0c38c2ce4..5e9e82c2c4 100644
--- a/libass/ass.c
+++ b/libass/ass.c
@@ -56,7 +56,7 @@ struct parser_priv_s {
void ass_free_track(ass_track_t* track) {
int i;
-
+
if (track->parser_priv) {
if (track->parser_priv->fontname)
free(track->parser_priv->fontname);
@@ -85,14 +85,14 @@ void ass_free_track(ass_track_t* track) {
/// \return style id
int ass_alloc_style(ass_track_t* track) {
int sid;
-
+
assert(track->n_styles <= track->max_styles);
if (track->n_styles == track->max_styles) {
track->max_styles += ASS_STYLES_ALLOC;
track->styles = (ass_style_t*)realloc(track->styles, sizeof(ass_style_t)*track->max_styles);
}
-
+
sid = track->n_styles++;
memset(track->styles + sid, 0, sizeof(ass_style_t));
return sid;
@@ -103,14 +103,14 @@ int ass_alloc_style(ass_track_t* track) {
/// \return event id
int ass_alloc_event(ass_track_t* track) {
int eid;
-
+
assert(track->n_events <= track->max_events);
if (track->n_events == track->max_events) {
track->max_events += ASS_EVENTS_ALLOC;
track->events = (ass_event_t*)realloc(track->events, sizeof(ass_event_t)*track->max_events);
}
-
+
eid = track->n_events++;
memset(track->events + eid, 0, sizeof(ass_event_t));
return eid;
@@ -217,7 +217,7 @@ static int numpad2align(int val) {
if (target->name != NULL) free(target->name); \
target->name = strdup(token); \
mp_msg(MSGT_ASS, MSGL_DBG2, "%s = %s\n", #name, token);
-
+
#define COLORVAL(name) ANYVAL(name,string2color)
#define INTVAL(name) ANYVAL(name,atoi)
#define FPVAL(name) ANYVAL(name,atof)
@@ -261,7 +261,7 @@ static char* next_token(char** str) {
* \param event parsed data goes here
* \param str string to parse, zero-terminated
* \param n_ignored number of format options to skip at the beginning
-*/
+*/
static int process_event_tail(ass_track_t* track, ass_event_t* event, char* str, int n_ignored)
{
char* token;
@@ -329,9 +329,9 @@ void process_force_style(ass_track_t* track) {
ass_style_t* target;
int sid;
char** list = track->library->style_overrides;
-
+
if (!list) return;
-
+
for (fs = list; *fs; ++fs) {
eq = strrchr(*fs, '=');
if (!eq)
@@ -398,7 +398,7 @@ void process_force_style(ass_track_t* track) {
* \param track track
* \param str string to parse, zero-terminated
* Allocates a new style struct.
-*/
+*/
static int process_style(ass_track_t* track, char *str)
{
@@ -426,9 +426,9 @@ static int process_style(ass_track_t* track, char *str)
}
q = format = strdup(track->style_format);
-
+
mp_msg(MSGT_ASS, MSGL_V, "[%p] Style: %s\n", track, str);
-
+
sid = ass_alloc_style(track);
style = track->styles + sid;
@@ -436,13 +436,13 @@ static int process_style(ass_track_t* track, char *str)
// fill style with some default values
style->ScaleX = 100.;
style->ScaleY = 100.;
-
+
while (1) {
NEXT(q, tname);
NEXT(p, token);
-
+
// ALIAS(TertiaryColour,OutlineColour) // ignore TertiaryColour; it appears only in SSA, and is overridden by BackColour
-
+
if (0) { // cool ;)
STRVAL(Name)
if ((strcmp(target->Name, "Default")==0) || (strcmp(target->Name, "*Default")==0))
@@ -494,7 +494,7 @@ static int process_style(ass_track_t* track, char *str)
}
free(format);
return 0;
-
+
}
static int process_styles_line(ass_track_t* track, char *str)
@@ -541,7 +541,7 @@ static int process_events_line(ass_track_t* track, char *str)
// called directly from demuxer
int eid;
ass_event_t* event;
-
+
str += 9;
skip_spaces(&str);
@@ -600,7 +600,7 @@ static int decode_font(ass_track_t* track)
}
dsize = q - buf;
assert(dsize <= size / 4 * 3 + 2);
-
+
if (track->library->extract_fonts) {
ass_add_font(track->library, track->parser_priv->fontname, (char*)buf, dsize);
buf = 0;
@@ -631,7 +631,7 @@ static int process_fonts_line(ass_track_t* track, char *str)
mp_msg(MSGT_ASS, MSGL_V, "fontname: %s\n", track->parser_priv->fontname);
return 0;
}
-
+
if (!track->parser_priv->fontname) {
mp_msg(MSGT_ASS, MSGL_V, "Not understood: %s \n", str);
return 0;
@@ -648,7 +648,7 @@ static int process_fonts_line(ass_track_t* track, char *str)
}
memcpy(track->parser_priv->fontdata + track->parser_priv->fontdata_used, str, len);
track->parser_priv->fontdata_used += len;
-
+
return 0;
}
@@ -656,7 +656,7 @@ static int process_fonts_line(ass_track_t* track, char *str)
* \brief Parse a header line
* \param track track
* \param str string to parse, zero-terminated
-*/
+*/
static int process_line(ass_track_t* track, char *str)
{
if (!strncasecmp(str, "[Script Info]", 13)) {
@@ -778,7 +778,7 @@ static int check_duplicate_event(ass_track_t* track, int ReadOrder)
* \param size length of data
* \param timecode starting time of the event (milliseconds)
* \param duration duration of the event (milliseconds)
-*/
+*/
void ass_process_chunk(ass_track_t* track, char *data, int size, long long timecode, long long duration)
{
char* str;
@@ -791,7 +791,7 @@ void ass_process_chunk(ass_track_t* track, char *data, int size, long long timec
mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_EventFormatHeaderMissing);
return;
}
-
+
str = malloc(size + 1);
memcpy(str, data, size);
str[size] = '\0';
@@ -801,8 +801,8 @@ void ass_process_chunk(ass_track_t* track, char *data, int size, long long timec
event = track->events + eid;
p = str;
-
- do {
+
+ do {
NEXT(p, token);
event->ReadOrder = atoi(token);
if (check_duplicate_event(track, event->ReadOrder))
@@ -815,7 +815,7 @@ void ass_process_chunk(ass_track_t* track, char *data, int size, long long timec
event->Start = timecode;
event->Duration = duration;
-
+
free(str);
return;
// dump_events(tid);
@@ -863,11 +863,11 @@ static char* sub_recode(char* data, size_t size, char* codepage)
char* op;
size_t rc;
int clear = 0;
-
+
outbuf = malloc(osize);
ip = data;
op = outbuf;
-
+
while (1) {
if (ileft)
rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
@@ -898,7 +898,7 @@ static char* sub_recode(char* data, size_t size, char* codepage)
icdsc = (iconv_t)(-1);
mp_msg(MSGT_ASS,MSGL_V,"LIBSUB: closed iconv descriptor.\n");
}
-
+
return outbuf;
}
#endif // ICONV
@@ -927,7 +927,7 @@ static char* read_file(char* fname, size_t *bufsize)
fclose(fp);
return 0;
}
-
+
sz = ftell(fp);
rewind(fp);
@@ -936,9 +936,9 @@ static char* read_file(char* fname, size_t *bufsize)
fclose(fp);
return 0;
}
-
+
mp_msg(MSGT_ASS, MSGL_V, "file size: %ld\n", sz);
-
+
buf = malloc(sz + 1);
assert(buf);
bytes_read = 0;
@@ -954,7 +954,7 @@ static char* read_file(char* fname, size_t *bufsize)
} while (sz - bytes_read > 0);
buf[sz] = '\0';
fclose(fp);
-
+
if (bufsize)
*bufsize = sz;
return buf;
@@ -967,9 +967,9 @@ static ass_track_t* parse_memory(ass_library_t* library, char* buf)
{
ass_track_t* track;
int i;
-
+
track = ass_new_track(library);
-
+
// process header
process_text(track, buf);
@@ -998,15 +998,15 @@ static ass_track_t* parse_memory(ass_library_t* library, char* buf)
* \param bufsize size of buffer
* \param codepage recode buffer contents from given codepage
* \return newly allocated track
-*/
+*/
ass_track_t* ass_read_memory(ass_library_t* library, char* buf, size_t bufsize, char* codepage)
{
ass_track_t* track;
int need_free = 0;
-
+
if (!buf)
return 0;
-
+
#ifdef CONFIG_ICONV
if (codepage)
buf = sub_recode(buf, bufsize, codepage);
@@ -1029,7 +1029,7 @@ char* read_file_recode(char* fname, char* codepage, size_t* size)
{
char* buf;
size_t bufsize;
-
+
buf = read_file(fname, &bufsize);
if (!buf)
return 0;
@@ -1052,7 +1052,7 @@ char* read_file_recode(char* fname, char* codepage, size_t* size)
* \param fname file name
* \param codepage recode buffer contents from given codepage
* \return newly allocated track
-*/
+*/
ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage)
{
char* buf;
@@ -1066,11 +1066,11 @@ ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage)
free(buf);
if (!track)
return 0;
-
+
track->name = strdup(fname);
mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_AddedSubtitleFileFname, fname, track->n_styles, track->n_events);
-
+
// dump_events(forced_tid);
return track;
}
@@ -1111,12 +1111,12 @@ long long ass_step_sub(ass_track_t* track, long long now, int movement) {
if (movement == 0) return 0;
if (track->n_events == 0) return 0;
-
+
if (movement < 0)
for (i = 0; (i < track->n_events) && ((long long)(track->events[i].Start + track->events[i].Duration) <= now); ++i) {}
else
for (i = track->n_events - 1; (i >= 0) && ((long long)(track->events[i].Start) > now); --i) {}
-
+
// -1 and n_events are ok
assert(i >= -1); assert(i <= track->n_events);
i += movement;
@@ -1132,4 +1132,3 @@ ass_track_t* ass_new_track(ass_library_t* library) {
track->parser_priv = calloc(1, sizeof(parser_priv_t));
return track;
}
-
diff --git a/libass/ass.h b/libass/ass.h
index 4bdea3a4aa..e98b4264b7 100644
--- a/libass/ass.h
+++ b/libass/ass.h
@@ -195,7 +195,7 @@ ass_track_t* ass_read_file(ass_library_t* library, char* fname, char* codepage);
* \param bufsize size of buffer
* \param codepage recode buffer contents from given codepage
* \return newly allocated track
-*/
+*/
ass_track_t* ass_read_memory(ass_library_t* library, char* buf, size_t bufsize, char* codepage);
/**
* \brief read styles from file into already initialized track
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
index 61457f1fcc..302827af10 100644
--- a/libass/ass_bitmap.c
+++ b/libass/ass_bitmap.c
@@ -237,7 +237,7 @@ static bitmap_t* fix_outline_and_shadow(bitmap_t* bm_g, bitmap_t* bm_o)
unsigned char* g = bm_g->buffer + (t - bm_g->top) * bm_g->w + (l - bm_g->left);
unsigned char* o = bm_o->buffer + (t - bm_o->top) * bm_o->w + (l - bm_o->left);
unsigned char* s = bm_s->buffer + (t - bm_s->top) * bm_s->w + (l - bm_s->left);
-
+
for (y = 0; y < b - t; ++y) {
for (x = 0; x < r - l; ++x) {
unsigned char c_g, c_o;
@@ -309,7 +309,7 @@ int glyph_to_bitmap(ass_synth_priv_t* priv_blur,
if (*bm_o)
resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
-
+
if (be) {
while (be--) {
if (*bm_o)
@@ -334,4 +334,3 @@ int glyph_to_bitmap(ass_synth_priv_t* priv_blur,
assert(bm_s);
return 0;
}
-
diff --git a/libass/ass_cache.c b/libass/ass_cache.c
index 2c8ee26f85..2150d27ec2 100644
--- a/libass/ass_cache.c
+++ b/libass/ass_cache.c
@@ -117,7 +117,7 @@ void hashmap_done(hashmap_t* map)
if (map->count > 0 || map->hit_count + map->miss_count > 0)
mp_msg(MSGT_ASS, MSGL_V, "cache statistics: \n total accesses: %d\n hits: %d\n misses: %d\n object count: %d\n",
map->hit_count + map->miss_count, map->hit_count, map->miss_count, map->count);
-
+
for (i = 0; i < map->nbuckets; ++i) {
hashmap_item_t* item = map->root[i];
while (item) {
@@ -261,7 +261,7 @@ void* cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val)
* \brief Get a bitmap from bitmap cache.
* \param key hash key
* \return requested hash val or 0 if not found
-*/
+*/
bitmap_hash_val_t* cache_find_bitmap(bitmap_hash_key_t* key)
{
return hashmap_find(bitmap_cache, key);
@@ -310,7 +310,7 @@ void* cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val)
* \brief Get a glyph from glyph cache.
* \param key hash key
* \return requested hash val or 0 if not found
-*/
+*/
glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key)
{
return hashmap_find(glyph_cache, key);
@@ -383,4 +383,3 @@ void ass_composite_cache_reset(void)
ass_composite_cache_done();
ass_composite_cache_init();
}
-
diff --git a/libass/ass_cache.h b/libass/ass_cache.h
index bad0ed8e6e..863ba6fdf6 100644
--- a/libass/ass_cache.h
+++ b/libass/ass_cache.h
@@ -83,7 +83,7 @@ glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
void ass_glyph_cache_reset(void);
void ass_glyph_cache_done(void);
-typedef struct hashmap_s hashmap_t;
+typedef struct hashmap_s hashmap_t;
typedef void (*hashmap_item_dtor_t)(void* key, size_t key_size, void* value, size_t value_size);
typedef int (*hashmap_key_compare_t)(void* key1, void* key2, size_t key_size);
typedef unsigned (*hashmap_hash_t)(void* key, size_t key_size);
diff --git a/libass/ass_font.c b/libass/ass_font.c
index 579e658f14..e129021439 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -121,10 +121,10 @@ static int add_face(void* fc_priv, ass_font_t* font, uint32_t ch)
FT_Face face;
int error;
int mem_idx;
-
+
if (font->n_faces == ASS_FONT_MAX_FACES)
return -1;
-
+
path = fontconfig_select(fc_priv, font->desc.family, font->desc.treat_family_as_pattern, font->desc.bold,
font->desc.italic, &index, ch);
@@ -145,7 +145,7 @@ static int add_face(void* fc_priv, ass_font_t* font, uint32_t ch)
}
charmap_magic(face);
buggy_font_workaround(face);
-
+
font->faces[font->n_faces++] = face;
update_transform(font);
face_set_size(face, font->size);
@@ -164,7 +164,7 @@ ass_font_t* ass_font_new(ass_library_t* library, FT_Library ftlibrary, void* fc_
fontp = ass_font_cache_find(desc);
if (fontp)
return fontp;
-
+
font.library = library;
font.ftlibrary = ftlibrary;
font.n_faces = 0;
@@ -256,7 +256,7 @@ void ass_font_get_asc_desc(ass_font_t* font, uint32_t ch, int* asc, int* desc)
return;
}
}
-
+
*asc = *desc = 0;
}
@@ -308,18 +308,18 @@ FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch
case ASS_HINTING_NORMAL: flags = FT_LOAD_FORCE_AUTOHINT; break;
case ASS_HINTING_NATIVE: flags = 0; break;
}
-
+
error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags);
if (error) {
mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
return 0;
}
-
+
#if (FREETYPE_MAJOR > 2) || \
((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR >= 2)) || \
((FREETYPE_MAJOR == 2) && (FREETYPE_MINOR == 1) && (FREETYPE_PATCH >= 10))
// FreeType >= 2.1.10 required
- if (!(face->style_flags & FT_STYLE_FLAG_ITALIC) &&
+ if (!(face->style_flags & FT_STYLE_FLAG_ITALIC) &&
(font->desc.italic > 55)) {
FT_GlyphSlot_Oblique(face->glyph);
}
@@ -329,7 +329,7 @@ FT_Glyph ass_font_get_glyph(void* fontconfig_priv, ass_font_t* font, uint32_t ch
mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_ErrorLoadingGlyph);
return 0;
}
-
+
return glyph;
}
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index a54bc8c4af..0b030bdf85 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -72,7 +72,7 @@ struct fc_instance_s {
* \param index out: font index inside a file
* \param code: the character that should be present in the font, can be 0
* \return font file path
-*/
+*/
static char* _select_font(fc_instance_t* priv, const char* family, int treat_family_as_pattern,
unsigned bold, unsigned italic, int* index, uint32_t code)
{
@@ -87,7 +87,7 @@ static char* _select_font(fc_instance_t* priv, const char* family, int treat_fam
int curf;
char* retval = NULL;
int family_cnt;
-
+
*index = 0;
if (treat_family_as_pattern)
@@ -97,7 +97,7 @@ static char* _select_font(fc_instance_t* priv, const char* family, int treat_fam
if (!pat)
goto error;
-
+
if (!treat_family_as_pattern) {
FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)family);
@@ -130,7 +130,7 @@ static char* _select_font(fc_instance_t* priv, const char* family, int treat_fam
FcPatternAddInteger(pat, FC_WEIGHT, bold);
FcDefaultSubstitute(pat);
-
+
rc = FcConfigSubstitute(priv->config, pat, FcMatchPattern);
if (!rc)
goto error;
@@ -235,7 +235,7 @@ static char* _select_font(fc_instance_t* priv, const char* family, int treat_fam
* \param index out: font index inside a file
* \param code: the character that should be present in the font, can be 0
* \return font file path
-*/
+*/
char* fontconfig_select(fc_instance_t* priv, const char* family, int treat_family_as_pattern,
unsigned bold, unsigned italic, int* index, uint32_t code)
{
@@ -249,23 +249,23 @@ char* fontconfig_select(fc_instance_t* priv, const char* family, int treat_famil
if (!res && priv->family_default) {
res = _select_font(priv, priv->family_default, 0, bold, italic, index, code);
if (res)
- mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFontFamily,
+ 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;
- mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFont,
+ mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingDefaultFont,
family, bold, italic, res, *index);
}
if (!res) {
res = _select_font(priv, "Arial", 0, bold, italic, index, code);
if (res)
- mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily,
+ mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_UsingArialFontFamily,
family, bold, italic, res, *index);
}
if (res)
- mp_msg(MSGT_ASS, MSGL_V, "fontconfig_select: (%s, %d, %d) -> %s, %d\n",
+ mp_msg(MSGT_ASS, MSGL_V, "fontconfig_select: (%s, %d, %d) -> %s, %d\n",
family, bold, italic, res, *index);
return res;
}
@@ -316,7 +316,7 @@ static char* validate_fname(char* name)
* \param idx index of the processed font in library->fontdata
* With FontConfig >= 2.4.2, builds a font pattern in memory via FT_New_Memory_Face/FcFreeTypeQueryFace.
* With older FontConfig versions, save the font to ~/.mplayer/fonts.
-*/
+*/
static void process_fontdata(fc_instance_t* priv, ass_library_t* library, FT_Library ftlibrary, int idx)
{
int rc;
@@ -347,7 +347,7 @@ static void process_fontdata(fc_instance_t* priv, ass_library_t* library, FT_Lib
} else if (!S_ISDIR(st.st_mode)) {
mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_NotADirectory, fonts_dir);
}
-
+
fname = validate_fname((char*)name);
snprintf(buf, 1000, "%s/%s", fonts_dir, fname);
@@ -407,14 +407,14 @@ static void process_fontdata(fc_instance_t* priv, ass_library_t* library, FT_Lib
* \param family default font family
* \param path default font path
* \return pointer to fontconfig private data
-*/
+*/
fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, const char* family, const char* path, int fc)
{
int rc;
fc_instance_t* priv = calloc(1, sizeof(fc_instance_t));
const char* dir = library->fonts_dir;
int i;
-
+
if (!fc) {
mp_msg(MSGT_ASS, MSGL_WARN,
MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
@@ -497,9 +497,9 @@ fc_instance_t* fontconfig_init(ass_library_t* library, FT_Library ftlibrary, con
fc_instance_t* priv;
mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_FontconfigDisabledDefaultFontWillBeUsed);
-
+
priv = calloc(1, sizeof(fc_instance_t));
-
+
priv->path_default = strdup(path);
priv->index_default = 0;
return priv;
@@ -514,5 +514,3 @@ void fontconfig_done(fc_instance_t* priv)
if (priv && priv->family_default) free(priv->family_default);
if (priv) free(priv);
}
-
-
diff --git a/libass/ass_library.c b/libass/ass_library.c
index 8c6af464ad..304f2326de 100644
--- a/libass/ass_library.c
+++ b/libass/ass_library.c
@@ -62,13 +62,13 @@ void ass_set_style_overrides(ass_library_t* priv, char** list)
char** p;
char** q;
int cnt;
-
+
if (priv->style_overrides) {
for (p = priv->style_overrides; *p; ++p)
free(*p);
free(priv->style_overrides);
}
-
+
if (!list) return;
for (p = list, cnt = 0; *p; ++p, ++cnt) {}
@@ -91,14 +91,14 @@ void ass_add_font(ass_library_t* priv, char* name, char* data, int size)
if (!name || !data || !size)
return;
grow_array((void**)&priv->fontdata, priv->num_fontdata, sizeof(*priv->fontdata));
-
+
priv->fontdata[idx].name = strdup(name);
-
+
priv->fontdata[idx].data = malloc(size);
memcpy(priv->fontdata[idx].data, data, size);
-
+
priv->fontdata[idx].size = size;
-
+
priv->num_fontdata ++;
}
diff --git a/libass/ass_mp.c b/libass/ass_mp.c
index 7e25b8e316..b3c78b60ac 100644
--- a/libass/ass_mp.c
+++ b/libass/ass_mp.c
@@ -191,7 +191,7 @@ int ass_process_subtitle(ass_track_t* track, subtitle* sub)
mp_msg(MSGT_ASS, MSGL_V, "plaintext event at %" PRId64 ", +%" PRId64 ": %s \n",
(int64_t)event->Start, (int64_t)event->Duration, event->Text);
-
+
return eid;
}
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 9f1686fa96..e3896e89a4 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -119,7 +119,7 @@ typedef struct glyph_info_s {
double blur; // gaussian blur
double shadow;
double frx, fry, frz; // rotation
-
+
bitmap_hash_key_t hash_key;
} glyph_info_t;
@@ -141,11 +141,11 @@ typedef struct text_info_s {
typedef struct render_context_s {
ass_event_t* event;
ass_style_t* style;
-
+
ass_font_t* font;
char* font_path;
double font_size;
-
+
FT_Stroker stroker;
int alignment; // alignment overrides go here; if zero, style value will be used
double frx, fry, frz;
@@ -185,7 +185,7 @@ typedef struct render_context_s {
unsigned bold;
unsigned italic;
int treat_family_as_pattern;
-
+
} render_context_t;
// frame-global data
@@ -248,13 +248,13 @@ ass_renderer_t* ass_renderer_init(ass_library_t* library)
FT_Library ft;
ass_renderer_t* priv = 0;
int vmajor, vminor, vpatch;
-
+
memset(&render_context, 0, sizeof(render_context));
memset(&frame_context, 0, sizeof(frame_context));
memset(&text_info, 0, sizeof(text_info));
error = FT_Init_FreeType( &ft );
- if ( error ) {
+ if ( error ) {
mp_msg(MSGT_ASS, MSGL_FATAL, MSGTR_LIBASS_FT_Init_FreeTypeFailed);
goto ass_init_exit;
}
@@ -276,14 +276,14 @@ ass_renderer_t* ass_renderer_init(ass_library_t* library)
priv->library = library;
priv->ftlibrary = ft;
// images_root and related stuff is zero-filled in calloc
-
+
ass_font_cache_init();
ass_bitmap_cache_init();
ass_composite_cache_init();
ass_glyph_cache_init();
text_info.glyphs = calloc(MAX_GLYPHS, sizeof(glyph_info_t));
-
+
ass_init_exit:
if (priv) mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_LIBASS_Init);
else mp_msg(MSGT_ASS, MSGL_ERR, MSGTR_LIBASS_InitFailed);
@@ -316,7 +316,7 @@ void ass_renderer_done(ass_renderer_t* priv)
static ass_image_t* my_draw_bitmap(unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, uint32_t color)
{
ass_image_t* img = calloc(1, sizeof(ass_image_t));
-
+
img->w = bitmap_w;
img->h = bitmap_h;
img->stride = stride;
@@ -353,7 +353,7 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c
dst_x += bm->left;
dst_y += bm->top;
brk -= bm->left;
-
+
// clipping
clip_x0 = render_context.clip_x0;
clip_y0 = render_context.clip_y0;
@@ -363,7 +363,7 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c
b_y0 = 0;
b_x1 = bm->w;
b_y1 = bm->h;
-
+
tmp = dst_x - clip_x0;
if (tmp < 0) {
mp_msg(MSGT_ASS, MSGL_DBG2, "clip left\n");
@@ -384,13 +384,13 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c
mp_msg(MSGT_ASS, MSGL_DBG2, "clip bottom\n");
b_y1 = bm->h + tmp;
}
-
+
if ((b_y0 >= b_y1) || (b_x0 >= b_x1))
return tail;
if (brk > b_x0) { // draw left part
if (brk > b_x1) brk = b_x1;
- img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + b_x0,
+ img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + b_x0,
brk - b_x0, b_y1 - b_y0, bm->w,
dst_x + b_x0, dst_y + b_y0, color);
*tail = img;
@@ -398,7 +398,7 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c
}
if (brk < b_x1) { // draw right part
if (brk < b_x0) brk = b_x0;
- img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + brk,
+ img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + brk,
b_x1 - brk, b_y1 - b_y0, bm->w,
dst_x + brk, dst_y + b_y0, color2);
*tail = img;
@@ -541,7 +541,7 @@ static ass_image_t* render_text(text_info_t* text_info, int dst_x, int dst_y)
pen_x = dst_x + info->pos.x;
pen_y = dst_y + info->pos.y;
bm = info->bm_o;
-
+
if ((info->effect_type == EF_KARAOKE_KO) && (info->effect_timing <= info->bbox.xMax)) {
// do nothing
} else {
@@ -622,7 +622,7 @@ static int y2scr_sub(double y) {
static void compute_string_bbox( text_info_t* info, FT_BBox *abbox ) {
FT_BBox bbox;
int i;
-
+
if (text_info.length > 0) {
bbox.xMin = 32000;
bbox.xMax = -32000;
@@ -693,7 +693,7 @@ static void update_font(void)
render_context.font = ass_font_new(priv->library, priv->ftlibrary, priv->fontconfig_priv, &desc);
free(desc.family);
-
+
if (render_context.font)
change_font_size(render_context.font_size);
}
@@ -779,7 +779,7 @@ static uint32_t mult_alpha(uint32_t a, uint32_t b)
* \brief Calculate alpha value by piecewise linear function
* Used for \fad, \fade implementation.
*/
-static unsigned interpolate_alpha(long long now,
+static unsigned interpolate_alpha(long long now,
long long t1, long long t2, long long t3, long long t4,
unsigned a1, unsigned a2, unsigned a3)
{
@@ -812,7 +812,7 @@ static void reset_render_context(void);
static char* parse_tag(char* p, double pwr) {
#define skip_to(x) while ((*p != (x)) && (*p != '}') && (*p != 0)) { ++p;}
#define skip(x) if (*p == (x)) ++p; else { return p; }
-
+
skip_to('\\');
skip('\\');
if ((*p == '}') || (*p == 0))
@@ -920,7 +920,7 @@ static char* parse_tag(char* p, double pwr) {
mystrtoll(&p, &t1);
skip(',');
mystrtoll(&p, &t2);
- mp_msg(MSGT_ASS, MSGL_DBG2, "movement6: (%f, %f) -> (%f, %f), (%" PRId64 " .. %" PRId64 ")\n",
+ mp_msg(MSGT_ASS, MSGL_DBG2, "movement6: (%f, %f) -> (%f, %f), (%" PRId64 " .. %" PRId64 ")\n",
x1, y1, x2, y2, (int64_t)t1, (int64_t)t2);
} else {
t1 = 0;
@@ -1115,7 +1115,7 @@ static char* parse_tag(char* p, double pwr) {
k = pow(((double)(t - t1)) / delta_t, v3);
}
while (*p == '\\')
- p = parse_tag(p, k); // maybe k*pwr ? no, specs forbid nested \t's
+ p = parse_tag(p, k); // maybe k*pwr ? no, specs forbid nested \t's
skip_to(')'); // in case there is some unknown tag or a comment
skip(')');
} else if (mystrcmp(&p, "clip")) {
@@ -1297,7 +1297,7 @@ static void apply_transition_effects(ass_event_t* event)
while (cnt < 4 && (p = strchr(p, ';'))) {
v[cnt++] = atoi(++p);
}
-
+
if (strncmp(event->Effect, "Banner;", 7) == 0) {
int delay;
if (cnt < 1) {
@@ -1410,7 +1410,7 @@ static void init_render_context(ass_event_t* event)
render_context.effect_type = EF_NONE;
render_context.effect_timing = 0;
render_context.effect_skip_timing = 0;
-
+
apply_transition_effects(event);
}
@@ -1495,10 +1495,10 @@ static void get_bitmap_glyph(glyph_info_t* info)
{
bitmap_hash_val_t* val;
bitmap_hash_key_t* key = &info->hash_key;
-
+
val = cache_find_bitmap(key);
/* val = 0; */
-
+
if (val) {
info->bm = val->bm;
info->bm_o = val->bm_o;
@@ -1605,7 +1605,7 @@ static void wrap_lines_smart(int max_text_width)
break_at = i;
mp_msg(MSGT_ASS, MSGL_DBG2, "forced line break at %d\n", break_at);
}
-
+
if ((len >= max_text_width) && (frame_context.track->WrapStyle != 2)) {
break_type = 1;
break_at = last_space;
@@ -1622,7 +1622,7 @@ static void wrap_lines_smart(int max_text_width)
// marking break_at+1 as start of a new line
int lead = break_at + 1; // the first symbol of the new line
if (text_info.n_lines >= MAX_LINES) {
- // to many lines !
+ // to many lines !
// no more linebreaks
for (j = lead; j < text_info.length; ++j)
text_info.glyphs[j].linebreak = 0;
@@ -1635,7 +1635,7 @@ static void wrap_lines_smart(int max_text_width)
s_offset = s1->bbox.xMin + s1->pos.x;
text_info.n_lines ++;
}
-
+
if (cur->symbol == ' ')
last_space = i;
@@ -1681,11 +1681,11 @@ static void wrap_lines_smart(int max_text_width)
if (i == text_info.length)
break;
}
-
+
}
assert(text_info.n_lines >= 1);
#undef DIFF
-
+
measure_text();
pen_shift_x = 0;
@@ -1709,7 +1709,7 @@ static void wrap_lines_smart(int max_text_width)
* \brief determine karaoke effects
* Karaoke effects cannot be calculated during parse stage (get_next_char()),
* so they are done in a separate step.
- * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's
+ * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's
* (the first glyph of the karaoke word)'s effect_type and effect_timing.
* This function:
* 1. sets effect_type for all glyphs in the word (_karaoke_ word)
@@ -1884,7 +1884,7 @@ static void transform_3d(FT_Vector shift, FT_Glyph* glyph, FT_Glyph* glyph2, dou
static int ass_render_event(ass_event_t* event, event_images_t* event_images)
{
char* p;
- FT_UInt previous;
+ FT_UInt previous;
FT_UInt num_glyphs;
FT_Vector pen;
unsigned code;
@@ -1920,7 +1920,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
do {
code = get_next_char(&p);
} while (code && render_context.drawing_mode); // skip everything in drawing mode
-
+
// face could have been changed in get_next_char
if (!render_context.font) {
free_render_context();
@@ -1931,7 +1931,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
break;