configure: add return_check and return_statement_check helpers
[mplayer.git] / sub / sub.h
blob8309613ea617665b091eb23b9c41d4cffc141632
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_SUB_H
20 #define MPLAYER_SUB_H
22 #include <stdbool.h>
24 typedef struct mp_osd_bbox_s {
25 int x1,y1,x2,y2;
26 } mp_osd_bbox_t;
28 #define OSDTYPE_OSD 1
29 #define OSDTYPE_SUBTITLE 2
30 #define OSDTYPE_PROGBAR 3
31 #define OSDTYPE_SPU 4
32 #define OSDTYPE_DVDNAV 5
33 #define OSDTYPE_TELETEXT 6
35 #define OSDFLAG_VISIBLE 1
36 #define OSDFLAG_CHANGED 2
37 #define OSDFLAG_BBOX 4
38 #define OSDFLAG_OLD_BBOX 8
39 #define OSDFLAG_FORCE_UPDATE 16
41 #define MAX_UCS 1600
42 #define MAX_UCSLINES 16
44 typedef struct mp_osd_obj_s {
45 struct mp_osd_obj_s* next;
46 unsigned char type;
47 unsigned char alignment; // 2 bits: x;y percentages, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center
48 unsigned short flags;
49 int x,y;
50 int dxs,dys;
51 mp_osd_bbox_t bbox; // bounding box
52 mp_osd_bbox_t old_bbox; // the renderer will save bbox here
53 union {
54 struct {
55 void* sub; // value of vo_sub at last update
56 int utbl[MAX_UCS+1]; // subtitle text
57 int xtbl[MAX_UCSLINES]; // x positions
58 int lines; // no. of lines
59 } subtitle;
60 struct {
61 int elems;
62 } progbar;
63 } params;
64 int stride;
66 int allocated;
67 unsigned char *alpha_buffer;
68 unsigned char *bitmap_buffer;
69 } mp_osd_obj_t;
71 struct osd_state {
72 unsigned char osd_text[128];
73 struct font_desc *sub_font;
74 struct ass_track *ass_track;
75 bool ass_track_changed;
76 bool vsfilter_aspect;
79 #include "subreader.h"
81 extern subtitle* vo_sub;
83 extern void* vo_osd_teletext_page;
84 extern int vo_osd_teletext_half;
85 extern int vo_osd_teletext_mode;
86 extern int vo_osd_teletext_format;
88 extern int vo_osd_progbar_type;
89 extern int vo_osd_progbar_value; // 0..255
91 extern void* vo_spudec;
92 extern void* vo_vobsub;
94 #define OSD_PLAY 0x01
95 #define OSD_PAUSE 0x02
96 #define OSD_STOP 0x03
97 #define OSD_REW 0x04
98 #define OSD_FFW 0x05
99 #define OSD_CLOCK 0x06
100 #define OSD_CONTRAST 0x07
101 #define OSD_SATURATION 0x08
102 #define OSD_VOLUME 0x09
103 #define OSD_BRIGHTNESS 0x0A
104 #define OSD_HUE 0x0B
105 #define OSD_BALANCE 0x0C
106 #define OSD_PANSCAN 0x50
108 #define OSD_PB_START 0x10
109 #define OSD_PB_0 0x11
110 #define OSD_PB_END 0x12
111 #define OSD_PB_1 0x13
113 /* now in textform */
114 extern char * const sub_osd_names[];
115 extern char * const sub_osd_names_short[];
117 extern int sub_unicode;
118 extern int sub_utf8;
120 extern char *sub_cp;
121 extern int sub_pos;
122 extern int sub_width_p;
123 extern int sub_alignment;
124 extern int sub_visibility;
125 extern int sub_bg_color; /* subtitles background color */
126 extern int sub_bg_alpha;
127 extern int spu_alignment;
128 extern int spu_aamode;
129 extern float spu_gaussvar;
131 void osd_draw_text(struct osd_state *osd, int dxs, int dys,
132 void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h,
133 unsigned char* src, unsigned char *srca,
134 int stride),
135 void *ctx);
136 void osd_draw_text_ext(struct osd_state *osd, int dxs, int dys,
137 int left_border, int top_border, int right_border,
138 int bottom_border, int orig_w, int orig_h,
139 void (*draw_alpha)(void *ctx, int x0, int y0, int w,
140 int h, unsigned char* src,
141 unsigned char *srca,
142 int stride),
143 void *ctx);
144 void osd_remove_text(struct osd_state *osd, int dxs, int dys,
145 void (*remove)(int x0, int y0, int w, int h));
147 struct osd_state *osd_create(void);
148 int osd_update(struct osd_state *osd, int dxs, int dys);
149 int vo_osd_changed(int new_value);
150 int vo_osd_check_range_update(int,int,int,int);
151 void osd_free(struct osd_state *osd);
153 extern int vo_osd_changed_flag;
155 unsigned utf8_get_char(const char **str);
157 #ifdef CONFIG_DVDNAV
158 #include <inttypes.h>
159 void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey);
160 #endif
163 #ifdef IS_OLD_VO
164 #define vo_remove_text(...) osd_remove_text(global_osd, __VA_ARGS__)
165 #endif
167 #endif /* MPLAYER_SUB_H */