Mercurial > mplayer.hg
annotate libass/ass_cache.h @ 34116:5f7c090e5ae8
Support H264 from QNAP Systems.
author | cehoyos |
---|---|
date | Sat, 15 Oct 2011 16:33:05 +0000 |
parents | 88eebbbbd6a0 |
children | 6e7f60f6f9d4 |
rev | line source |
---|---|
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
1 /* |
26723 | 2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com> |
3 * | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
4 * This file is part of libass. |
26723 | 5 * |
34011 | 6 * Permission to use, copy, modify, and distribute this software for any |
7 * purpose with or without fee is hereby granted, provided that the above | |
8 * copyright notice and this permission notice appear in all copies. | |
26723 | 9 * |
34011 | 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
26723 | 17 */ |
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
18 |
25897
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
19 #ifndef LIBASS_CACHE_H |
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
20 #define LIBASS_CACHE_H |
18937 | 21 |
26138
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
22 #include "ass.h" |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
23 #include "ass_font.h" |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
24 #include "ass_bitmap.h" |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
25 |
30200 | 26 typedef void (*HashmapItemDtor) (void *key, size_t key_size, |
27 void *value, size_t value_size); | |
28 typedef int (*HashmapKeyCompare) (void *key1, void *key2, | |
29 size_t key_size); | |
30 typedef unsigned (*HashmapHash) (void *key, size_t key_size); | |
18937 | 31 |
30200 | 32 typedef struct hashmap_item { |
33 void *key; | |
34 void *value; | |
35 struct hashmap_item *next; | |
36 } HashmapItem; | |
37 typedef HashmapItem *hashmap_item_p; | |
18937 | 38 |
30200 | 39 typedef struct { |
40 int nbuckets; | |
41 size_t key_size, value_size; | |
42 hashmap_item_p *root; | |
43 HashmapItemDtor item_dtor; // a destructor for hashmap key/value pairs | |
44 HashmapKeyCompare key_compare; | |
45 HashmapHash hash; | |
46 size_t cache_size; | |
47 // stats | |
48 int hit_count; | |
49 int miss_count; | |
50 int count; | |
51 ASS_Library *library; | |
52 } Hashmap; | |
18937 | 53 |
30200 | 54 Hashmap *hashmap_init(ASS_Library *library, size_t key_size, |
55 size_t value_size, int nbuckets, | |
56 HashmapItemDtor item_dtor, | |
57 HashmapKeyCompare key_compare, | |
58 HashmapHash hash); | |
59 void hashmap_done(Hashmap *map); | |
60 void *hashmap_insert(Hashmap *map, void *key, void *value); | |
61 void *hashmap_find(Hashmap *map, void *key); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28789
diff
changeset
|
62 |
30200 | 63 Hashmap *ass_font_cache_init(ASS_Library *library); |
64 ASS_Font *ass_font_cache_find(Hashmap *, ASS_FontDesc *desc); | |
65 void *ass_font_cache_add(Hashmap *, ASS_Font *font); | |
66 void ass_font_cache_done(Hashmap *); | |
18937 | 67 |
30200 | 68 // Create definitions for bitmap_hash_key and glyph_hash_key |
69 #define CREATE_STRUCT_DEFINITIONS | |
70 #include "ass_cache_template.h" | |
18937 | 71 |
30200 | 72 typedef struct { |
73 Bitmap *bm; // the actual bitmaps | |
74 Bitmap *bm_o; | |
75 Bitmap *bm_s; | |
76 } BitmapHashValue; | |
77 | |
78 Hashmap *ass_bitmap_cache_init(ASS_Library *library); | |
79 void *cache_add_bitmap(Hashmap *, BitmapHashKey *key, | |
80 BitmapHashValue *val); | |
81 BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache, | |
82 BitmapHashKey *key); | |
83 Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache); | |
84 void ass_bitmap_cache_done(Hashmap *bitmap_cache); | |
18937 | 85 |
28789
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
86 |
30200 | 87 typedef struct { |
88 unsigned char *a; | |
89 unsigned char *b; | |
90 } CompositeHashValue; | |
28789
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
91 |
30200 | 92 Hashmap *ass_composite_cache_init(ASS_Library *library); |
93 void *cache_add_composite(Hashmap *, CompositeHashKey *key, | |
94 CompositeHashValue *val); | |
95 CompositeHashValue *cache_find_composite(Hashmap *composite_cache, | |
96 CompositeHashKey *key); | |
97 Hashmap *ass_composite_cache_reset(Hashmap *composite_cache); | |
98 void ass_composite_cache_done(Hashmap *composite_cache); | |
28789
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
99 |
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
100 |
30200 | 101 typedef struct { |
102 FT_Glyph glyph; | |
103 FT_Glyph outline_glyph; | |
104 FT_BBox bbox_scaled; // bbox after scaling, but before rotation | |
105 FT_Vector advance; // 26.6, advance distance to the next bitmap in line | |
106 int asc, desc; // ascender/descender of a drawing | |
107 } GlyphHashValue; | |
23018 | 108 |
30200 | 109 Hashmap *ass_glyph_cache_init(ASS_Library *library); |
110 void *cache_add_glyph(Hashmap *, GlyphHashKey *key, | |
111 GlyphHashValue *val); | |
112 GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache, | |
113 GlyphHashKey *key); | |
114 Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache); | |
115 void ass_glyph_cache_done(Hashmap *glyph_cache); | |
23018 | 116 |
30200 | 117 #endif /* LIBASS_CACHE_H */ |