summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-15 00:15:32 +0200
committerwm4 <wm4@nowhere>2013-08-19 13:03:08 +0200
commit216e8320b02e76a407b114ca4de73763e9df3507 (patch)
treecf96184f0eb011d41366e23357914e385ee0cdf1 /mpvcore
parent67704e2977d2bb5c35f962b154d5e8e481e2d508 (diff)
downloadmpv-216e8320b02e76a407b114ca4de73763e9df3507.tar.bz2
mpv-216e8320b02e76a407b114ca4de73763e9df3507.tar.xz
video: make it possible to scale/pan the video by arbitrary amounts
Add --video-align-x/y, --video-pan-x/y, --video-scale options and properties. See the additions to the manpage for description and semantics. These transformations are intentionally done on top of panscan. Unlike the (now removed) --panscanrange option, this doesn't affect the default panscan behavior. (Although panscan itself becomes kind of useless if the new options are used.)
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/command.c13
-rw-r--r--mpvcore/options.c5
-rw-r--r--mpvcore/options.h3
3 files changed, 17 insertions, 4 deletions
diff --git a/mpvcore/command.c b/mpvcore/command.c
index b7aa9dfe6a..ae3f97a5bc 100644
--- a/mpvcore/command.c
+++ b/mpvcore/command.c
@@ -1253,9 +1253,9 @@ static int mp_property_colormatrix_output_range(m_option_t *prop, int action,
return M_PROPERTY_OK;
}
-/// Panscan (RW)
-static int mp_property_panscan(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
+// Update options which are managed through VOCTRL_GET/SET_PANSCAN.
+static int panscan_property_helper(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->video_out
@@ -1809,7 +1809,12 @@ static const m_option_t mp_properties[] = {
.offset = offsetof(struct MPOpts, gamma_saturation)),
M_OPTION_PROPERTY_CUSTOM_("hue", mp_property_gamma,
.offset = offsetof(struct MPOpts, gamma_hue)),
- M_OPTION_PROPERTY_CUSTOM("panscan", mp_property_panscan),
+ M_OPTION_PROPERTY_CUSTOM("panscan", panscan_property_helper),
+ M_OPTION_PROPERTY_CUSTOM("video-zoom", panscan_property_helper),
+ M_OPTION_PROPERTY_CUSTOM("video-align-x", panscan_property_helper),
+ M_OPTION_PROPERTY_CUSTOM("video-align-y", panscan_property_helper),
+ M_OPTION_PROPERTY_CUSTOM("video-pan-x", panscan_property_helper),
+ M_OPTION_PROPERTY_CUSTOM("video-pan-y", panscan_property_helper),
{ "video-format", mp_property_video_format, CONF_TYPE_STRING,
0, 0, 0, NULL },
{ "video-codec", mp_property_video_codec, CONF_TYPE_STRING,
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 5600ccee71..5aff219c14 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -581,6 +581,11 @@ const m_option_t mp_opts[] = {
OPT_INTRANGE("fsmode-dontuse", vo.fsmode, 0, 31, 4096),
OPT_FLAG("native-keyrepeat", vo.native_keyrepeat, 0),
OPT_FLOATRANGE("panscan", vo.panscan, 0, 0.0, 1.0),
+ OPT_FLOATRANGE("video-zoom", vo.zoom, 0, -20.0, 20.0),
+ OPT_FLOATRANGE("video-pan-x", vo.pan_x, 0, -3.0, 3.0),
+ OPT_FLOATRANGE("video-pan-y", vo.pan_y, 0, -3.0, 3.0),
+ OPT_FLOATRANGE("video-align-x", vo.align_x, 0, -1.0, 1.0),
+ OPT_FLOATRANGE("video-align-y", vo.align_y, 0, -1.0, 1.0),
OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0),
OPT_CHOICE("colormatrix", requested_colorspace, 0,
({"auto", MP_CSP_AUTO},
diff --git a/mpvcore/options.h b/mpvcore/options.h
index 2ab9e517a0..1ff50688ce 100644
--- a/mpvcore/options.h
+++ b/mpvcore/options.h
@@ -19,6 +19,9 @@ typedef struct mp_vo_opts {
int native_keyrepeat;
float panscan;
+ float zoom;
+ float pan_x, pan_y;
+ float align_x, align_y;
struct m_geometry geometry;
struct m_geometry autofit;