summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-04-07 18:46:43 +0200
committerwm4 <wm4@nowhere>2016-04-07 18:47:32 +0200
commitf34d086cb9e0930c734254e19b41d2964d9d113e (patch)
tree5bb40e694e2a7c7444790b4e5d1415c07485e268 /video/mp_image.c
parent8a67606c20958fa21db0b5ba9a17f379bc01786c (diff)
downloadmpv-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/mp_image.c')
-rw-r--r--video/mp_image.c6
1 files changed, 6 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 &&