annotate libass/ass_render.h @ 37194:d773c8901dd8

demux_lavf: set stream_pts if possible.
author reimar
date Sun, 28 Sep 2014 12:21:42 +0000
parents c3aaaf17c721
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
1 /*
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
3 * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
4 *
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
5 * This file is part of libass.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
6 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
7 * Permission to use, copy, modify, and distribute this software for any
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
8 * purpose with or without fee is hereby granted, provided that the above
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
9 * copyright notice and this permission notice appear in all copies.
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
10 *
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
18 */
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
19
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
20 #ifndef LIBASS_RENDER_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
21 #define LIBASS_RENDER_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
22
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
23 #include <inttypes.h>
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
24 #include <ft2build.h>
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
25 #include FT_FREETYPE_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
26 #include FT_STROKER_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
27 #include FT_GLYPH_H
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
28 #include FT_SYNTHESIS_H
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
29 #ifdef CONFIG_HARFBUZZ
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
30 #include "hb.h"
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
31 #endif
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
32
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
33 // XXX: fix the inclusion mess so we can avoid doing this here
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
34 typedef struct ass_shaper ASS_Shaper;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
35
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
36 #include "ass.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
37 #include "ass_font.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
38 #include "ass_bitmap.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
39 #include "ass_cache.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
40 #include "ass_utils.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
41 #include "ass_fontconfig.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
42 #include "ass_library.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
43 #include "ass_drawing.h"
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
44
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
45 #define GLYPH_CACHE_MAX 1000
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
46 #define BITMAP_CACHE_MAX_SIZE 30 * 1048576
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
47
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
48 #define PARSED_FADE (1<<0)
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
49 #define PARSED_A (1<<1)
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
50
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
51 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
52 double xMin;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
53 double xMax;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
54 double yMin;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
55 double yMax;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
56 } DBBox;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
57
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
58 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
59 double x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
60 double y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
61 } DVector;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
62
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
63 typedef struct free_list {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
64 void *object;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
65 struct free_list *next;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
66 } FreeList;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
67
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
68 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
69 int frame_width;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
70 int frame_height;
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
71 int storage_width; // width of the source image
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
72 int storage_height; // height of the source image
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
73 double font_size_coeff; // font size multiplier
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
74 double line_spacing; // additional line spacing (in frame pixels)
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
75 double line_position; // vertical position for subtitles, 0-100 (0 = no change)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
76 int top_margin; // height of top margin. Everything except toptitles is shifted down by top_margin.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
77 int bottom_margin; // height of bottom margin. (frame_height - top_margin - bottom_margin) is original video height.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
78 int left_margin;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
79 int right_margin;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
80 int use_margins; // 0 - place all subtitles inside original frame
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
81 // 1 - use margins for placing toptitles and subtitles
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
82 double par; // user defined pixel aspect ratio (0 = unset)
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
83 ASS_Hinting hinting;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
84 ASS_ShapingLevel shaper;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
85
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
86 char *default_font;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
87 char *default_family;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
88 } ASS_Settings;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
89
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
90 // a rendered event
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
91 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
92 ASS_Image *imgs;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
93 int top, height, left, width;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
94 int detect_collisions;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
95 int shift_direction;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
96 ASS_Event *event;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
97 } EventImages;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
98
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
99 typedef enum {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
100 EF_NONE = 0,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
101 EF_KARAOKE,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
102 EF_KARAOKE_KF,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
103 EF_KARAOKE_KO
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
104 } Effect;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
105
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
106 // describes a glyph
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
107 // GlyphInfo and TextInfo are used for text centering and word-wrapping operations
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
108 typedef struct glyph_info {
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
109 unsigned symbol;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
110 unsigned skip; // skip glyph when layouting text
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
111 ASS_Font *font;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
112 int face_index;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
113 int glyph_index;
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
114 #ifdef CONFIG_HARFBUZZ
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
115 hb_script_t script;
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
116 #else
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
117 int script;
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
118 #endif
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
119 double font_size;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
120 ASS_Drawing *drawing;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
121 FT_Outline *outline;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
122 FT_Outline *border;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
123 Bitmap *bm; // glyph bitmap
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
124 Bitmap *bm_o; // outline bitmap
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
125 Bitmap *bm_s; // shadow bitmap
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
126 FT_BBox bbox;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
127 FT_Vector pos;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
128 FT_Vector offset;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
129 char linebreak; // the first (leading) glyph of some line ?
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
130 uint32_t c[4]; // colors
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
131 FT_Vector advance; // 26.6
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
132 FT_Vector cluster_advance;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
133 Effect effect_type;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
134 int effect_timing; // time duration of current karaoke word
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
135 // after process_karaoke_effects: distance in pixels from the glyph origin.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
136 // part of the glyph to the left of it is displayed in a different color.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
137 int effect_skip_timing; // delay after the end of last karaoke word
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
138 int asc, desc; // font max ascender and descender
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
139 int be; // blur edges
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
140 double blur; // gaussian blur
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
141 double shadow_x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
142 double shadow_y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
143 double frx, fry, frz; // rotation
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
144 double fax, fay; // text shearing
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
145 double scale_x, scale_y;
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
146 int border_style;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
147 double border_x, border_y;
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
148 double hspacing;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
149 unsigned italic;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
150 unsigned bold;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
151 int flags;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
152
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
153 int bm_run_id;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
154 int shape_run_id;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
155
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
156 BitmapHashKey hash_key;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
157
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
158 // next glyph in this cluster
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
159 struct glyph_info *next;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
160 } GlyphInfo;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
161
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
162 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
163 double asc, desc;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
164 int offset, len;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
165 } LineInfo;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
166
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
167 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
168 GlyphInfo *glyphs;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
169 int length;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
170 LineInfo *lines;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
171 int n_lines;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
172 double height;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
173 int max_glyphs;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
174 int max_lines;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
175 } TextInfo;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
176
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
177 // Renderer state.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
178 // Values like current font face, color, screen position, clipping and so on are stored here.
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
179 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
180 ASS_Event *event;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
181 ASS_Style *style;
34011
88eebbbbd6a0 Update included libass copy to 0.9.13 release.
reimar
parents: 31853
diff changeset
182 int parsed_tags;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
183
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
184 ASS_Font *font;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
185 double font_size;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
186 int flags; // decoration flags (underline/strike-through)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
187
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
188 FT_Stroker stroker;
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
189 int stroker_radius; // last stroker radius, for caching stroker objects
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
190 int alignment; // alignment overrides go here; if zero, style value will be used
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
191 double frx, fry, frz;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
192 double fax, fay; // text shearing
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
193 enum {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
194 EVENT_NORMAL, // "normal" top-, sub- or mid- title
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
195 EVENT_POSITIONED, // happens after pos(,), margins are ignored
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
196 EVENT_HSCROLL, // "Banner" transition effect, text_width is unlimited
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
197 EVENT_VSCROLL // "Scroll up", "Scroll down" transition effects
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
198 } evt_type;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
199 double pos_x, pos_y; // position
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
200 double org_x, org_y; // origin
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
201 char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
202 double scale_x, scale_y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
203 double hspacing; // distance between letters, in pixels
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
204 int border_style;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
205 double border_x; // outline width
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
206 double border_y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
207 uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
208 int clip_x0, clip_y0, clip_x1, clip_y1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
209 char clip_mode; // 1 = iclip
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
210 char detect_collisions;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
211 uint32_t fade; // alpha from \fad
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
212 char be; // blur edges
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
213 double blur; // gaussian blur
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
214 double shadow_x;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
215 double shadow_y;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
216 int drawing_mode; // not implemented; when != 0 text is discarded, except for style override tags
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
217 ASS_Drawing *drawing; // current drawing
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
218 ASS_Drawing *clip_drawing; // clip vector
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
219 int clip_drawing_mode; // 0 = regular clip, 1 = inverse clip
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
220
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
221 Effect effect_type;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
222 int effect_timing;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
223 int effect_skip_timing;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
224
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
225 // bitmap run id (used for final bitmap rendering)
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
226 int bm_run_id;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
227
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
228 enum {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
229 SCROLL_LR, // left-to-right
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
230 SCROLL_RL,
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
231 SCROLL_TB, // top-to-bottom
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
232 SCROLL_BT
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
233 } scroll_direction; // for EVENT_HSCROLL, EVENT_VSCROLL
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
234 int scroll_shift;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
235
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
236 // face properties
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
237 char *family;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
238 unsigned bold;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
239 unsigned italic;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
240 int treat_family_as_pattern;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
241 int wrap_style;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
242 int font_encoding;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
243 } RenderContext;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
244
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
245 typedef struct {
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
246 Cache *font_cache;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
247 Cache *outline_cache;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
248 Cache *bitmap_cache;
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
249 Cache *composite_cache;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
250 size_t glyph_max;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
251 size_t bitmap_max_size;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
252 } CacheStore;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
253
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
254 struct ass_renderer {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
255 ASS_Library *library;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
256 FT_Library ftlibrary;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
257 FCInstance *fontconfig_priv;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
258 ASS_Settings settings;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
259 int render_id;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
260 ASS_SynthPriv *synth_priv;
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
261 ASS_Shaper *shaper;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
262
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
263 ASS_Image *images_root; // rendering result is stored here
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
264 ASS_Image *prev_images_root;
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
265 int cache_cleared;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
266
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
267 EventImages *eimg; // temporary buffer for sorting rendered events
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
268 int eimg_size; // allocated buffer size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
269
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
270 // frame-global data
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
271 int width, height; // screen dimensions
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
272 int orig_height; // frame height ( = screen height - margins )
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
273 int orig_width; // frame width ( = screen width - margins )
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
274 int orig_height_nocrop; // frame height ( = screen height - margins + cropheight)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
275 int orig_width_nocrop; // frame width ( = screen width - margins + cropwidth)
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
276 int storage_height; // video height before any rescaling
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
277 int storage_width; // video width before any rescaling
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
278 ASS_Track *track;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
279 long long time; // frame's timestamp, ms
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
280 double font_scale;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
281 double font_scale_x; // x scale applied to all glyphs to preserve text aspect ratio
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
282 double border_scale;
36363
c3aaaf17c721 Update libass to latest git version.
reimar
parents: 35262
diff changeset
283 double blur_scale;
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
284
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
285 RenderContext state;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
286 TextInfo text_info;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
287 CacheStore cache;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
288
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
289 FreeList *free_head;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
290 FreeList *free_tail;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
291 };
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
292
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
293 typedef struct render_priv {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
294 int top, height, left, width;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
295 int render_id;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
296 } RenderPriv;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
297
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
298 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
299 int x0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
300 int y0;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
301 int x1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
302 int y1;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
303 } Rect;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
304
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
305 typedef struct {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
306 int a, b; // top and height
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
307 int ha, hb; // left and width
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
308 } Segment;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
309
35262
49fc594fda43 Updated libass to 0.10.1
SubJunk
parents: 34295
diff changeset
310 void reset_render_context(ASS_Renderer *render_priv, ASS_Style *style);
31853
e64df5862cea Import libass 0.9.10
greg
parents: 30200
diff changeset
311 void ass_free_images(ASS_Image *img);
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
312
34295
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
313 // XXX: this is actually in ass.c, includes should be fixed later on
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
314 void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track);
6e7f60f6f9d4 Update libass to 0.10 release.
reimar
parents: 34011
diff changeset
315
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
316 #endif /* LIBASS_RENDER_H */