On-device OpenGL video filters by rom1v · Pull Request #5455 · Genymobile/scrcpy (original) (raw)

@rom1v mentioned this pull request

Nov 7, 2024

@rom1v rom1v marked this pull request as draft

November 7, 2024 09:42

This was referenced

Nov 11, 2024

@rom1v rom1v changed the titleOn-device OpenGL video filter prototype On-device OpenGL video filters

Nov 15, 2024

@rom1v rom1v marked this pull request as ready for review

November 15, 2024 20:57

This was referenced

Nov 15, 2024

@rom1v rom1v mentioned this pull request

Nov 16, 2024

Anric and others added 11 commits

November 19, 2024 21:31

@rom1v

On Android 14, DisplayListener may be broken (it never sends events). This is fixed in recent Android 14 upgrades, but we can't really detect it directly.

As a workaround, a RotationWatcher and DisplayFoldListener were registered as a fallback, until a first "display changed" event was triggered.

To simplify, on Android 14, register a DisplayWindowListener (introduced in Android 11) to listen to configuration changes instead.

Refs #5455 comment <#5455 (comment)> PR #5455 <#5455>

Co-authored-by: Romain Vimont rom@rom1v.com Signed-off-by: Romain Vimont rom@rom1v.com

@rom1v

Listen to display size changes and rotate the virtual display accordingly.

Note: use git show -b to Show this commit ignoring whitespace changes.

Fixes #5428 <#5428> Refs #5370 <#5370> PR #5455 <#5455>

@rom1v

Deprecate --lock-video-orientation in favor of a more general option --capture-orientation, which supports all possible orientations (0, 90, 180, 270, flip0, flip90, flip180, flip270), and a "locked" flag via a '@' prefix.

All the old "locked video orientations" are supported:

In addition, --capture-orientation can rotate/flip the display without locking, so that it follows the physical device rotation.

For example:

scrcpy --capture-orientation=flip90

always flips and rotates the capture by 90° clockwise.

The arguments are consistent with --display-orientation and --record-orientation and --orientation (which provide separate client-side orientation settings).

Refs #4011 <#4011> PR #5455 <#5455>

@rom1v

@rom1v

Apply crop and orientation to virtual display capture.

PR #5455 <#5455>

@rom1v

Include both the event size and the current size in the warning message.

PR #5455 <#5455>

@rom1v

On rotation, it is expected that many successive events are ignored due to size mismatch, when an event was generated from the mirroring window having the old size, but was received on the device with the new size (especially since mouse hover events are forwarded).

Do not flood the console with warnings.

PR #5455 <#5455>

@rom1v

If no size is provided with --new-display, the main display size is used. But the actual size depended on the current device orientation.

To make it deterministic, use the size of the natural device orientation (portrait for phones, landscape for tablets).

PR #5455 <#5455>

@rom1v

@rom1v

@rom1v

Matrix multiplication is not commutative, so the order of filters matters.

PR #5455 <#5455>

MeisterP added a commit to MeisterP/poncho-overlay that referenced this pull request

Nov 28, 2024

@MeisterP

@rom1v rom1v mentioned this pull request

Dec 3, 2024

@rom1v rom1v mentioned this pull request

Mar 17, 2025

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

Introduce several key components to perform OpenGL filters:

PR Genymobile#5455 <Genymobile#5455>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

Expose two methods on Size directly:

This will allow removing ScreenInfo completely.

PR Genymobile#5455 <Genymobile#5455>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

This will allow stopping MediaCodec only after the cleanup of other components which must be performed beforehand.

PR Genymobile#5455 <Genymobile#5455>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

This may be called at any time to interrupt the current encoding, including when MediaCodec is in an expected state.

PR Genymobile#5455 <Genymobile#5455>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

Detecting display size changes is not straightforward:

Extract a "display size monitor" to share the code between screen capture and virtual display capture.

PR Genymobile#5455 <Genymobile#5455>

bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request

Apr 11, 2025

@rom1v

On Android 14, DisplayListener may be broken (it never sends events). This is fixed in recent Android 14 upgrades, but we can't really detect it directly.

As a workaround, a RotationWatcher and DisplayFoldListener were registered as a fallback, until a first "display changed" event was triggered.

To simplify, on Android 14, register a DisplayWindowListener (introduced in Android 11) to listen to configuration changes instead.

Refs Genymobile#5455 comment <Genymobile#5455 (comment)> PR Genymobile#5455 <Genymobile#5455>

Co-authored-by: Romain Vimont rom@rom1v.com Signed-off-by: Romain Vimont rom@rom1v.com

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})