mp_msg: print messages to stdout, statusline to stderr
[mplayer.git] / sub / dec_sub.h
blobac74f7ada317d542b30eac74350ad0db568b38c6
1 #ifndef MPLAYER_DEC_SUB_H
2 #define MPLAYER_DEC_SUB_H
4 struct sh_sub;
5 struct osd_state;
6 struct ass_track;
8 enum sub_bitmap_type {
9 SUBBITMAP_EMPTY,
10 SUBBITMAP_LIBASS,
11 SUBBITMAP_RGBA,
14 typedef struct mp_eosd_res {
15 int w, h; // screen dimensions, including black borders
16 int mt, mb, ml, mr; // borders (top, bottom, left, right)
17 } mp_eosd_res_t;
19 struct osd_state {
20 struct ass_library *ass_library;
21 struct ass_renderer *ass_renderer;
22 struct sh_sub *sh_sub;
23 unsigned int bitmap_id;
24 unsigned int bitmap_pos_id;
25 double sub_pts;
26 double sub_offset;
27 struct mp_eosd_res dim;
28 double normal_scale;
29 double vsfilter_scale;
30 bool unscaled;
31 bool support_rgba;
33 struct ass_renderer *osd_render;
34 struct ass_library *osd_ass_library;
35 char *osd_text;
36 int w, h;
38 struct MPOpts *opts;
41 typedef struct sub_bitmaps {
42 enum sub_bitmap_type type;
44 struct ass_image *imgs;
46 struct sub_bitmap {
47 int w, h;
48 int x, y;
49 // Note: not clipped, going outside the screen area is allowed
50 int dw, dh;
51 void *bitmap;
52 } *parts;
53 int part_count;
55 bool scaled;
56 unsigned int bitmap_id;
57 unsigned int bitmap_pos_id;
58 } mp_eosd_images_t;
60 static inline bool is_text_sub(int type)
62 return type == 't' || type == 'm' || type == 'a';
65 void sub_decode(struct sh_sub *sh, struct osd_state *osd, void *data,
66 int data_len, double pts, double duration);
67 void sub_get_bitmaps(struct osd_state *osd, struct sub_bitmaps *res);
68 void sub_init(struct sh_sub *sh, struct osd_state *osd);
69 void sub_reset(struct sh_sub *sh, struct osd_state *osd);
70 void sub_switchoff(struct sh_sub *sh, struct osd_state *osd);
71 void sub_uninit(struct sh_sub *sh);
73 struct sh_sub *sd_ass_create_from_track(struct ass_track *track,
74 bool vsfilter_aspect,
75 struct MPOpts *opts);
77 #endif