From 878cb1fc3aed9a7ab0a54a7afe901783c2a0bee3 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Wed, 26 Feb 2025 21:41:12 +0100 Subject: [PATCH 1/2] Add more dump location quirks for vtcapture --- README.md | 16 ++++++++++------ src/quirks.h | 4 ++++ unicapture/backends/libvtcapture.cpp | 23 ++++++++++++++++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index be9d86e..258201a 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,16 @@ In this case, to not need totally different binaries, we implemented *quirks*, w Currently the following ones exist: -| Backend | Quirk | Description | Flag | -|-------------------|---------------------------------|-------------------------------------------------------------------------|-------| -| DILE_VT | QUIRK_DILE_VT_CREATE_EX | Use `DILE_VT_CreateEx` instead of `DILE_VT_Create` | 0x1 | -| DILE_VT | QUIRK_DILE_VT_NO_FREEZE_CAPTURE | Do not freeze frame before capturing (higher fps) | 0x2 | -| DILE_VT VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION | (webOS 3.4, VTCAPTURE) Use alternative dump location | 0x4 | -| VTCAPTURE | QUIRK_VTCAPTURE_FORCE_CAPTURE | Use of a custom kernel module for reenable capture in special situation | 0x100 | +| Backend | Quirk | Description | Flag | +|-------------------|-----------------------------------|---------------------------------------------------------------------------------|-------| +| DILE_VT | QUIRK_DILE_VT_CREATE_EX | Use `DILE_VT_CreateEx` instead of `DILE_VT_Create` | 0x1 | +| DILE_VT | QUIRK_DILE_VT_NO_FREEZE_CAPTURE | Do not freeze frame before capturing (higher fps) | 0x2 | +| DILE_VT VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION | (webOS 3.4, VTCAPTURE) Use alternative dump location (vtcapture: SCALER_OUTPUT) | 0x4 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_2 | Use alternative dump location SCALER_INPUT | 0x8 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_3 | Use alternative dump location BLENDED_OUTPUT | 0x16 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_4 | Use alternative dump location OSD_OUTPUT | 0x32 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_5 | Use alternative dump location HISTOGRAM_OUTPUT | 0x64 | +| VTCAPTURE | QUIRK_VTCAPTURE_FORCE_CAPTURE | Use of a custom kernel module for reenable capture in special situation | 0x100 | They can be provided in `config.json` via the `{"quirks": 0}` field or on commandline via `--quirks`. diff --git a/src/quirks.h b/src/quirks.h index 530a148..ba1f6d1 100644 --- a/src/quirks.h +++ b/src/quirks.h @@ -12,6 +12,10 @@ enum CAPTURE_QUIRKS { DILE_VT_SetVideoFrameOutputDeviceOutputRegion */ QUIRK_ALTERNATIVE_DUMP_LOCATION = 0x4, + QUIRK_ALTERNATIVE_DUMP_LOCATION_2 = 0x8, + QUIRK_ALTERNATIVE_DUMP_LOCATION_3 = 0x16, + QUIRK_ALTERNATIVE_DUMP_LOCATION_4 = 0x32, + QUIRK_ALTERNATIVE_DUMP_LOCATION_5 = 0x64, // vtCapture // Reenables video capture using custom kernel module diff --git a/unicapture/backends/libvtcapture.cpp b/unicapture/backends/libvtcapture.cpp index 7cce4e8..aed0188 100644 --- a/unicapture/backends/libvtcapture.cpp +++ b/unicapture/backends/libvtcapture.cpp @@ -28,6 +28,15 @@ typedef struct _vtcapture_backend_state { bool quirk_force_capture; } vtcapture_backend_state_t; +enum _vtcapture_dump_location { + SCALER_INPUT, + SCALER_OUTPUT, + DISPLAY_OUTPUT, + BLENDED_OUTPUT, + OSD_OUTPUT, + HISTOGRAM_OUTPUT +}; + int capture_terminate(void* state); int capture_init(cap_backend_config_t* config, void** state_p) @@ -52,7 +61,19 @@ int capture_init(cap_backend_config_t* config, void** state_p) // Sorry, no unlimited fps for you. self->props.frm = config->fps == 0 ? 60 : config->fps; - self->props.dump = HAS_QUIRK(config->quirks, QUIRK_ALTERNATIVE_DUMP_LOCATION) ? 1 : 2; + + self->props.dump = DISPLAY_OUTPUT; + if (HAS_QUIRK(config->quirks, QUIRK_ALTERNATIVE_DUMP_LOCATION)) + self->props.dump = SCALER_OUTPUT; + if (HAS_QUIRK(config->quirks, QUIRK_ALTERNATIVE_DUMP_LOCATION_2)) + self->props.dump = SCALER_INPUT; + if (HAS_QUIRK(config->quirks, QUIRK_ALTERNATIVE_DUMP_LOCATION_3)) + self->props.dump = BLENDED_OUTPUT; + if (HAS_QUIRK(config->quirks, QUIRK_ALTERNATIVE_DUMP_LOCATION_4)) + self->props.dump = OSD_OUTPUT; + if (HAS_QUIRK(config->quirks, QUIRK_ALTERNATIVE_DUMP_LOCATION_5)) + self->props.dump = HISTOGRAM_OUTPUT; + self->props.loc.x = 0; self->props.loc.y = 0; self->props.reg.w = config->resolution_width; From 9b80cb0cd3ba76ada40ad1756ca5bd4bec06a2d9 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Wed, 26 Feb 2025 21:50:16 +0100 Subject: [PATCH 2/2] Add more dump location quirks for vtcapture --- README.md | 6 +++--- src/quirks.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 258201a..5f3f9f1 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,9 @@ Currently the following ones exist: | DILE_VT | QUIRK_DILE_VT_NO_FREEZE_CAPTURE | Do not freeze frame before capturing (higher fps) | 0x2 | | DILE_VT VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION | (webOS 3.4, VTCAPTURE) Use alternative dump location (vtcapture: SCALER_OUTPUT) | 0x4 | | VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_2 | Use alternative dump location SCALER_INPUT | 0x8 | -| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_3 | Use alternative dump location BLENDED_OUTPUT | 0x16 | -| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_4 | Use alternative dump location OSD_OUTPUT | 0x32 | -| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_5 | Use alternative dump location HISTOGRAM_OUTPUT | 0x64 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_3 | Use alternative dump location BLENDED_OUTPUT | 0x10 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_4 | Use alternative dump location OSD_OUTPUT | 0x20 | +| VTCAPTURE | QUIRK_ALTERNATIVE_DUMP_LOCATION_5 | Use alternative dump location HISTOGRAM_OUTPUT | 0x40 | | VTCAPTURE | QUIRK_VTCAPTURE_FORCE_CAPTURE | Use of a custom kernel module for reenable capture in special situation | 0x100 | diff --git a/src/quirks.h b/src/quirks.h index ba1f6d1..dedaea5 100644 --- a/src/quirks.h +++ b/src/quirks.h @@ -13,9 +13,9 @@ enum CAPTURE_QUIRKS { */ QUIRK_ALTERNATIVE_DUMP_LOCATION = 0x4, QUIRK_ALTERNATIVE_DUMP_LOCATION_2 = 0x8, - QUIRK_ALTERNATIVE_DUMP_LOCATION_3 = 0x16, - QUIRK_ALTERNATIVE_DUMP_LOCATION_4 = 0x32, - QUIRK_ALTERNATIVE_DUMP_LOCATION_5 = 0x64, + QUIRK_ALTERNATIVE_DUMP_LOCATION_3 = 0x10, + QUIRK_ALTERNATIVE_DUMP_LOCATION_4 = 0x20, + QUIRK_ALTERNATIVE_DUMP_LOCATION_5 = 0x40, // vtCapture // Reenables video capture using custom kernel module