summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2009-07-28 01:42:03 +0200
committerGrigori Goronzy <greg@blackbox>2009-07-28 01:42:03 +0200
commit1ca079bc46a3ddfb5e4d017473324bad67139a88 (patch)
tree65c664a65df9ae42b232f3b1871699c68aa4b386
parentf21c5b6b2788d1ba2073cb4066eedee0de1b249e (diff)
downloadlibass-1ca079bc46a3ddfb5e4d017473324bad67139a88.tar.bz2
libass-1ca079bc46a3ddfb5e4d017473324bad67139a88.tar.xz
Clean up typedefs/structs
Remove useless _s suffix from struct names and remove struct name where not needed (only the typedef'd struct is used). Clean up API headers.
-rw-r--r--libass/ass.c2
-rw-r--r--libass/ass.h7
-rw-r--r--libass/ass_bitmap.c2
-rw-r--r--libass/ass_bitmap.h4
-rw-r--r--libass/ass_cache.h12
-rw-r--r--libass/ass_cache_template.h6
-rw-r--r--libass/ass_drawing.h14
-rw-r--r--libass/ass_font.h4
-rw-r--r--libass/ass_fontconfig.c2
-rw-r--r--libass/ass_fontconfig.h2
-rw-r--r--libass/ass_library.h4
-rw-r--r--libass/ass_render.c30
-rw-r--r--libass/ass_types.h17
13 files changed, 52 insertions, 54 deletions
diff --git a/libass/ass.c b/libass/ass.c
index 37e5e59..12d2451 100644
--- a/libass/ass.c
+++ b/libass/ass.c
@@ -41,7 +41,7 @@
typedef enum { PST_UNKNOWN =
0, PST_INFO, PST_STYLES, PST_EVENTS, PST_FONTS } parser_state_t;
-struct parser_priv_s {
+struct parser_priv {
parser_state_t state;
char *fontname;
char *fontdata;
diff --git a/libass/ass.h b/libass/ass.h
index ddc2d55..8c26153 100644
--- a/libass/ass.h
+++ b/libass/ass.h
@@ -27,9 +27,6 @@
#define LIBASS_VERSION 0x00907000
-/* Libass renderer object. Contents are private. */
-typedef struct ass_renderer_s ass_renderer_t;
-
/*
* A linked list of images produced by an ass renderer.
*
@@ -39,7 +36,7 @@ typedef struct ass_renderer_s ass_renderer_t;
* The last bitmap row is not guaranteed to be padded up to stride size,
* e.g. in the worst case a bitmap has the size stride * (h - 1) + w.
*/
-typedef struct ass_image_s {
+typedef struct ass_image {
int w, h; // Bitmap width/height
int stride; // Bitmap stride
unsigned char *bitmap; // 1bpp stride*h alpha buffer
@@ -48,7 +45,7 @@ typedef struct ass_image_s {
uint32_t color; // Bitmap color and alpha, RGBA
int dst_x, dst_y; // Bitmap placement inside the video frame
- struct ass_image_s *next; // Next image, or NULL
+ struct ass_image *next; // Next image, or NULL
} ass_image_t;
/*
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
index 3bd7c7e..39c4996 100644
--- a/libass/ass_bitmap.c
+++ b/libass/ass_bitmap.c
@@ -28,7 +28,7 @@
#include "ass_utils.h"
#include "ass_bitmap.h"
-struct ass_synth_priv_s {
+struct ass_synth_priv {
int tmp_w, tmp_h;
unsigned short *tmp;
diff --git a/libass/ass_bitmap.h b/libass/ass_bitmap.h
index 2e34a5c..f7d8fc2 100644
--- a/libass/ass_bitmap.h
+++ b/libass/ass_bitmap.h
@@ -26,12 +26,12 @@
#include "ass.h"
-typedef struct ass_synth_priv_s ass_synth_priv_t;
+typedef struct ass_synth_priv ass_synth_priv_t;
ass_synth_priv_t *ass_synth_init(double);
void ass_synth_done(ass_synth_priv_t *priv);
-typedef struct bitmap_s {
+typedef struct {
int left, top;
int w, h; // width, height
unsigned char *buffer; // w x h buffer
diff --git a/libass/ass_cache.h b/libass/ass_cache.h
index e31d8cf..c2c6d2a 100644
--- a/libass/ass_cache.h
+++ b/libass/ass_cache.h
@@ -31,14 +31,14 @@ 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);
-typedef struct hashmap_item_s {
+typedef struct hashmap_item {
void *key;
void *value;
- struct hashmap_item_s *next;
+ struct hashmap_item *next;
} hashmap_item_t;
typedef hashmap_item_t *hashmap_item_p;
-typedef struct hashmap_s {
+typedef struct {
int nbuckets;
size_t key_size, value_size;
hashmap_item_p *root;
@@ -71,7 +71,7 @@ void ass_font_cache_done(hashmap_t *);
#define CREATE_STRUCT_DEFINITIONS
#include "ass_cache_template.h"
-typedef struct bitmap_hash_val_s {
+typedef struct {
bitmap_t *bm; // the actual bitmaps
bitmap_t *bm_o;
bitmap_t *bm_s;
@@ -86,7 +86,7 @@ hashmap_t *ass_bitmap_cache_reset(hashmap_t *bitmap_cache);
void ass_bitmap_cache_done(hashmap_t *bitmap_cache);
-typedef struct composite_hash_val_s {
+typedef struct {
unsigned char *a;
unsigned char *b;
} composite_hash_val_t;
@@ -100,7 +100,7 @@ hashmap_t *ass_composite_cache_reset(hashmap_t *composite_cache);
void ass_composite_cache_done(hashmap_t *composite_cache);
-typedef struct glyph_hash_val_s {
+typedef struct {
FT_Glyph glyph;
FT_Glyph outline_glyph;
FT_BBox bbox_scaled; // bbox after scaling, but before rotation
diff --git a/libass/ass_cache_template.h b/libass/ass_cache_template.h
index d7eedaf..08bce24 100644
--- a/libass/ass_cache_template.h
+++ b/libass/ass_cache_template.h
@@ -54,7 +54,7 @@
// describes a bitmap; bitmaps with equivalents structs are considered identical
-START(bitmap, bipmap_hash_key_s)
+START(bitmap, bipmap_hash_key)
GENERIC(char, bitmap) // bool : true = bitmap, false = outline
GENERIC(ass_font_t *, font)
GENERIC(double, size) // font size
@@ -82,7 +82,7 @@ START(bitmap, bipmap_hash_key_s)
END(bitmap_hash_key_t)
// describes an outline glyph
-START(glyph, glyph_hash_key_s)
+START(glyph, glyph_hash_key)
GENERIC(ass_font_t *, font)
GENERIC(double, size) // font size
GENERIC(uint32_t, ch) // character code
@@ -96,7 +96,7 @@ START(glyph, glyph_hash_key_s)
END(glyph_hash_key_t)
// Cache for composited bitmaps
-START(composite, composite_hash_key_s)
+START(composite, composite_hash_key)
GENERIC(int, aw)
GENERIC(int, ah)
GENERIC(int, bw)
diff --git a/libass/ass_drawing.h b/libass/ass_drawing.h
index 25cc4a7..54ef3d0 100644
--- a/libass/ass_drawing.h
+++ b/libass/ass_drawing.h
@@ -26,7 +26,7 @@
#define DRAWING_INITIAL_SIZE 256
-enum ass_token_type {
+typedef enum {
TOKEN_MOVE,
TOKEN_MOVE_NC,
TOKEN_LINE,
@@ -35,16 +35,16 @@ enum ass_token_type {
TOKEN_B_SPLINE,
TOKEN_EXTEND_SPLINE,
TOKEN_CLOSE
-};
+} ass_token_type_t;
-typedef struct ass_drawing_token_s {
- enum ass_token_type type;
+typedef struct ass_drawing_token {
+ ass_token_type_t type;
FT_Vector point;
- struct ass_drawing_token_s *next;
- struct ass_drawing_token_s *prev;
+ struct ass_drawing_token *next;
+ struct ass_drawing_token *prev;
} ass_drawing_token_t;
-typedef struct ass_drawing_s {
+typedef struct {
char *text; // drawing string
int i; // text index
int scale; // scale (1-64) for subpixel accuracy
diff --git a/libass/ass_font.h b/libass/ass_font.h
index ecba153..920866b 100644
--- a/libass/ass_font.h
+++ b/libass/ass_font.h
@@ -31,14 +31,14 @@
#define DECO_UNDERLINE 1
#define DECO_STRIKETHROUGH 2
-typedef struct ass_font_desc_s {
+typedef struct {
char *family;
unsigned bold;
unsigned italic;
int treat_family_as_pattern;
} ass_font_desc_t;
-typedef struct ass_font_s {
+typedef struct {
ass_font_desc_t desc;
ass_library_t *library;
FT_Library ftlibrary;
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
index eb75c0b..3b81563 100644
--- a/libass/ass_fontconfig.c
+++ b/libass/ass_fontconfig.c
@@ -40,7 +40,7 @@
#include <fontconfig/fcfreetype.h>
#endif
-struct fc_instance_s {
+struct fc_instance {
#ifdef CONFIG_FONTCONFIG
FcConfig *config;
#endif
diff --git a/libass/ass_fontconfig.h b/libass/ass_fontconfig.h
index 24c164d..25b596d 100644
--- a/libass/ass_fontconfig.h
+++ b/libass/ass_fontconfig.h
@@ -31,7 +31,7 @@
#include <fontconfig/fontconfig.h>
#endif
-typedef struct fc_instance_s fc_instance_t;
+typedef struct fc_instance fc_instance_t;
fc_instance_t *fontconfig_init(ass_library_t *library,
FT_Library ftlibrary, const char *family,
diff --git a/libass/ass_library.h b/libass/ass_library.h
index e6b37e8..40c46a7 100644
--- a/libass/ass_library.h
+++ b/libass/ass_library.h
@@ -23,13 +23,13 @@
#include <stdarg.h>
-typedef struct ass_fontdata_s {
+typedef struct {
char *name;
char *data;
int size;
} ass_fontdata_t;
-struct ass_library_s {
+struct ass_library {
char *fonts_dir;
int extract_fonts;
char **style_overrides;
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 212a158..418fceb 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -47,24 +47,24 @@
#define GLYPH_CACHE_MAX 1000
#define BITMAP_CACHE_MAX_SIZE 50 * 1048576;
-typedef struct double_bbox_s {
+typedef struct {
double xMin;
double xMax;
double yMin;
double yMax;
} double_bbox_t;
-typedef struct double_vector_s {
+typedef struct {
double x;
double y;
} double_vector_t;
-typedef struct free_list_s {
+typedef struct free_list {
void *object;
- struct free_list_s *next;
+ struct free_list *next;
} free_list_t;
-typedef struct ass_settings_s {
+typedef struct {
int frame_width;
int frame_height;
double font_size_coeff; // font size multiplier
@@ -84,7 +84,7 @@ typedef struct ass_settings_s {
} ass_settings_t;
// a rendered event
-typedef struct event_images_s {
+typedef struct {
ass_image_t *imgs;
int top, height;
int detect_collisions;
@@ -97,7 +97,7 @@ typedef enum { EF_NONE = 0, EF_KARAOKE, EF_KARAOKE_KF, EF_KARAOKE_KO
// describes a glyph
// glyph_info_t and text_info_t are used for text centering and word-wrapping operations
-typedef struct glyph_info_s {
+typedef struct {
unsigned symbol;
FT_Glyph glyph;
FT_Glyph outline_glyph;
@@ -126,11 +126,11 @@ typedef struct glyph_info_s {
bitmap_hash_key_t hash_key;
} glyph_info_t;
-typedef struct line_info_s {
+typedef struct {
double asc, desc;
} line_info_t;
-typedef struct text_info_s {
+typedef struct {
glyph_info_t *glyphs;
int length;
line_info_t *lines;
@@ -143,7 +143,7 @@ typedef struct text_info_s {
// Renderer state.
// Values like current font face, color, screen position, clipping and so on are stored here.
-typedef struct render_context_s {
+typedef struct {
ass_event_t *event;
ass_style_t *style;
@@ -201,7 +201,7 @@ typedef struct render_context_s {
} render_context_t;
-typedef struct cache_store_s {
+typedef struct {
hashmap_t *font_cache;
hashmap_t *glyph_cache;
hashmap_t *bitmap_cache;
@@ -210,7 +210,7 @@ typedef struct cache_store_s {
size_t bitmap_max_size;
} cache_store_t;
-struct ass_renderer_s {
+struct ass_renderer {
ass_library_t *library;
FT_Library ftlibrary;
fc_instance_t *fontconfig_priv;
@@ -244,7 +244,7 @@ struct ass_renderer_s {
free_list_t *free_tail;
};
-struct render_priv_s {
+struct render_priv {
int top, height;
int render_id;
};
@@ -414,7 +414,7 @@ static ass_image_t *my_draw_bitmap(unsigned char *bitmap, int bitmap_w,
static double x2scr_pos(ass_renderer_t *render_priv, double x);
static double y2scr_pos(ass_renderer_t *render_priv, double y);
-typedef struct rect_s {
+typedef struct {
int x0;
int y0;
int x1;
@@ -3349,7 +3349,7 @@ static render_priv_t *get_render_priv(ass_renderer_t *render_priv,
return event->render_priv;
}
-typedef struct segment_s {
+typedef struct {
int a, b; // top and height
} segment_t;
diff --git a/libass/ass_types.h b/libass/ass_types.h
index fb74872..ddd8841 100644
--- a/libass/ass_types.h
+++ b/libass/ass_types.h
@@ -30,8 +30,14 @@
#define HALIGN_CENTER 2
#define HALIGN_RIGHT 3
+/* Opaque objects internally used by libass. Contents are private. */
+typedef struct ass_renderer ass_renderer_t;
+typedef struct render_priv render_priv_t;
+typedef struct parser_priv parser_priv_t;
+typedef struct ass_library ass_library_t;
+
/* ASS Style: line */
-typedef struct ass_style_s {
+typedef struct {
char *Name;
char *FontName;
double FontSize;
@@ -58,13 +64,11 @@ typedef struct ass_style_s {
int treat_fontname_as_pattern;
} ass_style_t;
-typedef struct render_priv_s render_priv_t;
-
/*
* ass_event_t corresponds to a single Dialogue line;
* text is stored as-is, style overrides will be parsed later.
*/
-typedef struct ass_event_s {
+typedef struct {
long long Start; // ms
long long Duration; // ms
@@ -81,15 +85,12 @@ typedef struct ass_event_s {
render_priv_t *render_priv;
} ass_event_t;
-typedef struct parser_priv_s parser_priv_t;
-typedef struct ass_library_s ass_library_t;
-
/*
* ass track represent either an external script or a matroska subtitle stream
* (no real difference between them); it can be used in rendering after the
* headers are parsed (i.e. events format line read).
*/
-typedef struct ass_track_s {
+typedef struct {
int n_styles; // amount used
int max_styles; // amount allocated
int n_events;