aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2024-09-25 22:45:42 +0800
committerZhao Zhili <zhilizhao@tencent.com>2024-10-27 11:34:01 +0800
commit0552238570f3feec64d1cdbc6e89196ca46f7e66 (patch)
treed9d3182d97634744da8cc5d961448710ef50cfe7
parentfe219446565e1ce5a13ad6a9b50f574922e2259f (diff)
downloadffmpeg-0552238570f3feec64d1cdbc6e89196ca46f7e66.tar.gz
fftools/ffplay: use swapchain_colorspace_hint to get better HDR support
For example, the default surface configuration on macOS is: VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_PASS_THROUGH_EXT With HDR10 content and swapchain_colorspace_hint, the surface configuration updated to: VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_HDR10_ST2084_EXT Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r--fftools/ffplay_renderer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fftools/ffplay_renderer.c b/fftools/ffplay_renderer.c
index f272cb46f1..618149e7b2 100644
--- a/fftools/ffplay_renderer.c
+++ b/fftools/ffplay_renderer.c
@@ -697,6 +697,7 @@ static int display(VkRenderer *renderer, AVFrame *frame)
struct pl_frame target = {0};
RendererContext *ctx = (RendererContext *) renderer;
int ret = 0;
+ struct pl_color_space hint = {0};
ret = convert_frame(renderer, frame);
if (ret < 0)
@@ -709,6 +710,8 @@ static int display(VkRenderer *renderer, AVFrame *frame)
return AVERROR_EXTERNAL;
}
+ pl_color_space_from_avframe(&hint, frame);
+ pl_swapchain_colorspace_hint(ctx->swapchain, &hint);
if (!pl_swapchain_start_frame(ctx->swapchain, &swap_frame)) {
av_log(NULL, AV_LOG_ERROR, "start frame failed\n");
ret = AVERROR_EXTERNAL;