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.
This commit is contained in:
wm4 2012-12-12 23:35:01 +01:00
parent 69e1338834
commit c3f8c9a58e
6 changed files with 25 additions and 23 deletions

View File

@ -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

View File

@ -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.

View File

@ -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``

View File

@ -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),

View File

@ -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;

View File

@ -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}
};