1 /*
2  * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
3  *
4  * This file is part of mpv.
5  *
6  * mpv is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * mpv is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with mpv.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef MPLAYER_ASS_MP_H
21 #define MPLAYER_ASS_MP_H
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 
26 #include <ass/ass.h>
27 #include <ass/ass_types.h>
28 
29 // This is probably arbitrary.
30 // sd_lavc_conv might indirectly still assume this PlayResY, though.
31 #define MP_ASS_FONT_PLAYRESY 288
32 
33 #define MP_ASS_RGBA(r, g, b, a) \
34     (((unsigned)(r) << 24) | ((g) << 16) | ((b) << 8) | (0xFF - (a)))
35 
36 // m_color argument
37 #define MP_ASS_COLOR(c) MP_ASS_RGBA((c).r, (c).g, (c).b, (c).a)
38 
39 struct MPOpts;
40 struct mpv_global;
41 struct mp_osd_res;
42 struct osd_style_opts;
43 
44 void mp_ass_flush_old_events(ASS_Track *track, long long ts);
45 void mp_ass_set_style(ASS_Style *style, double res_y,
46                       const struct osd_style_opts *opts);
47 
48 void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
49                             struct mpv_global *global, struct mp_log *log);
50 ASS_Library *mp_ass_init(struct mpv_global *global, struct mp_log *log);
51 
52 struct sub_bitmaps;
53 struct mp_ass_packer;
54 struct mp_ass_packer *mp_ass_packer_alloc(void *ta_parent);
55 void mp_ass_packer_pack(struct mp_ass_packer *p, ASS_Image **image_lists,
56                         int num_image_lists, bool changed,
57                         int preferred_osd_format, struct sub_bitmaps *out);
58 void mp_ass_get_bb(ASS_Image *image_list, ASS_Track *track,
59                    struct mp_osd_res *res, double *out_rc);
60 
61 #endif                          /* MPLAYER_ASS_MP_H */
62