audio: improve decoder open failure handling
[mplayer.git] / sub / sub.h
blobbd0803b44e98b64fbd6d839ccd70578d8514a01f
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 #include "subreader.h"
25 #include "dec_sub.h"
27 typedef struct mp_osd_bbox_s {
28 int x1,y1,x2,y2;
29 } mp_osd_bbox_t;
31 #define OSDTYPE_OSD 1
32 #define OSDTYPE_SUBTITLE 2
33 #define OSDTYPE_PROGBAR 3
34 #define OSDTYPE_SPU 4
35 #define OSDTYPE_DVDNAV 5
36 #define OSDTYPE_TELETEXT 6
38 #define OSDFLAG_VISIBLE 1
39 #define OSDFLAG_CHANGED 2
40 #define OSDFLAG_BBOX 4
41 #define OSDFLAG_OLD_BBOX 8
42 #define OSDFLAG_FORCE_UPDATE 16
44 #define MAX_UCS 1600
45 #define MAX_UCSLINES 16
47 typedef struct mp_osd_obj_s {
48 struct mp_osd_obj_s* next;
49 unsigned char type;
50 unsigned char alignment; // 2 bits: x;y percentages, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center
51 unsigned short flags;
52 int x,y;
53 int dxs,dys;
54 mp_osd_bbox_t bbox; // bounding box
55 mp_osd_bbox_t old_bbox; // the renderer will save bbox here
56 union {
57 struct {
58 void* sub; // value of vo_sub at last update
59 int utbl[MAX_UCS+1]; // subtitle text
60 int xtbl[MAX_UCSLINES]; // x positions
61 int lines; // no. of lines
62 } subtitle;
63 struct {
64 int elems;
65 } progbar;
66 } params;
67 int stride;
69 int allocated;
70 unsigned char *alpha_buffer;
71 unsigned char *bitmap_buffer;
73 struct ass_track *osd_track;
74 } mp_osd_obj_t;
76 extern subtitle* vo_sub;
78 extern void* vo_osd_teletext_page;
79 extern int vo_osd_teletext_half;
80 extern int vo_osd_teletext_mode;
81 extern int vo_osd_teletext_format;
83 extern int vo_osd_progbar_type;
84 extern int vo_osd_progbar_value; // 0..255
86 extern void* vo_spudec;
87 extern void* vo_vobsub;
89 #define OSD_PLAY 0x01
90 #define OSD_PAUSE 0x02
91 #define OSD_STOP 0x03
92 #define OSD_REW 0x04
93 #define OSD_FFW 0x05
94 #define OSD_CLOCK 0x06
95 #define OSD_CONTRAST 0x07
96 #define OSD_SATURATION 0x08
97 #define OSD_VOLUME 0x09
98 #define OSD_BRIGHTNESS 0x0A
99 #define OSD_HUE 0x0B
100 #define OSD_BALANCE 0x0C
101 #define OSD_PANSCAN 0x50
103 #define OSD_PB_START 0x10
104 #define OSD_PB_0 0x11
105 #define OSD_PB_END 0x12
106 #define OSD_PB_1 0x13
108 /* now in textform */
109 extern char * const sub_osd_names[];
110 extern char * const sub_osd_names_short[];
112 extern char *sub_cp;
113 extern int sub_pos;
114 extern int sub_width_p;
115 extern int sub_alignment;
116 extern int sub_bg_color; /* subtitles background color */
117 extern int sub_bg_alpha;
118 extern int spu_alignment;
119 extern int spu_aamode;
120 extern float spu_gaussvar;
122 extern char *subtitle_font_encoding;
123 extern float text_font_scale_factor;
124 extern float osd_font_scale_factor;
125 extern float subtitle_font_radius;
126 extern float subtitle_font_thickness;
127 extern int subtitle_autoscale;
129 extern char *font_name;
130 extern char *sub_font_name;
131 extern float font_factor;
132 extern float sub_delay;
133 extern float sub_fps;
135 extern int sub_justify;
137 void osd_draw_text(struct osd_state *osd, int dxs, int dys,
138 void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h,
139 unsigned char* src, unsigned char *srca,
140 int stride),
141 void *ctx);
142 void osd_draw_text_ext(struct osd_state *osd, int dxs, int dys,
143 int left_border, int top_border, int right_border,
144 int bottom_border, int orig_w, int orig_h,
145 void (*draw_alpha)(void *ctx, int x0, int y0, int w,
146 int h, unsigned char* src,
147 unsigned char *srca,
148 int stride),
149 void *ctx);
151 struct osd_state *osd_create(struct MPOpts *opts, struct ass_library *asslib);
152 void osd_set_text(struct osd_state *osd, const char *text);
153 int osd_update(struct osd_state *osd, int dxs, int dys);
154 int vo_osd_changed(int new_value);
155 int vo_osd_check_range_update(int,int,int,int);
156 void osd_free(struct osd_state *osd);
158 #ifdef CONFIG_DVDNAV
159 #include <inttypes.h>
160 void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey);
161 #endif
164 // used only by osd_libass.c
165 void osd_alloc_buf(mp_osd_obj_t* obj);
167 // defined in osd_libass.c or osd_dummy.c
168 void vo_update_text_osd(struct osd_state *osd, mp_osd_obj_t *obj);
169 void vo_update_text_teletext(struct osd_state *osd, mp_osd_obj_t *obj);
170 void vo_update_text_progbar(struct osd_state *osd, mp_osd_obj_t *obj);
171 void vo_update_text_sub(struct osd_state *osd, mp_osd_obj_t *obj);
172 void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function);
173 void osd_init_backend(struct osd_state *osd);
174 void osd_destroy_backend(struct osd_state *osd);
176 #endif /* MPLAYER_SUB_H */