The window aspect ratio was previously enforced by calling
`SDL_SetWindowAspectRatio()` before explicitly setting the window size,
using the width/height ratio of the new size.
However, this size may already be a scaled version of the actual content
size, subject to integer rounding. Using this derived size instead of
the actual content size could result in an inaccurate ratio, causing a
mismatch between the content and window aspect ratios, which may result
in a thin row or column of black pixels.
To avoid this issue, always set the aspect ratio based on the content
size.
Refs 1b4fd67286
Refs #6761 <https://github.com/Genymobile/scrcpy/pull/6761>
PR #6774 <https://github.com/Genymobile/scrcpy/pull/6774>
A mechanism was introduced to retry capture at a lower resolution to
support devices unable to encode at the device screen resolution.
While useful, this approach is inherently limited and will not be able
to handle the dynamic resizing required for resizable virtual displays.
Disable this mechanism entirely. Further commits will add support for
adjusting the size in advance according to video encoder capabilities.
Refs #2947 <https://github.com/Genymobile/scrcpy/pull/2947>
PR #6766 <https://github.com/Genymobile/scrcpy/pull/6766>
It was assumed that the video packet immediately following a config
packet was a non-config packet. This is not necessarily true: for
example, if the capture is reset (due to resizing or rotation) before
the first frame is produced.
By default, the window aspect ratio is preserved when resizing.
Add `--no-window-aspect-ratio-lock` to disable this behavior.
PR #6761 <https://github.com/Genymobile/scrcpy/pull/6761>
Signed-off-by: Romain Vimont <rom@rom1v.com>
On Windows and macOS, resizing the window with the mouse blocks the
event loop until the click is released. To keep rendering during
resizing, an event watcher is registered to handle resize events.
Avoid handling resize events twice by ensuring
`SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED` is processed only once.
PR #6758 <https://github.com/Genymobile/scrcpy/pull/6758>
Add --min-size-alignment to force a minimal size alignment.
This is a power-of-2 value (1, 2, 4, 8 or 16) that the video width and
height must be multiples of.
The actual alignment will be the maximum of this value and the video
codec's alignment requirement.
PR #6746 <https://github.com/Genymobile/scrcpy/pull/6746>
The sc_vector and sc_vecdeque utilities define insert_hole() and
push_hole() functions to insert uninitialized items (to be initialized
after the call).
However, "hole" is a poor name. Rename it to "uninitialized" for
clarity.
Previously, when the connection to the device was lost while mirroring,
the window closed immediately, suggesting scrcpy had crashed.
To make it clear that a disconnection occurred, display a disconnected
icon for 2 seconds before closing the window.
PR #6662 <https://github.com/Genymobile/scrcpy/pull/6662>
Replace scrcpy_icon_load(), which loaded the unique scrcpy app icon,
with sc_icon_load(filename), which can load any icon from the icons
directory.
PR #6662 <https://github.com/Genymobile/scrcpy/pull/6662>
SCRCPY_ICON_PATH defined the path of the scrcpy app icon.
SCRCPY_ICON_DIR defines the directory where scrcpy icons reside.
This change prepares for the addition of other icons.
PR #6662 <https://github.com/Genymobile/scrcpy/pull/6662>
When running `scrcpy --capture-orientation=@100`, the error shown is:
> Unsupported orientation: @100 (expected 0, 90, 180, 270, flip0, flip90, flip180 or flip270)
We should tell the user that the error is 100, not @100.
Moreover, the function parse_orientation() should not access the
`optarg` global variable.
PR #6695 <https://github.com/Genymobile/scrcpy/pull/6695>
Signed-off-by: Romain Vimont <rom@rom1v.com>
Use a flag to indicate whether the window is currently shown.
This replaces the old has_video_window flag, which was true only when
the window was shown and video was enabled.
This will simplify performing actions only when the window is currently
shown.
PR #6694 <https://github.com/Genymobile/scrcpy/pull/6694>
If scrcpy is launched by double-clicking scrcpy.exe in Windows Explorer,
automatically set --pause-on-exit=if-error.
Without this, the terminal would close immediately, preventing the user
from seeing the error.
Also remove scrcpy-console.bat, which is now useless.
PR #6667 <https://github.com/Genymobile/scrcpy/pull/6667>
`adb devices -l` prints one device per line, containing, separated by
spaces:
- the device serial,
- the device state,
- a list of key:value pairs.
However, the device serial itself may contain spaces, making a simple
split ambiguous.
To avoid ambiguity, parse the string backwards:
- first, parse all the trailing values until the device state,
identified using a list of well-known values;
- finally, treat the remaining leading token as the device serial.
Fixes#3537 <https://github.com/Genymobile/scrcpy/issues/3537>
Refs #6248 <https://github.com/Genymobile/scrcpy/issues/6248>
PR #6664 <https://github.com/Genymobile/scrcpy/pull/6664>
In SDL3, texture rendering uses SDL_FRect, unlike SDL2 which used
SDL_Rect.
Compute content location using floating-point coordinates from the
start.
PR #6651 <https://github.com/Genymobile/scrcpy/pull/6651>