Doing in Jeffsf's way for libcamera. Credits to @jeffsf