]> granicus.if.org Git - libass/commitdiff
whitespace cosmetics: Remove all trailing whitespace.
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>
Wed, 13 May 2009 02:58:57 +0000 (02:58 +0000)
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>
Wed, 13 May 2009 02:58:57 +0000 (02:58 +0000)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2

12 files changed:
libass/ass.c
libass/ass.h
libass/ass_bitmap.c
libass/ass_cache.c
libass/ass_cache.h
libass/ass_font.c
libass/ass_fontconfig.c
libass/ass_library.c
libass/ass_mp.c
libass/ass_render.c
libass/ass_types.h
libass/ass_utils.c

index b0c38c2ce4895e8af82fd42c592691066cbac724..822f1e03f8a3dadf243f76d847d1bb83bae26d84 100644 (file)
@@ -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;
index 4bdea3a4aae5b0cf21b0192ccd359ac802d3f7b4..e98b4264b704f44292c2a534c6925c6b8108df60 100644 (file)
@@ -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
index 61457f1fcc5dae1fabbbf9f72f384b434c307dc8..15d583ac48fe6ece292494dc4ab7979cdc95d125 100644 (file)
@@ -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)
index 3b90e66e4ccf61435bfd744cfddb4a8c22768256..dc217bd75e69bc6a0209d6d42ada094021fffcbe 100644 (file)
@@ -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) {
@@ -254,7 +254,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);
@@ -302,7 +302,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);
index f7042bed6cf1d2889bdd24cf7becbdf721236357..59ac8cee2a230e929e84d7e220955910e0e9565d 100644 (file)
@@ -49,7 +49,7 @@ typedef struct bitmap_hash_key_s {
        int shift_x, shift_y; // shift vector that was added to glyph before applying rotation
                              // = 0, if frx = fry = frx = 0
                              // = (glyph base point) - (rotation origin), otherwise
-       
+
        FT_Vector advance; // subpixel shift vector
 } bitmap_hash_key_t;
 
@@ -110,7 +110,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);
index 579e658f14d83d0e79018056f69a446695dc136c..e1290214390e06b7e577be64c67cc398b117552d 100644 (file)
@@ -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;
 }
 
index a54bc8c4afe40bdd8cbe9a8ca8b1104e386b1212..2e7b5f0f647530188104cdecc54247b4868e6ce4 100644 (file)
@@ -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;
index 8c6af464ad6767a50c3eca64c0edee2ec012a1a6..304f2326de2dab1a0269ba9e8a71cd4defdb468a 100644 (file)
@@ -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 ++;
 }
 
index 7e25b8e31603109b6c913791e2b6862cef0282ab..b3c78b60ac544a0fb7a8d6fe6af8edd6413908da 100644 (file)
@@ -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;
 }
 
index 2b59e0d2f7a9a7b9c1b3b7a0714cb847e8672574..f13f76661e4feea5bd1e624886b91a82f81736df 100644 (file)
@@ -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;
@@ -1112,7 +1112,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")) {
@@ -1294,7 +1294,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) {
@@ -1407,7 +1407,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);
 }
 
@@ -1492,10 +1492,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;
@@ -1602,7 +1602,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;
@@ -1619,7 +1619,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;
@@ -1632,7 +1632,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;
 
@@ -1678,11 +1678,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;
@@ -1706,7 +1706,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)
@@ -1881,7 +1881,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;
@@ -1917,7 +1917,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();
@@ -1928,7 +1928,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
                        break;
 
                if (text_info.length >= MAX_GLYPHS) {
-                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_MAX_GLYPHS_Reached, 
+                       mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_LIBASS_MAX_GLYPHS_Reached,
                                        (int)(event - frame_context.track->events), event->Start, event->Duration, event->Text);
                        break;
                }
@@ -1954,14 +1954,14 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
                                       &shift );
 
                get_outline_glyph(code, text_info.glyphs + text_info.length, &shift);
-               
+
                text_info.glyphs[text_info.length].pos.x = pen.x >> 6;
                text_info.glyphs[text_info.length].pos.y = pen.y >> 6;
-               
+
                pen.x += text_info.glyphs[text_info.length].advance.x;
                pen.x += double_to_d6(render_context.hspacing);
                pen.y += text_info.glyphs[text_info.length].advance.y;
-               
+
                previous = code;
 
                text_info.glyphs[text_info.length].symbol = code;
@@ -2008,23 +2008,23 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
                render_context.effect_timing = 0;
                render_context.effect_skip_timing = 0;
        }
-       
+
        if (text_info.length == 0) {
                // no valid symbols in the event; this can be smth like {comment}
                free_render_context();
                return 1;
        }
-       
+
        // depends on glyph x coordinates being monotonous, so it should be done before line wrap
        process_karaoke_effects();
-       
+
        // alignments
        alignment = render_context.alignment;
        halign = alignment & 3;
        valign = alignment & 12;
 
