summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2023-03-19 12:30:24 +0100
committerMikhail Burakov <mburakov@mailbox.org>2023-03-19 12:30:24 +0100
commit1b00a18b7c50e54928dcd273d2b6800f0c0a24f0 (patch)
treef35e56f52bb76cbd847c758353eacd382ca9079b /main.c
parent85c81156a37e161ca08831b9ac9af022c72ebdea (diff)
Add colorspace and ranges handling to streamer
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/main.c b/main.c
index 8e63703..8d7a42c 100644
--- a/main.c
+++ b/main.c
@@ -25,10 +25,18 @@
#include <unistd.h>
#include "capture.h"
+#include "colorspace.h"
#include "encode.h"
#include "gpu.h"
#include "util.h"
+// TODO(mburakov): Currently zwp_linux_dmabuf_v1 has no way to provide
+// colorspace and range information to the compositor. Maybe this would change
+// in the future, i.e keep an eye on color-representation Wayland protocol:
+// https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/183
+static const enum YuvColorspace colorspace = kItuRec601;
+static const enum YuvRange range = kNarrowRange;
+
static volatile sig_atomic_t g_signal;
static void OnSignal(int status) { g_signal = status; }
@@ -69,7 +77,7 @@ int main(int argc, char* argv[]) {
return EXIT_FAILURE;
}
- struct AUTO(GpuContext)* gpu_context = GpuContextCreate();
+ struct AUTO(GpuContext)* gpu_context = GpuContextCreate(colorspace, range);
if (!gpu_context) {
LOG("Failed to create gpu context");
return EXIT_FAILURE;
@@ -104,7 +112,8 @@ int main(int argc, char* argv[]) {
if (!encode_context) {
uint32_t width, height;
GpuFrameGetSize(captured_frame, &width, &height);
- encode_context = EncodeContextCreate(gpu_context, width, height);
+ encode_context =
+ EncodeContextCreate(gpu_context, width, height, colorspace, range);
if (!encode_context) {
LOG("Failed to create encode context");
return EXIT_FAILURE;