webosbrew / hyperion-webos

hyperion.ng video grabber for webOS
MIT License
144 stars 27 forks source link

Feature: Implement quirks #75

Closed tuxuser closed 2 years ago

tuxuser commented 2 years ago

For specific device quirks, implement the setting quirks which takes a numeric value consisting of bitflags which configure special handling of capture backends and its not possible to handle this case at runtime.

For example devices that use DILE_VT but require calling DILE_VT_CreateEx instead of DILE_VT_Create, use {"quirks":1}.

Currently there is only one known quirk:

enum CAPTURE_QUIRKS {
    QUIRK_DILE_VT_CREATE_EX = 0x1
};

Checking is done via:

HAS_QUIRK(quirks_value, quirks_enum)

Example

if(HAS_QUIRK(config->quirks, QUIRK_DILE_VT_CREATE_EX)) {
  // ... run special routine
} else {
  // ... run regular routine
}

NOTE for the enduser regarding bitflags:

When we have three quirks, like this:

enum CAPTURE_QUIRKS {
    QUIRK_DILE_VT_CREATE_EX = 0x1,
    QUIRK_SOMETHING_ELSE =    0x2,
    QUIRK_SOMETHING_ELSE2 =   0x4,
    ...
    QUIRK_SOMETHING_ELSE8 = 0x100,
    QUIRK_SOMETHING_ELSE9 = 0x200,
};

To create the final value to set for quirks you do an OR operation on these:

quirks = (QUIRK_DILE_VT_CREATE_EX | QUIRK_SOMETHING_ELSE9)