-       MarginL = (event->MarginL) ? event->MarginL : render_context.style->MarginL; 
-       MarginR = (event->MarginR) ? event->MarginR : render_context.style->MarginR; 
+       MarginL = (event->MarginL) ? event->MarginL : render_context.style->MarginL;
+       MarginR = (event->MarginR) ? event->MarginR : render_context.style->MarginR;
        MarginV = (event->MarginV) ? event->MarginV : render_context.style->MarginV;
 
        if (render_context.evt_type != EVENT_HSCROLL) {
@@ -2064,12 +2064,12 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
        } else { // render_context.evt_type == EVENT_HSCROLL
                measure_text();
        }
-       
+
        // determing text bounding box
        compute_string_bbox(&text_info, &bbox);
-       
+
        // determine device coordinates for text
-       
+
        // x coordinate for everything except positioned events
        if (render_context.evt_type == EVENT_NORMAL ||
            render_context.evt_type == EVENT_VSCROLL) {
@@ -2114,7 +2114,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
                device_x = x2scr_pos(render_context.pos_x) - base_x;
                device_y = y2scr_pos(render_context.pos_y) - base_y;
        }
-       
+
        // fix clip coordinates (they depend on alignment)
        if (render_context.evt_type == EVENT_NORMAL ||
            render_context.evt_type == EVENT_HSCROLL ||
@@ -2141,7 +2141,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
        // calculate rotation parameters
        {
                FT_Vector center;
-               
+
                if (render_context.have_origin) {
                        center.x = x2scr(render_context.org_x);
                        center.y = y2scr(render_context.org_y);
@@ -2178,7 +2178,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
        event_images->imgs = render_text(&text_info, device_x, device_y);
 
        free_render_context();
-       
+
        return 0;
 }
 
@@ -2304,7 +2304,7 @@ static int ass_start_frame(ass_renderer_t *priv, ass_track_t* track, long long n
 
        if (track->n_events == 0)
                return 1; // nothing to do
-       
+
        frame_context.ass_priv = priv;
        frame_context.width = global_settings->frame_width;
        frame_context.height = global_settings->frame_height;
@@ -2320,7 +2320,7 @@ static int ass_start_frame(ass_renderer_t *priv, ass_track_t* track, long long n
        frame_context.time = now;
 
        ass_lazy_track_init();
-       
+
        frame_context.font_scale = global_settings->font_size_coeff *
                                   frame_context.orig_height / frame_context.track->PlayResY;
        if (frame_context.track->ScaledBorderAndShadow)
@@ -2430,7 +2430,7 @@ static int fit_segment(segment_t* s, segment_t* fixed, int* cnt, int dir)
        fixed[*cnt].b = s->b + shift;
        (*cnt)++;
        qsort(fixed, *cnt, sizeof(segment_t), cmp_segment);
-       
+
        return shift;
 }
 
@@ -2485,7 +2485,7 @@ static void fix_collisions(event_images_t* imgs, int cnt)
                        priv->top = imgs[i].top;
                        priv->height = imgs[i].height;
                }
-               
+
        }
 }
 
@@ -2558,7 +2558,7 @@ ass_image_t* ass_render_frame(ass_renderer_t *priv, ass_track_t* track, long lon
        int i, cnt, rc;
        event_images_t* last;
        ass_image_t** tail;
-       
+
        // init frame
        rc = ass_start_frame(priv, track, now);
        if (rc != 0)
@@ -2604,7 +2604,7 @@ ass_image_t* ass_render_frame(ass_renderer_t *priv, ass_track_t* track, long lon
 
        if (detect_change)
                *detect_change = ass_detect_change(priv);
-       
+
        // free the previous image list
        ass_free_images(priv->prev_images_root);
        priv->prev_images_root = 0;
index 01c36c57483aa627cf2c134264faa01fe3496d39..d43fef3137fcdaa83de860a191904e360fdbdfc5 100644 (file)
@@ -100,7 +100,7 @@ typedef struct ass_track_s {
        char* event_format; // event format line
 
        enum {TRACK_TYPE_UNKNOWN = 0, TRACK_TYPE_ASS, TRACK_TYPE_SSA} track_type;
-       
+
        // script header fields
        int PlayResX;
        int PlayResY;
@@ -108,7 +108,7 @@ typedef struct ass_track_s {
        int WrapStyle;
        char ScaledBorderAndShadow;
 
-       
+
        int default_style; // index of default style
        char* name; // file name in case of external subs, 0 for streams
 
index 7f728f1bb1031ed9132c4bab900cad5244364c25..9a89e8afae426622fb90f60fbe22dd3b0d877eea 100644 (file)
@@ -72,17 +72,17 @@ int strtocolor(char** q, uint32_t* res)
        uint32_t color = 0;
        int result;
        char* p = *q;
-       
-       if (*p == '&') ++p; 
+
+       if (*p == '&') ++p;
        else mp_msg(MSGT_ASS, MSGL_DBG2, "suspicious color format: \"%s\"\n", p);
-       
-       if (*p == 'H' || *p == 'h') { 
+
+       if (*p == 'H' || *p == 'h') {
                ++p;
                result = mystrtou32(&p, 16, &color);
        } else {
                result = mystrtou32(&p, 0, &color);
        }
-       
+
        {
                unsigned char* tmp = (unsigned char*)(&color);
                unsigned char b;