diff options
author | wm4 <wm4@nowhere> | 2015-01-10 19:11:28 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-10 19:13:16 +0100 |
commit | e5f2072364ac450e0f593f534ddee2ae1a8f2176 (patch) | |
tree | c514d8966aca2f8992822e4c35638655fac82da3 /player | |
parent | 242558bec1a91b1c04dd0fe346ea6daa628ef710 (diff) | |
download | mpv-e5f2072364ac450e0f593f534ddee2ae1a8f2176.tar.bz2 mpv-e5f2072364ac450e0f593f534ddee2ae1a8f2176.tar.xz |
command: change properties added in previous commit
Make their meaning more exact, and don't pretend that there's a
reasonable definition for "bits-per-pixel". Also make unset fields
unavailable.
average_depth still might be inconsistent: for example, 10 bit 4:2:0 is
identified as 24 bits, but RGB 4:4:4 as 12 bits. So YUV formats
seemingly drop the per-component padding, while RGB formats do not.
Internally it's consistent though: 10 bit YUV components are read as
16 bit, and the padding must be 0 (it's basically like an odd fixed-
point representation, rather than a bitfield).
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/player/command.c b/player/command.c index 4e4cbce165..c98568beb1 100644 --- a/player/command.c +++ b/player/command.c @@ -2396,20 +2396,17 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg) double dar = p.d_w / (double)p.d_h; double sar = p.w / (double)p.h; - const struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(p.imgfmt); + struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(p.imgfmt); int bpp = 0; - // unknown bpp for hwdec - if (!IMGFMT_IS_HWACCEL(desc.id)) { - for (int i=0; i<desc.num_planes; ++i) - bpp += desc.bpp[i] >> (desc.xs[i] + desc.ys[i]); - } - // hwdec supports 8bit depth only - const int depth = IMGFMT_IS_HWACCEL(desc.id) ? 8 : desc.plane_bits; + for (int i = 0; i < desc.num_planes; i++) + bpp += desc.bpp[i] >> (desc.xs[i] + desc.ys[i]); struct m_sub_property props[] = { {"pixelformat", SUB_PROP_STR(mp_imgfmt_to_name(p.imgfmt))}, - {"bpp", SUB_PROP_INT(bpp)}, - {"depth", SUB_PROP_INT(depth)}, + {"average_bpp", SUB_PROP_INT(bpp), + .unavailable = !bpp}, + {"plane_depth", SUB_PROP_INT(desc.plane_bits), + .unavailable = !(desc.flags & MP_IMGFLAG_PLANAR)}, {"w", SUB_PROP_INT(p.w)}, {"h", SUB_PROP_INT(p.h)}, {"dw", SUB_PROP_INT(p.d_w)}, |