summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-01 19:44:12 +0200
committerwm4 <wm4@nowhere>2013-06-01 19:44:16 +0200
commit02ce316ade9ba932ad405383278d6b01c54e5fc4 (patch)
tree4151e307fafc30a4079d4cd79c3d85d92df35105 /sub/dec_sub.h
parent27d383918a3d63559c85ca96b2162a13234f2abc (diff)
downloadmpv-02ce316ade9ba932ad405383278d6b01c54e5fc4.tar.bz2
mpv-02ce316ade9ba932ad405383278d6b01c54e5fc4.tar.xz
sub: refactor
Make the sub decoder stuff independent from sh_sub (except for initialization of course). Sub decoders now access a struct sd only, instead of getting access to sh_sub. The glue code in dec_sub.c is similarily independent from osd. Some simplifications are made. For example, the switch_id stuff is unneeded: the frontend code just has to make sure to call osd_changed() any time subtitles are switched. This is also preparation for introducing subtitle converters. It's much cleaner to completely separate demuxer header/renderer glue/decoders for this purpose, especially since sub converters might completely change how demuxer headers have to be interpreted. Also pass data as demux_packets. Currently, this doesn't help much, but libavcodec converters might need scary stuff like packet side data, so it's perhaps better to go with passing packets.
Diffstat (limited to 'sub/dec_sub.h')
-rw-r--r--sub/dec_sub.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/sub/dec_sub.h b/sub/dec_sub.h
index 4eb833c52b..39632d21a9 100644
--- a/sub/dec_sub.h
+++ b/sub/dec_sub.h
@@ -9,20 +9,36 @@
struct sh_sub;
struct ass_track;
struct MPOpts;
+struct demux_packet;
+struct ass_library;
+struct ass_renderer;
-bool sub_accept_packets_in_advance(struct sh_sub *sh);
-void sub_decode(struct sh_sub *sh, struct osd_state *osd, void *data,
- int data_len, double pts, double duration);
-void sub_get_bitmaps(struct osd_state *osd, struct mp_osd_res dim, double pts,
+struct dec_sub;
+struct sd;
+
+struct dec_sub *sub_create(struct MPOpts *opts);
+void sub_destroy(struct dec_sub *sub);
+
+void sub_set_video_res(struct dec_sub *sub, int w, int h);
+void sub_set_extradata(struct dec_sub *sub, void *data, int data_len);
+void sub_set_ass_renderer(struct dec_sub *sub, struct ass_library *ass_library,
+ struct ass_renderer *ass_renderer);
+void sub_init_from_sh(struct dec_sub *sub, struct sh_sub *sh);
+
+bool sub_is_initialized(struct dec_sub *sub);
+
+bool sub_accept_packets_in_advance(struct dec_sub *sub);
+void sub_decode(struct dec_sub *sub, struct demux_packet *packet);
+void sub_get_bitmaps(struct dec_sub *sub, struct mp_osd_res dim, double pts,
struct sub_bitmaps *res);
-char *sub_get_text(struct osd_state *osd, double pts);
-void sub_init(struct sh_sub *sh, struct osd_state *osd);
-void sub_reset(struct sh_sub *sh, struct osd_state *osd);
-void sub_switchoff(struct sh_sub *sh, struct osd_state *osd);
-void sub_uninit(struct sh_sub *sh);
+bool sub_has_get_text(struct dec_sub *sub);
+char *sub_get_text(struct dec_sub *sub, double pts);
+void sub_reset(struct dec_sub *sub);
+
+struct sd *sub_get_sd(struct dec_sub *sub);
#ifdef CONFIG_ASS
-struct ass_track *sub_get_ass_track(struct osd_state *osd);
+struct ass_track *sub_get_ass_track(struct dec_sub *sub);
#endif
#endif