From f34d086cb9e0930c734254e19b41d2964d9d113e Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 7 Apr 2016 18:46:43 +0200 Subject: 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. --- video/mp_image.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'video/mp_image.c') 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 && -- cgit v1.2.3