diff options
author | wm4 <wm4@nowhere> | 2016-04-07 18:46:43 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-04-07 18:47:32 +0200 |
commit | f34d086cb9e0930c734254e19b41d2964d9d113e (patch) | |
tree | 5bb40e694e2a7c7444790b4e5d1415c07485e268 /video | |
parent | 8a67606c20958fa21db0b5ba9a17f379bc01786c (diff) | |
download | mpv-f34d086cb9e0930c734254e19b41d2964d9d113e.tar.bz2 mpv-f34d086cb9e0930c734254e19b41d2964d9d113e.tar.xz |
mp_image: introduce a hw_subfmt field
For hwaccel formats, mp_image will merely point to a hardware surface
handle. In these cases, the mp_image_params.imgfmt field describes the
format insufficiently, because it mostly only describes the type of the
hardware format, not its underlying format.
Introduce hw_subfmt to describe the underlying format. It makes sense to
use it with most hwaccels, though for now it will be used with the
following commit only.
Diffstat (limited to 'video')
-rw-r--r-- | video/mp_image.c | 6 | ||||
-rw-r--r-- | video/mp_image.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index ff81dd7666..565de18ca6 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -507,6 +507,8 @@ char *mp_image_params_to_str_buf(char *b, size_t bs, if (p->p_w != p->p_h || !p->p_w) mp_snprintf_cat(b, bs, " [%d:%d]", p->p_w, p->p_h); mp_snprintf_cat(b, bs, " %s", mp_imgfmt_to_name(p->imgfmt)); + if (p->hw_subfmt) + mp_snprintf_cat(b, bs, "[%llu]", (unsigned long long)(p->hw_subfmt)); mp_snprintf_cat(b, bs, " %s/%s", m_opt_choice_str(mp_csp_names, p->colorspace), m_opt_choice_str(mp_csp_levels_names, p->colorlevels)); @@ -547,6 +549,9 @@ bool mp_image_params_valid(const struct mp_image_params *p) if (!desc.id) return false; + if (p->hw_subfmt && !(desc.flags & MP_IMGFLAG_HWACCEL)) + return false; + return true; } @@ -554,6 +559,7 @@ bool mp_image_params_equal(const struct mp_image_params *p1, const struct mp_image_params *p2) { return p1->imgfmt == p2->imgfmt && + p1->hw_subfmt == p2->hw_subfmt && p1->w == p2->w && p1->h == p2->h && p1->p_w == p2->p_w && p1->p_h == p2->p_h && p1->colorspace == p2->colorspace && diff --git a/video/mp_image.h b/video/mp_image.h index af602721f3..c00c78a459 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -39,6 +39,8 @@ // usually copy the whole struct, so that fields added later will be preserved. struct mp_image_params { enum mp_imgfmt imgfmt; // pixel format + uint64_t hw_subfmt; // underlying format for some hwaccel pixfmts + // (will use the HW API's format identifiers) int w, h; // image dimensions int p_w, p_h; // define pixel aspect ratio (never 0/0) enum mp_csp colorspace; |