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).
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=flip90
always flips and rotates the capture by 90° clockwise.
The arguments are consistent with --orientation (which provides a
separate client-side orientation).
Expose two methods on Size directly:
- limit() to downscale a size;
- round8() to round both dimensions to multiples of 8.
This will allow to remove ScreenInfo completely.
If a new display is set, force options.getDisplayId() to return
Device.DISPLAY_ID_NONE, to avoid any confusion between a local displayId
and options.getDisplayId().
All options were configured dynamically by sending a single byte to an
output stream. But in practice, only the power mode must be changed
dynamically, the others are configured once on start.
For simplicity, pass the value of static options as command line
arguments, and handle dynamic options in a loop only from a separate
thread once the clean up process is started.
This will allow to easily add cleanup options with values which do not
fit in 1 byte.
Also handle the clean up thread (and the loading of initial settings
values) from the CleanUp class, to expose a simpler clean up API.
Refs 9efa162949
PR #5447 <https://github.com/Genymobile/scrcpy/pull/5447>
Reset video capture/encoding on MOD+Shift+r.
Like on device rotation, this starts a new encoding session which
produces a video stream starting by a key frame.
PR #5432 <https://github.com/Genymobile/scrcpy/pull/5432>
When the MediaCodec input is a Surface, no EOS (end-of-stream) will
never occur automatically: it may only be triggered manually by
MediaCodec.signalEndOfInputStream().
Use this signal to interrupt the blocking call to dequeueOutputBuffer()
immediately on reset, without waiting for the next frame to be dequeued.
PR #5432 <https://github.com/Genymobile/scrcpy/pull/5432>
When the capture source becomes "invalid" (because the display size
changes for example), a reset request is performed to restart the
encoder.
The reset state was stored in SurfaceCapture. The capture implementation
set the flag, and the encoder consumed it.
However, this mechanism did not allow a reset request to _interrupt_ the
encoder, which may be waiting on a blocking call (until a new frame is
produced).
To be able to interrupt the encoder, a reset request must not only set a
flag, but run a callback provided by the encoder. For that purpose,
introduce the CaptureListener interface, which is notified by the
SurfaceCapture implementation whenever the capture is invalidated.
For now, the listener implementation just set a flag as before, so the
behavior is unchanged. It lays the groundwork for the next commits.
PR #5432 <https://github.com/Genymobile/scrcpy/pull/5432>
While moving code, commit 874eaec487 added
a condition `if (displayId == 0)` to register a rotation watcher,
without good reasons.
This condition was kept when the rotation watcher was moved to a
fallback in e26bdb07a2.
Note: use `git show -b` to show this commit ignoring whitespace changes.
Refs #5428 <https://github.com/Genymobile/scrcpy/issues/5428>
Accept a single boolean "on" rather than a "mode" (which, in practice,
could only take 2 values: NORMAL and OFF).
Also rename "screen power mode" to "display power".
PR #5418 <https://github.com/Genymobile/scrcpy/pull/5418>
By adding the '?' prefix, the app is searched by its name instead of its
package name (retrieving app names on the device may take some time):
scrcpy --start-app=?firefox
An app matches if its label starts with the given name,
case-insensitive.
If '+' is also passed to force-stop the app before starting, then the
prefixes must be in that order:
scrcpy --start-app=+?firefox
PR #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
The previous commit introduced:
scrcpy --start-app=name
By adding a '+' prefix, the app is stopped beforehand:
scrcpy --start-app=+name
This may be useful to start a fresh app on a new virtual display:
scrcpy --new-display --start-app=+org.mozilla.firefox
PR #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
Add a command line option --start-app=name to start an Android app by
its package name. For example:
scrcpy --start-app=org.mozilla.firefox
The app will be started on the correct target display:
scrcpy --new-display=1920x1080 --start-app=org.videolan.vlc
PR #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>