annotate libvo/font_load.h @ 28992:947ef23ba798

Test if create_vdp_decoder() might succeed by calling it from config() with a small value for max_reference_frames. This does not make automatic recovery by using software decoder possible, but lets MPlayer fail more graciously on - actually existing - buggy hardware that does not support certain H264 widths when using hardware accelerated decoding (784, 864, 944, 1024, 1808, 1888 pixels on NVIDIA G98) and if the user tries to hardware-decode more samples at the same time than supported. Might break playback of H264 Intra-Only samples on hardware with very little video memory.
author cehoyos
date Sat, 21 Mar 2009 20:11:05 +0000
parents 7681eab10aea
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
1 /*
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
2 * This file is part of MPlayer.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
3 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
5 * it under the terms of the GNU General Public License as published by
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
7 * (at your option) any later version.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
8 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
12 * GNU General Public License for more details.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
13 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
14 * You should have received a copy of the GNU General Public License along
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
17 */
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 28241
diff changeset
18
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
19 #ifndef MPLAYER_FONT_LOAD_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
20 #define MPLAYER_FONT_LOAD_H
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
21
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27013
diff changeset
22 #ifdef CONFIG_FREETYPE
11500
b4fcb6c47942 freetype build fix
henry
parents: 8635
diff changeset
23 #include <ft2build.h>
b4fcb6c47942 freetype build fix
henry
parents: 8635
diff changeset
24 #include FT_FREETYPE_H
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
25 #endif
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
26
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
27 typedef struct {
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
28 unsigned char *bmp;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
29 unsigned char *pal;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
30 int w,h,c;
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27013
diff changeset
31 #ifdef CONFIG_FREETYPE
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
32 int charwidth,charheight,pen,baseline,padding;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
33 int current_count, current_alloc;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
34 #endif
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
35 } raw_file;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
36
27013
1c35679cdd65 Give name to font_desc struct, patch by Bryan Henderson, giraffedata gmail com.
diego
parents: 26029
diff changeset
37 typedef struct font_desc {
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27013
diff changeset
38 #ifdef CONFIG_FREETYPE
7140
b9ce54c7f30f add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents: 7122
diff changeset
39 int dynamic;
b9ce54c7f30f add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents: 7122
diff changeset
40 #endif
214
09d0f437b817 desc fileformat changes
arpi_esp
parents: 213
diff changeset
41 char *name;
1353
c3e3b0ae4d06 Applied DATADIR patch by Vladimir Kushnir
arpi
parents: 706
diff changeset
42 char *fpath;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
43 int spacewidth;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
44 int charspace;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
45 int height;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
46 // char *fname_a;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
47 // char *fname_b;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
48 raw_file* pic_a[16];
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
49 raw_file* pic_b[16];
706
8a7666a78f83 better .smi support and display two-byte characters- patch by Sunjin Yang
arpi_esp
parents: 339
diff changeset
50 short font[65536];
5928
48e91dc9534b .raw width>=65536 support by Georgi Georgiev <chutz@chubaka.homeip.net>
arpi
parents: 5294
diff changeset
51 int start[65536]; // short is not enough for unicode fonts
706
8a7666a78f83 better .smi support and display two-byte characters- patch by Sunjin Yang
arpi_esp
parents: 339
diff changeset
52 short width[65536];
8635
81dbd28ef7c0 these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents: 7165
diff changeset
53 int freetype;
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
54
27393
4876c89bafdd Rename font-related preprocessor directives.
diego
parents: 27013
diff changeset
55 #ifdef CONFIG_FREETYPE
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
56 int face_cnt;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
57
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
58 FT_Face faces[16];
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
59 FT_UInt glyph_index[65536];
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
60
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
61 int max_width, max_height;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
62
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
63 struct
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
64 {
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
65 int g_r;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
66 int o_r;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
67 int g_w;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
68 int o_w;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
69 int o_size;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
70 unsigned volume;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
71
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
72 unsigned *g;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
73 unsigned *gt2;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
74 unsigned *om;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
75 unsigned char *omt;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
76 unsigned short *tmp;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
77 } tables;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
78 #endif
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
79
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
80 } font_desc_t;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents:
diff changeset
81
5294
4e64fca268e9 moved font_laod.h
arpi
parents: 1353
diff changeset
82 extern font_desc_t* vo_font;
23338
2a66d95355f0 add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents: 19847
diff changeset
83 extern font_desc_t* sub_font;
5294
4e64fca268e9 moved font_laod.h
arpi
parents: 1353
diff changeset
84
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
85 extern char *subtitle_font_encoding;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
86 extern float text_font_scale_factor;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
87 extern float osd_font_scale_factor;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
88 extern float subtitle_font_radius;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
89 extern float subtitle_font_thickness;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
90 extern int subtitle_autoscale;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
91
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
92 extern int vo_image_width;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
93 extern int vo_image_height;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
94
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
95 extern int force_load_font;
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
96
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 11500
diff changeset
97 int init_freetype(void);
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 11500
diff changeset
98 int done_freetype(void);
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
99
28241
898051d5d9b4 Support loading font faces other then the first one in a font file.
eugeni
parents: 28200
diff changeset
100 font_desc_t* read_font_desc_ft(const char* fname,int face_index,int movie_width, int movie_height, float font_scale_factor);
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
101 void free_font_desc(font_desc_t *desc);
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
102
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
103 void render_one_glyph(font_desc_t *desc, int c);
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
104 int kerning(font_desc_t *desc, int prevc, int c);
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
105
25851
9ebd00825df2 Allow independent scaling of vo_font and sub_font.
reimar
parents: 25546
diff changeset
106 void load_font_ft(int width, int height, font_desc_t **desc, const char *name, float font_scale_factor);
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
107
19847
d7c2e093e406 Make blur() public. Will be used in libass.
eugeni
parents: 18980
diff changeset
108 void blur(unsigned char *buffer, unsigned short *tmp2, int width, int height,
d7c2e093e406 Make blur() public. Will be used in libass.
eugeni
parents: 18980
diff changeset
109 int stride, int *m2, int r, int mwidth);
d7c2e093e406 Make blur() public. Will be used in libass.
eugeni
parents: 18980
diff changeset
110
339
e7e89cd4169f printf's only if verbose>1
arpi_esp
parents: 215
diff changeset
111 raw_file* load_raw(char *name,int verbose);
18980
ed69754aa58d Marks several string parameters as const when they are not modified in the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 17566
diff changeset
112 font_desc_t* read_font_desc(const char* fname,float factor,int verbose);
7122
0dc9cb756b68 freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents: 5928
diff changeset
113
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
114 #endif /* MPLAYER_FONT_LOAD_H */