1 #ifndef MPLAYER_DEC_SUB_H
2 #define MPLAYER_DEC_SUB_H
3 
4 #include <stdbool.h>
5 #include <stdint.h>
6 
7 #include "osd.h"
8 
9 struct sh_stream;
10 struct mpv_global;
11 struct demux_packet;
12 struct mp_recorder_sink;
13 struct dec_sub;
14 struct sd;
15 
16 enum sd_ctrl {
17     SD_CTRL_SUB_STEP,
18     SD_CTRL_SET_VIDEO_PARAMS,
19     SD_CTRL_SET_TOP,
20     SD_CTRL_SET_VIDEO_DEF_FPS,
21     SD_CTRL_UPDATE_OPTS,
22 };
23 
24 enum sd_text_type {
25     SD_TEXT_TYPE_PLAIN,
26     SD_TEXT_TYPE_ASS,
27 };
28 
29 struct sd_times {
30     double start;
31     double end;
32 };
33 
34 struct attachment_list {
35     struct demux_attachment *entries;
36     int num_entries;
37 };
38 
39 struct dec_sub *sub_create(struct mpv_global *global, struct sh_stream *sh,
40                            struct attachment_list *attachments, int order);
41 void sub_destroy(struct dec_sub *sub);
42 
43 bool sub_can_preload(struct dec_sub *sub);
44 void sub_preload(struct dec_sub *sub);
45 bool sub_read_packets(struct dec_sub *sub, double video_pts);
46 struct sub_bitmaps *sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim,
47                                     int format, double pts);
48 char *sub_get_text(struct dec_sub *sub, double pts, enum sd_text_type type);
49 struct sd_times sub_get_times(struct dec_sub *sub, double pts);
50 void sub_reset(struct dec_sub *sub);
51 void sub_select(struct dec_sub *sub, bool selected);
52 void sub_set_recorder_sink(struct dec_sub *sub, struct mp_recorder_sink *sink);
53 void sub_set_play_dir(struct dec_sub *sub, int dir);
54 bool sub_is_secondary_visible(struct dec_sub *sub);
55 
56 int sub_control(struct dec_sub *sub, enum sd_ctrl cmd, void *arg);
57 
58 #endif
59