summaryrefslogtreecommitdiffstats
path: root/sub/sub.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-04 17:16:32 +0200
committerwm4 <wm4@nowhere>2012-10-16 07:26:31 +0200
commit17f5019b468d5269408b7dae53a24e17426de7d5 (patch)
tree65e34c482428e563e79356f19b4a9240d8f9ded2 /sub/sub.h
parent34b3a9c5e97dfae87afab64915dec624439eafa6 (diff)
downloadmpv-17f5019b468d5269408b7dae53a24e17426de7d5.tar.bz2
mpv-17f5019b468d5269408b7dae53a24e17426de7d5.tar.xz
sub: always go through sub.c for OSD rendering
Before this commit, vf_vo.c and vf_ass.c were manually calling the subtitle decoder to retrieve images to render. In particular, this circumvented the sub-bitmap conversion & caching layer in sub.c. Change this so that subtitle decoding isn't special anymore, and draws all subtitles with the normal OSD drawing API. This is also a step towards removing the need for vf_ass auto-insertion. In fact, if auto-insertion would be disabled now, VOs with "old" OSD rendering could still render ASS subtitles in monochrome, because there is still ASS -> old-OSD bitmap conversion in the sub.c mechanism. The code is written with the assumption that the subtitle rendering filter (vf_ass) can render all subtitle formats. Since vf_ass knows the ASS format only, rendering image subs (i.e. RGBA subs) with it simply fails. This means that with vo_xv (vf_ass auto-inserted), image subs wouldn't be rendered. Use a dumb hack to disable rendering subs with a filter, if we detect that the subs are not in ASS format. (Trying to render the subs first would probably result in purging the conversion cache on every frame.)
Diffstat (limited to 'sub/sub.h')
-rw-r--r--sub/sub.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/sub/sub.h b/sub/sub.h
index badc21d7a6..4f055558e9 100644
--- a/sub/sub.h
+++ b/sub/sub.h
@@ -27,7 +27,7 @@
struct vo;
enum mp_osdtype {
- OSDTYPE_ASS,
+ OSDTYPE_SUB,
OSDTYPE_OSD,
OSDTYPE_SUBTITLE,
OSDTYPE_PROGBAR,
@@ -40,6 +40,8 @@ enum mp_osdtype {
struct osd_object {
int type; // OSDTYPE_*
+ bool is_sub;
+
bool force_redraw;
// caches for OSD conversion (internal to render_object())
@@ -62,13 +64,17 @@ struct osd_state {
struct ass_library *ass_library;
struct ass_renderer *ass_renderer;
struct sh_sub *sh_sub;
- double sub_pts;
double sub_offset;
+ double vo_sub_pts;
+
+ double sub_pts;
struct mp_eosd_res dim;
double normal_scale;
double vsfilter_scale;
bool support_rgba;
+ bool render_subs_in_filter;
+
int w, h;
char *osd_text; // OSDTYPE_OSD
@@ -171,6 +177,10 @@ void vo_osd_reset_changed(void);
bool vo_osd_has_changed(struct osd_state *osd);
void osd_free(struct osd_state *osd);
+bool osd_draw_sub(struct osd_state *osd, struct sub_bitmaps *out_imgs,
+ struct sub_render_params *sub_params,
+ const bool formats[SUBBITMAP_COUNT]);
+
bool sub_bitmaps_bb(struct sub_bitmaps *imgs, int *x1, int *y1,
int *x2, int *y2);