summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-12 23:35:01 +0100
committerwm4 <wm4@nowhere>2012-12-12 23:35:34 +0100
commitc3f8c9a58e3028777466ce0d3f56374efb10f968 (patch)
tree2267e7bdd026163888e48690bc01ce0973e02b29
parent69e13388342379a256a4a8e9f5a518fcdce453ab (diff)
downloadmpv-c3f8c9a58e3028777466ce0d3f56374efb10f968.tar.bz2
mpv-c3f8c9a58e3028777466ce0d3f56374efb10f968.tar.xz
options: move -ass-bottom-margin/-ass-top-margin options to vf_sub
These options might be useful sometimes, but they are not that important, and work with vf_sub only. Make them vf_sub sub-options.
-rw-r--r--DOCS/man/en/changes.rst1
-rw-r--r--DOCS/man/en/options.rst8
-rw-r--r--DOCS/man/en/vf.rst10
-rw-r--r--core/cfg-mplayer.h2
-rw-r--r--core/options.h2
-rw-r--r--video/filter/vf_sub.c25
6 files changed, 25 insertions, 23 deletions
diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst
index 82066cb75c..b82bef5167 100644
--- a/DOCS/man/en/changes.rst
+++ b/DOCS/man/en/changes.rst
@@ -113,6 +113,7 @@ Command line switches
-subfont-text-scale --sub-scale
-spugauss --sub-gauss
-vobsub --sub (pass the .idx file)
+ -ass-bottom-margin --vf=sub=bottom:top
=================================== ===================================
input.conf and slave commands
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 0aa1098925..51ecab6166 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -118,10 +118,6 @@
text subtitles only, because ASS subtitles include their own styling
information.
---ass-bottom-margin=<value>
- Adds a black band at the bottom of the frame. The SSA/ASS renderer can
- place subtitles there (with ``--ass-use-margins``).
-
--ass-force-style=<[Style.]Param=Value[,...]>
Override some style or script info parameters.
@@ -156,10 +152,6 @@
(Default.)
:no: Render subtitles as forced by subtitle scripts.
---ass-top-margin=<value>
- Adds a black band at the top of the frame. The SSA/ASS renderer can place
- toptitles there (with ``--ass-use-margins``).
-
--ass-use-margins
Enables placing toptitles and subtitles in black borders when they are
available.
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst
index 13d782c0f4..439701754a 100644
--- a/DOCS/man/en/vf.rst
+++ b/DOCS/man/en/vf.rst
@@ -661,11 +661,19 @@ screenshot
screenshot_force
Same as ``screenshot``, but prefer it over VO based screenshot code.
-sub
+sub=[=bottom-margin:top-margin]
Moves subtitle rendering to an arbitrary point in the filter
chain, or force subtitle rendering in the video filter as opposed to using
video output OSD support.
+
+ <bottom-margin>
+ Adds a black band at the bottom of the frame. The SSA/ASS renderer can
+ place subtitles there (with ``--ass-use-margins``).
+ <top-margin>
+ Black band on the top for toptitles (with ``--ass-use-margins``).
+
+
*EXAMPLE*:
``--vf=sub,eq``
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 762c13a2bb..65ebdbb595 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -512,8 +512,6 @@ const m_option_t common_opts[] = {
OPT_MAKE_FLAGS("ass", ass_enabled, 0),
OPT_FLOATRANGE("sub-scale", sub_scale, 0, 0, 100),
OPT_FLOATRANGE("ass-line-spacing", ass_line_spacing, 0, -1000, 1000),
- OPT_INTRANGE("ass-top-margin", ass_top_margin, 0, 0, 2000),
- OPT_INTRANGE("ass-bottom-margin", ass_bottom_margin, 0, 0, 2000),
OPT_MAKE_FLAGS("ass-use-margins", ass_use_margins, 0),
OPT_MAKE_FLAGS("ass-vsfilter-aspect-compat", ass_vsfilter_aspect_compat, 0),
OPT_MAKE_FLAGS("embeddedfonts", use_embedded_fonts, 0),
diff --git a/core/options.h b/core/options.h
index da4449cb11..a45c6d468f 100644
--- a/core/options.h
+++ b/core/options.h
@@ -119,8 +119,6 @@ typedef struct MPOpts {
int sub_gray;
int ass_enabled;
float ass_line_spacing;
- int ass_top_margin;
- int ass_bottom_margin;
int ass_use_margins;
int ass_vsfilter_aspect_compat;
int use_embedded_fonts;
diff --git a/video/filter/vf_sub.c b/video/filter/vf_sub.c
index 2dc1b9afd9..5b2a79a030 100644
--- a/video/filter/vf_sub.c
+++ b/video/filter/vf_sub.c
@@ -44,6 +44,7 @@
#include "core/m_struct.h"
static const struct vf_priv_s {
+ int opt_top_margin, opt_bottom_margin;
int outh, outw;
unsigned int outfmt;
@@ -63,7 +64,8 @@ static int config(struct vf_instance *vf,
if (outfmt == IMGFMT_IF09)
return 0;
- vf->priv->outh = height + opts->ass_top_margin + opts->ass_bottom_margin;
+ vf->priv->outh = height + vf->priv->opt_top_margin +
+ vf->priv->opt_bottom_margin;
vf->priv->outw = width;
double dar = (double)d_width / d_height;
@@ -77,8 +79,8 @@ static int config(struct vf_instance *vf,
vf->priv->dim = (struct mp_osd_res) {
.w = vf->priv->outw,
.h = vf->priv->outh,
- .mt = opts->ass_top_margin,
- .mb = opts->ass_bottom_margin,
+ .mt = vf->priv->opt_top_margin,
+ .mb = vf->priv->opt_bottom_margin,
.display_par = sar / dar,
.video_par = dar / sar,
};
@@ -108,7 +110,7 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi)
return;
}
- int tmargin = vf->opts->ass_top_margin;
+ int tmargin = vf->priv->opt_top_margin;
// set up mpi as a cropped-down image of dmpi:
if (mpi->flags & MP_IMGFLAG_PLANAR) {
mpi->planes[0] = vf->dmpi->planes[0] + tmargin * vf->dmpi->stride[0];
@@ -152,8 +154,7 @@ static void blank(mp_image_t *mpi, int y1, int y2)
static int prepare_image(struct vf_instance *vf, mp_image_t *mpi)
{
- struct MPOpts *opts = vf->opts;
- int tmargin = opts->ass_top_margin;
+ int tmargin = vf->priv->opt_top_margin;
if (mpi->flags & MP_IMGFLAG_DIRECT
|| mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) {
vf->dmpi = mpi->priv;
@@ -165,8 +166,8 @@ static int prepare_image(struct vf_instance *vf, mp_image_t *mpi)
// we've used DR, so we're ready...
if (tmargin)
blank(vf->dmpi, 0, tmargin);
- if (opts->ass_bottom_margin)
- blank(vf->dmpi, vf->priv->outh - opts->ass_bottom_margin,
+ if (vf->priv->opt_bottom_margin)
+ blank(vf->dmpi, vf->priv->outh - vf->priv->opt_bottom_margin,
vf->priv->outh);
if (!(mpi->flags & MP_IMGFLAG_PLANAR))
vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
@@ -209,8 +210,8 @@ static int prepare_image(struct vf_instance *vf, mp_image_t *mpi)
}
if (tmargin)
blank(vf->dmpi, 0, tmargin);
- if (opts->ass_bottom_margin)
- blank(vf->dmpi, vf->priv->outh - opts->ass_bottom_margin,
+ if (vf->priv->opt_bottom_margin)
+ blank(vf->dmpi, vf->priv->outh - vf->priv->opt_bottom_margin,
vf->priv->outh);
return 0;
}
@@ -289,6 +290,10 @@ static int vf_open(vf_instance_t *vf, char *args)
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s, f)
static const m_option_t vf_opts_fields[] = {
+ {"bottom-margin", ST_OFF(opt_bottom_margin),
+ CONF_TYPE_INT, M_OPT_RANGE, 0, 2000},
+ {"top-margin", ST_OFF(opt_top_margin),
+ CONF_TYPE_INT, M_OPT_RANGE, 0, 2000},
{NULL, NULL, 0, 0, 0, 0, NULL}
};