From 57043d9269527c145f0c3b483cde9e4d4cfc16f9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 18 Jul 2015 14:36:17 +0200 Subject: sub: add option for stretching image subtitles to screen Probably makes users happy who want bitmap subtitles to show up in the screen margins, and stops them from doing idiotic crap with vf_expand. Fixes #2098. --- DOCS/interface-changes.rst | 1 + DOCS/man/options.rst | 12 ++++++++++++ options/options.c | 1 + options/options.h | 1 + sub/sd_lavc.c | 2 ++ 5 files changed, 17 insertions(+) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index a92768953e..8a7dc262f7 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -20,6 +20,7 @@ Interface changes :: --- mpv 0.10.0 will be released --- + - add --stretch-image-subs-to-screen - add "playlist/N/title" property - add --video-stereo-mode=no to disable auto-conversions - add --force-seekable, and change default seekability in some cases diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index f69dfd137f..ba97de9b12 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1388,6 +1388,18 @@ Subtitles Disabled by default. +``--stretch-image-subs-to-screen=`` + Stretch DVD and other image subtitles to the screen, ignoring the video + margins. This has a similar effect as ``--sub-use-margins`` for text + subtitles, except that the text itself will be stretched, not only just + repositioned. (At least in general it is unavoidable, as an image bitmap + can in theory consist of a single bitmap covering the whole screen, and + the player won't know where exactly the text parts are located.) + + This option does not display subtitles correctly. Use with care. + + Disabled by default. + ``--sub-ass``, ``--no-sub-ass`` Render ASS subtitles natively (enabled by default). diff --git a/options/options.c b/options/options.c index 62c9bc2286..db91d66149 100644 --- a/options/options.c +++ b/options/options.c @@ -331,6 +331,7 @@ const m_option_t mp_opts[] = { OPT_FLAG("sub-visibility", sub_visibility, 0), OPT_FLAG("sub-forced-only", forced_subs_only, 0), OPT_FLAG("stretch-dvd-subs", stretch_dvd_subs, 0), + OPT_FLAG("stretch-image-subs-to-screen", stretch_image_subs, 0), OPT_FLAG("sub-fix-timing", sub_fix_timing, 0), OPT_CHOICE("sub-auto", sub_auto, 0, ({"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})), diff --git a/options/options.h b/options/options.h index b43e28a06f..5d8bd2ea09 100644 --- a/options/options.h +++ b/options/options.h @@ -187,6 +187,7 @@ typedef struct MPOpts { float sub_speed; int forced_subs_only; int stretch_dvd_subs; + int stretch_image_subs; int sub_fix_timing; char *sub_cp; diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 80a8409ee6..2deac14a45 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -272,6 +272,8 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts, } if (priv->avctx->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE) video_par = -1; + if (opts->stretch_image_subs) + d.ml = d.mr = d.mt = d.mb = 0; int insize[2]; get_resolution(sd, insize); osd_rescale_bitmaps(res, insize[0], insize[1], d, video_par); -- cgit v1.2.3