meson: check if video encoding support is to be built

This commit adds a variable `with_encode` and sets it to true if any
"encode" video codec is enabled through the `video-codecs` build option.
This allows for video encoding related code to be included/excluded from
the build.

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: David Rosca <david.rosca@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40493>
This commit is contained in:
Thong Thai 2026-03-16 18:09:33 +00:00 committed by Marge Bot
parent c8aaa8b902
commit 92fd45381e

View file

@ -443,6 +443,15 @@ if _codecs.contains('all')
elif _codecs.contains('all_free')
_codecs += free_codecs
endif
with_video_encode = false
foreach c : _codecs
if c.contains('enc')
with_video_encode = true
break
endif
endforeach
foreach c : all_codecs
pre_args += '-DVIDEO_CODEC_@0@=@1@'.format(c.to_upper(), _codecs.contains(c).to_int())
endforeach
@ -2527,6 +2536,7 @@ if with_any_vk
video_apis += 'vulkan'
endif
video_summary += {'APIs': video_apis.length() != 0 ? video_apis : false}
video_summary += {'Encoding': with_video_encode}
summary(video_summary, section: 'Video', bool_yn: true, list_sep: ' ')
llvm_summary = {'Required': with_llvm}