summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-25 21:25:11 +0100
committerwm4 <wm4@nowhere>2013-03-26 01:29:53 +0100
commitd080d1d39afe2b0a4286ab4688df609984996357 (patch)
tree2be9409dcca1b481a703840d2e76234d41d2270b
parent05e918be02a269627bf440d29a153783df93f172 (diff)
downloadmpv-d080d1d39afe2b0a4286ab4688df609984996357.tar.bz2
mpv-d080d1d39afe2b0a4286ab4688df609984996357.tar.xz
command: export VO video width/height as properties
Add new properties "dwidth" and "dheight", which contain the video size as known by the VO (not necessarily what the VO makes out of them, i.e. without window scaling and panscan).
-rw-r--r--DOCS/man/en/input.rst6
-rwxr-xr-xTOOLS/mpv_identify.sh2
-rw-r--r--core/command.c24
3 files changed, 30 insertions, 2 deletions
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst
index 221d6cbfba..9dda58adbd 100644
--- a/DOCS/man/en/input.rst
+++ b/DOCS/man/en/input.rst
@@ -309,9 +309,11 @@ vsync x see ``--vsync``
video-format video format (string)
video-codec video codec selected for decoding
video-bitrate video bitrate
-width video width
+width video width (container or decoded size)
height video height
-fps FPS (may contain bogus values)
+fps container FPS (may contain bogus values)
+dwidth video width (after filters and aspect scaling)
+dheight video height
aspect x video aspect
video x current video track (similar to ``--vid``)
program x switch TS program (write-only)
diff --git a/TOOLS/mpv_identify.sh b/TOOLS/mpv_identify.sh
index b3bc0481ef..cd006c5db5 100755
--- a/TOOLS/mpv_identify.sh
+++ b/TOOLS/mpv_identify.sh
@@ -86,6 +86,8 @@ __midentify__allprops="
fps
width
height
+ dwidth
+ dheight
sub
"
diff --git a/core/command.c b/core/command.c
index 1d6e0c976d..58079d63f1 100644
--- a/core/command.c
+++ b/core/command.c
@@ -1143,6 +1143,28 @@ static int mp_property_height(m_option_t *prop, int action, void *arg,
return m_property_int_ro(prop, action, arg, mpctx->sh_video->disp_h);
}
+static int property_vo_wh(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx, bool get_w)
+{
+ struct vo *vo = mpctx->video_out;
+ if (!mpctx->sh_video && !vo || !vo->hasframe)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_int_ro(prop, action, arg,
+ get_w ? vo->aspdat.prew : vo->aspdat.preh);
+}
+
+static int mp_property_dwidth(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ return property_vo_wh(prop, action, arg, mpctx, true);
+}
+
+static int mp_property_dheight(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ return property_vo_wh(prop, action, arg, mpctx, false);
+}
+
/// Video fps (RO)
static int mp_property_fps(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
@@ -1408,6 +1430,8 @@ static const m_option_t mp_properties[] = {
0, 0, 0, NULL },
{ "height", mp_property_height, CONF_TYPE_INT,
0, 0, 0, NULL },
+ { "dwidth", mp_property_dwidth, CONF_TYPE_INT },
+ { "dheight", mp_property_dheight, CONF_TYPE_INT },
{ "fps", mp_property_fps, CONF_TYPE_FLOAT,
0, 0, 0, NULL },
{ "aspect", mp_property_aspect, CONF_TYPE_FLOAT,