On-device OpenGL video filters by rom1v · Pull Request #5455 · Genymobile/scrcpy (original) (raw)
rom1v marked this pull request as draft
This was referenced
Nov 11, 2024
rom1v changed the title
On-device OpenGL video filter prototype On-device OpenGL video filters
rom1v marked this pull request as ready for review
This was referenced
Nov 15, 2024
rom1v mentioned this pull request
Anric and others added 11 commits
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
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>
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:
- --lock-video-orientation -> --capture-orientation=@
- --lock-video-orientation=0 -> --capture-orientation=@0
- --lock-video-orientation=90 -> --capture-orientation=@90
- --lock-video-orientation=180 -> --capture-orientation=@180
- --lock-video-orientation=270 -> --capture-orientation=@270
In addition, --capture-orientation can rotate/flip the display without locking, so that it follows the physical device rotation.
For example:
scrcpy --capture-orientation=flip90always 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>
Apply crop and orientation to virtual display capture.
Include both the event size and the current size in the warning message.
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.
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).
Matrix multiplication is not commutative, so the order of filters matters.
MeisterP added a commit to MeisterP/poncho-overlay that referenced this pull request
rom1v mentioned this pull request
rom1v mentioned this pull request
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
Introduce several key components to perform OpenGL filters:
- OpenGLRunner: a tool for running a filter to be rendered to a Surface from an OpenGL-dedicated thread
- OpenGLFilter: a simple OpenGL filter API
- AffineOpenGLFilter: a generic OpenGL implementation to apply any 2D affine transform
- AffineMatrix: an affine transform matrix, with helpers to build matrices from semantic transformations (rotate, scale, translate…)
PR Genymobile#5455 <Genymobile#5455>
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
Expose two methods on Size directly:
- limit() to downscale a size;
- round8() to round both dimensions to multiples of 8.
This will allow removing ScreenInfo completely.
PR Genymobile#5455 <Genymobile#5455>
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
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
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
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
bartsaintgermain pushed a commit to bartsaintgermain/scrcpy that referenced this pull request
Detecting display size changes is not straightforward:
- from a DisplayListener, "display changed" events are received, but this does not imply that the size has changed (it must be checked);
- on Android 14 (see e26bdb0), "display changed" events are not received on some versions, so as a fallback, a RotationWatcher and a DisplayFoldListener are registered, but unregistered as soon as a "display changed" event is actually received, which means that the problem is fixed.
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
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 }})