Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more dump location quirks for vtcapture #133

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | 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 |


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 = 0x10,
QUIRK_ALTERNATIVE_DUMP_LOCATION_4 = 0x20,
QUIRK_ALTERNATIVE_DUMP_LOCATION_5 = 0x40,

// 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