From bdd1e1e7ec20bc8ff7a5486d589645d9988c7c6c Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 Nov 2019 01:00:32 +0100 Subject: img_format: add mp_regular_imgfmt.forced_csp field As the code comment says, this is needed to disambiguate FFmpeg formats. This struct only describes the "physical" layout of a format, while FFmpeg also attaches part of the colorspace information to the format. --- video/img_format.c | 2 ++ video/img_format.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/video/img_format.c b/video/img_format.c index e224a4b7d4..524fc4eea3 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -454,6 +454,8 @@ bool mp_get_regular_imgfmt(struct mp_regular_imgfmt *dst, int imgfmt) return false; // it's satan himself #endif + res.forced_csp = mp_imgfmt_get_forced_csp(imgfmt); + if (!validate_regular_imgfmt(&res)) return false; diff --git a/video/img_format.h b/video/img_format.h index 39d0a4bdad..5f097d43ff 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -125,6 +125,11 @@ struct mp_regular_imgfmt { // Type of each component. enum mp_component_type component_type; + // See mp_imgfmt_get_forced_csp(). Normally code should use + // mp_image_params.colors. This field is only needed to map the format + // unambiguously to FFmpeg formats. + enum mp_csp forced_csp; + // Size of each component in bytes. uint8_t component_size; -- cgit v1.2.3