From 02ce316ade9ba932ad405383278d6b01c54e5fc4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2013 19:44:12 +0200 Subject: 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. --- sub/dec_sub.h | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'sub/dec_sub.h') 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 -- cgit v1.2.3