summaryrefslogtreecommitdiffstats
path: root/sub/sd.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/sd.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/sd.h')
-rw-r--r--sub/sd.h40
1 files changed, 31 insertions, 9 deletions
diff --git a/sub/sd.h b/sub/sd.h
index 123a9bc45d..42f7b8a445 100644
--- a/sub/sd.h
+++ b/sub/sd.h
@@ -2,20 +2,42 @@
#define MPLAYER_SD_H
#include "dec_sub.h"
+#include "demux/demux_packet.h"
+
+struct sd {
+ struct MPOpts *opts;
+
+ const struct sd_functions *driver;
+ void *priv;
+
+ const char *codec;
+
+ // Extra header data passed from demuxer
+ char *extradata;
+ int extradata_len;
+
+ // Video resolution used for subtitle decoding. Doesn't necessarily match
+ // the resolution of the VO, nor does it have to be the OSD resolution.
+ int sub_video_w, sub_video_h;
+
+ // Make sd_ass use an existing track
+ struct ass_track *ass_track;
+
+ // Shared renderer for ASS - done to avoid reloading embedded fonts.
+ struct ass_library *ass_library;
+ struct ass_renderer *ass_renderer;
+};
struct sd_functions {
bool accept_packets_in_advance;
bool (*supports_format)(const char *format);
- int (*init)(struct sh_sub *sh, struct osd_state *osd);
- void (*decode)(struct sh_sub *sh, struct osd_state *osd,
- void *data, int data_len, double pts, double duration);
- void (*get_bitmaps)(struct sh_sub *sh, struct osd_state *osd,
- struct mp_osd_res dim, double pts,
+ int (*init)(struct sd *sd);
+ void (*decode)(struct sd *sd, struct demux_packet *packet);
+ void (*get_bitmaps)(struct sd *sd, struct mp_osd_res dim, double pts,
struct sub_bitmaps *res);
- char *(*get_text)(struct sh_sub *sh, struct osd_state *osd, double pts);
- void (*reset)(struct sh_sub *sh, struct osd_state *osd);
- void (*switch_off)(struct sh_sub *sh, struct osd_state *osd);
- void (*uninit)(struct sh_sub *sh);
+ char *(*get_text)(struct sd *sd, double pts);
+ void (*reset)(struct sd *sd);
+ void (*uninit)(struct sd *sd);
};
#endif