mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-30 21:37:53 -04:00
vulkan: Add pixel-formats to query format properties
This commit is contained in:
parent
439758f681
commit
80fa9ee516
3 changed files with 46 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
spa_vulkan_sources = [
|
spa_vulkan_sources = [
|
||||||
'plugin.c',
|
'plugin.c',
|
||||||
|
'pixel-formats.c',
|
||||||
'vulkan-compute-filter.c',
|
'vulkan-compute-filter.c',
|
||||||
'vulkan-compute-source.c',
|
'vulkan-compute-source.c',
|
||||||
'vulkan-compute-utils.c',
|
'vulkan-compute-utils.c',
|
||||||
|
|
|
||||||
33
spa/plugins/vulkan/pixel-formats.c
Normal file
33
spa/plugins/vulkan/pixel-formats.c
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* Spa */
|
||||||
|
/* SPDX-FileCopyrightText: Copyright © 2023 columbarius */
|
||||||
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
|
#include "pixel-formats.h"
|
||||||
|
|
||||||
|
#include <spa/utils/defs.h>
|
||||||
|
#include <spa/param/video/raw.h>
|
||||||
|
|
||||||
|
struct pixel_info {
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t bpp;
|
||||||
|
} pixel_infos[] = {
|
||||||
|
{ SPA_VIDEO_FORMAT_RGBA_F32, 16 },
|
||||||
|
{ SPA_VIDEO_FORMAT_BGRA, 4 },
|
||||||
|
{ SPA_VIDEO_FORMAT_RGBA, 4 },
|
||||||
|
{ SPA_VIDEO_FORMAT_BGRx, 4 },
|
||||||
|
{ SPA_VIDEO_FORMAT_RGBx, 4 },
|
||||||
|
{ SPA_VIDEO_FORMAT_BGR, 3 },
|
||||||
|
{ SPA_VIDEO_FORMAT_RGB, 3 },
|
||||||
|
};
|
||||||
|
|
||||||
|
bool get_pixel_format_info(uint32_t format, struct pixel_format_info *info)
|
||||||
|
{
|
||||||
|
struct pixel_info *p;
|
||||||
|
SPA_FOR_EACH_ELEMENT(pixel_infos, p) {
|
||||||
|
if (p->format != format)
|
||||||
|
continue;
|
||||||
|
info->bpp = p->bpp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
12
spa/plugins/vulkan/pixel-formats.h
Normal file
12
spa/plugins/vulkan/pixel-formats.h
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* Spa */
|
||||||
|
/* SPDX-FileCopyrightText: Copyright © 2023 columbarius */
|
||||||
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
struct pixel_format_info {
|
||||||
|
uint32_t bpp; // bytes per pixel
|
||||||
|
};
|
||||||
|
|
||||||
|
bool get_pixel_format_info(uint32_t format, struct pixel_format_info *info);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue