summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-04-10 22:19:44 +0200
committerNiklas Haas <git@nand.wakku.to>2015-04-10 22:22:55 +0200
commit6f46bafbd06e6a107e55f35860744ed66c1b8426 (patch)
treef1a49410a0847d13cb452974e09ddd70a066cf0a /video
parentabf100f81df02a8b72a750bd3b30a8885d4c1263 (diff)
downloadmpv-6f46bafbd06e6a107e55f35860744ed66c1b8426.tar.bz2
mpv-6f46bafbd06e6a107e55f35860744ed66c1b8426.tar.xz
vo_opengl: add blend-subtitles-res
This can be used to draw the subtitles at the video's native res, which can make them look more natural and increases performance.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_video.c22
-rw-r--r--video/out/gl_video.h1
2 files changed, 19 insertions, 4 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 3e915d9d0a..c7ebcc13b8 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -435,6 +435,9 @@ const struct m_sub_options gl_video_conf = {
OPT_COLOR("background", background, 0),
OPT_FLAG("interpolation", interpolation, 0),
OPT_FLAG("blend-subtitles", blend_subs, 0),
+ OPT_CHOICE("blend-subtitles-res", blend_subs_res, 0,
+ ({"display", 0},
+ {"video", 1})),
OPT_REMOVED("approx-gamma", "this is always enabled now"),
OPT_REMOVED("cscale-down", "chroma is never downscaled"),
@@ -1827,9 +1830,23 @@ static void pass_render_frame(struct gl_video *p)
p->use_indirect = false; // set to true as needed by pass_*
pass_read_video(p);
pass_convert_yuv(p);
+
+ // For subtitles
+ double vpts = p->image.mpi->pts;
+ if (vpts == MP_NOPTS_VALUE)
+ vpts = p->osd_pts;
+
+ if (p->osd && p->opts.blend_subs && p->opts.blend_subs_res == 1) {
+ struct mp_osd_res rect = { p->image_w, p->image_h, 0, 0, 0, 0, 1 };
+ finish_pass_fbo(p, &p->blend_subs_fbo, p->image_w, p->image_h, 0, 0);
+ pass_draw_osd(p, OSD_DRAW_SUB_ONLY, vpts, rect, p->image_w, p->image_h,
+ p->blend_subs_fbo.fbo, false);
+ GLSL(vec4 color = texture(texture0, texcoord0);)
+ }
+
pass_scale_main(p);
- if (p->osd && p->opts.blend_subs) {
+ if (p->osd && p->opts.blend_subs && p->opts.blend_subs_res == 0) {
// Recreate the real video size from the src/dst rects
int vp_w = p->dst_rect.x1 - p->dst_rect.x0,
vp_h = p->dst_rect.y1 - p->dst_rect.y0;
@@ -1848,9 +1865,6 @@ static void pass_render_frame(struct gl_video *p)
if (p->use_linear)
pass_delinearize(p, p->image_params.gamma);
finish_pass_fbo(p, &p->blend_subs_fbo, vp_w, vp_h, 0, FBOTEX_FUZZY);
- double vpts = p->image.mpi->pts;
- if (vpts == MP_NOPTS_VALUE)
- vpts = p->osd_pts;
pass_draw_osd(p, OSD_DRAW_SUB_ONLY, vpts, rect, vp_w, vp_h,
p->blend_subs_fbo.fbo, false);
GLSL(vec4 color = texture(texture0, texcoord0);)
diff --git a/video/out/gl_video.h b/video/out/gl_video.h
index 30647153b5..a757d99cc9 100644
--- a/video/out/gl_video.h
+++ b/video/out/gl_video.h
@@ -66,6 +66,7 @@ struct gl_video_opts {
struct m_color background;
int interpolation;
int blend_subs;
+ int blend_subs_res;
};
extern const struct m_sub_options gl_video_conf;