Skip to content

Commit

Permalink
Add more dump location quirks for vtcapture
Browse files Browse the repository at this point in the history
  • Loading branch information
sundermann committed Feb 26, 2025
1 parent 1163777 commit 878cb1f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 4 additions & 0 deletions src/quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 22 additions & 1 deletion unicapture/backends/libvtcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 878cb1f

Please sign in to comment.