diff options
author | wm4 <wm4@nowhere> | 2019-11-30 18:09:31 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-30 18:09:31 +0100 |
commit | 78f1629a539cc14a598831a73c59c3763c074094 (patch) | |
tree | f2dd75c25225701d9161721fd598a2bd71b96d01 /video/out/gpu | |
parent | 6a88e7463e9f759121b109be16cd4bd911355c86 (diff) | |
download | mpv-78f1629a539cc14a598831a73c59c3763c074094.tar.bz2 mpv-78f1629a539cc14a598831a73c59c3763c074094.tar.xz |
vf_gpu: render subtitles
Pretty annoying affair. The vo_gpu code could of course not trigger
rendering from filters yet, so it needed to be extended. Also, this uses
some icky stuff made for vf_sub (and this was the reason I marked vf_sub
as deprecated), so everything is terrible.
Diffstat (limited to 'video/out/gpu')
-rw-r--r-- | video/out/gpu/video.c | 18 | ||||
-rw-r--r-- | video/out/gpu/video.h | 3 |
2 files changed, 13 insertions, 8 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 7950022139..a7369f185c 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -2803,13 +2803,17 @@ static void pass_dither(struct gl_video *p) // Draws the OSD, in scene-referred colors.. If cms is true, subtitles are // instead adapted to the display's gamut. -static void pass_draw_osd(struct gl_video *p, int draw_flags, double pts, - struct mp_osd_res rect, struct ra_fbo fbo, bool cms) +static void pass_draw_osd(struct gl_video *p, int osd_flags, int frame_flags, + double pts, struct mp_osd_res rect, struct ra_fbo fbo, + bool cms) { - if ((draw_flags & OSD_DRAW_SUB_ONLY) && (draw_flags & OSD_DRAW_OSD_ONLY)) + if (frame_flags & RENDER_FRAME_VF_SUBS) + osd_flags |= OSD_DRAW_SUB_FILTER; + + if ((osd_flags & OSD_DRAW_SUB_ONLY) && (osd_flags & OSD_DRAW_OSD_ONLY)) return; - mpgl_osd_generate(p->osd, rect, pts, p->image_params.stereo3d, draw_flags); + mpgl_osd_generate(p->osd, rect, pts, p->image_params.stereo3d, osd_flags); timer_pool_start(p->osd_timer); for (int n = 0; n < MAX_OSD_PARTS; n++) { @@ -2922,7 +2926,7 @@ static bool pass_render_frame(struct gl_video *p, struct mp_image *mpi, }; finish_pass_tex(p, &p->blend_subs_tex, rect.w, rect.h); struct ra_fbo fbo = { p->blend_subs_tex }; - pass_draw_osd(p, OSD_DRAW_SUB_ONLY, vpts, rect, fbo, false); + pass_draw_osd(p, OSD_DRAW_SUB_ONLY, flags, vpts, rect, fbo, false); pass_read_tex(p, p->blend_subs_tex); pass_describe(p, "blend subs video"); } @@ -2954,7 +2958,7 @@ static bool pass_render_frame(struct gl_video *p, struct mp_image *mpi, } finish_pass_tex(p, &p->blend_subs_tex, p->texture_w, p->texture_h); struct ra_fbo fbo = { p->blend_subs_tex }; - pass_draw_osd(p, OSD_DRAW_SUB_ONLY, vpts, rect, fbo, false); + pass_draw_osd(p, OSD_DRAW_SUB_ONLY, flags, vpts, rect, fbo, false); pass_read_tex(p, p->blend_subs_tex); pass_describe(p, "blend subs"); } @@ -3329,7 +3333,7 @@ done: if (!(flags & RENDER_FRAME_OSD)) osd_flags |= OSD_DRAW_SUB_ONLY; - pass_draw_osd(p, osd_flags, p->osd_pts, p->osd_rect, fbo, true); + pass_draw_osd(p, osd_flags, flags, p->osd_pts, p->osd_rect, fbo, true); debug_check_gl(p, "after OSD rendering"); } diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h index 931944a777..4c079d463c 100644 --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h @@ -159,7 +159,8 @@ struct voctrl_screenshot; enum { RENDER_FRAME_SUBS = 1 << 0, - RENDER_FRAME_OSD = 2 << 0, + RENDER_FRAME_OSD = 1 << 1, + RENDER_FRAME_VF_SUBS = 1 << 2, RENDER_FRAME_DEF = RENDER_FRAME_SUBS | RENDER_FRAME_OSD, }; |