Commit graph

1618 commits

Author SHA1 Message Date
Romain Vimont
89df38f641 Bump version to 2.5 2024-06-29 16:52:45 +02:00
Romain Vimont
343f715323 Upgrade platform-tools (35.0.0) for Windows 2024-06-29 13:10:45 +02:00
Romain Vimont
f13f00021f Upgrade SDL (2.30.4) for Windows 2024-06-29 13:10:45 +02:00
Romain Vimont
48c2c03093 Upgrade FFmpeg (7.0.1) for Windows 2024-06-29 13:10:45 +02:00
Romain Vimont
1e3deabd6c Do not call avcodec_close()
The documentation of avcodec_close() says:

> Do not use this function. Use avcodec_free_context() to destroy a
> codec context (either open or closed).

It was deprecated in FFmpeg 7 by commit
1cc24d749569a42510399a29b034f7a77bdec34e:

<1cc24d7495>

> Its use has been discouraged since 2016, but now is no longer used in
> avformat, so there is no reason to keep it public.
2024-06-29 13:10:45 +02:00
Romain Vimont
7633228278 Forward mouse hover events
Also add an option --no-mouse-hover to get the old behavior.

Fixes #2743 <https://github.com/Genymobile/scrcpy/issues/2743>
Fixes #3070 <https://github.com/Genymobile/scrcpy/issues/3070>
PR #5039 <https://github.com/Genymobile/scrcpy/pull/5039>
2024-06-29 12:42:19 +02:00
Romain Vimont
f5e6b8092a Forward all clicks by default for UHID/AOA
By default, only the left click is forwarded to the device, and
secondary clicks trigger shortcuts (the behavior can be configured by
--mouse-bind=xxxx).

But when the mouse mode is relative (AOA and UHID modes), forward all
clicks by default. This makes more sense since the cursor is handled on
the device side, the user expects all mouse buttons to be forwarded.

Refs <https://github.com/Genymobile/scrcpy/issues/4727#issuecomment-2069869750>
PR #5022 <https://github.com/Genymobile/scrcpy/pull/5022>
2024-06-24 23:17:59 +02:00
Romain Vimont
035d60cf5d Add option to configure mouse bindings
Add a new option --mouse-bind=xxxx.

The argument must be exactly 4 characters, one for each secondary click:

    --mouse-bind=xxxx
                 ^^^^
                 ||||
                 ||| `- 5th click
                 || `-- 4th click
                 | `--- middle click
                  `---- right click

Each character must be one of the following:
 - `+`: forward the click to the device
 - `-`: ignore the click
 - `b`: trigger shortcut BACK (or turn screen on if off)
 - `h`: trigger shortcut HOME
 - `s`: trigger shortcut APP_SWITCH
 - `n`: trigger shortcut "expand notification panel"

This deprecates --forward-all-clicks (use --mouse-bind=++++ instead).

Refs <https://github.com/Genymobile/scrcpy/pull/2258#issuecomment-2182394460>
PR #5022 <https://github.com/Genymobile/scrcpy/pull/5022>
2024-06-24 23:17:23 +02:00
Romain Vimont
40493dff60 Fix "resize to fit" when all clicks are forwarded
To resize the window to fit the device screen, it is possible to
double-click in the "black bars".

This feature was mistakenly disabled when --forward-all-clicks was set.

Instead, disable it only if mouse relative mode is enabled (AOA or
UHID), because in that case the mouse cursor is on the device.
2024-06-24 23:00:33 +02:00
Romain Vimont
09ce0307fe Fix zsh completion script
An '=' was missing for some options with an argument.
2024-06-24 22:56:49 +02:00
Romain Vimont
9fa30ab1ae Fix error message parameter
Use the local argument value, not the global optarg variable (even if it
has the same value in practice, as it's passed as argument).
2024-06-24 22:55:24 +02:00
Romain Vimont
0b926922bc Ignore shortcut keycodes
Never inject keycodes used as shortcut modifiers.

Refs #4732 <https://github.com/Genymobile/scrcpy/issues/4732>
PR #4741 <https://github.com/Genymobile/scrcpy/pull/4741>
2024-06-23 19:15:56 +02:00
Romain Vimont
24bcc3fa2b Simplify shortcut modifiers
Restrict shortcut modifiers to be composed of only one item each.

Before, it was possible to select a list of multiple combinations of
modifier keys, like --shortcut-mod='lctrl+lalt,rctrl+rsuper', meaning
that shortcuts would be triggered either by LCtrl+LAlt+key or
RCtrl+RSuper+key.

This was overly generic, probably not used very much, and it prevents to
solve inconsistencies between UP and DOWN events of modifier keys sent
to the device.

Refs #4732 <https://github.com/Genymobile/scrcpy/issues/4732>
PR #4741 <https://github.com/Genymobile/scrcpy/pull/4741>
2024-06-23 19:15:45 +02:00
Romain Vimont
24b9e0a970 Retrieve icon decoder directly
The call to av_find_best_stream() gives the decoder directly, this
avoids to retrieve it afterwards in a separate step.
2024-06-11 10:04:27 +02:00
Romain Vimont
9ea4446369 Release the audio lock early
The final write from the writer thread does not require a lock: it is
guaranteed that enough space is available since the reader thread never
writes.
2024-06-09 19:25:32 +02:00
Romain Vimont
5d1d5bdc16 Fix thread leak on Windows
Fixes #4973 <https://github.com/Genymobile/scrcpy/issues/4973>
2024-06-09 18:27:30 +02:00
Romain Vimont
fd9498e07c Avoid zero-length copies
Return early if there is nothing to read/write.
2024-05-30 15:56:37 +02:00
Romain Vimont
da484b7ab9 Reject recording with control only
If video and audio are disabled, there is nothing to record.
2024-05-12 10:44:27 +02:00
Romain Vimont
063a8339ed Terminate on controller error
This is particularly important to react to server socket disconnection
since video and audio may be disabled.

PR #4868 <https://github.com/Genymobile/scrcpy/pull/4868>
2024-05-11 17:12:00 +02:00
Romain Vimont
45fe6b602b Add scrcpy window without video playback
Add the possibility to solely control the device without screen
mirroring:

    scrcpy --no-video --no-audio

This is different from OTG mode, which does not require USB debugging at
all. Here, the standard mode is used but with the possibility to disable
video playback.

By default, always open a window (even without video playback), and add
an option --no-window.

Fixes #4727 <https://github.com/Genymobile/scrcpy/issues/4727>
Fixes #4793 <https://github.com/Genymobile/scrcpy/issues/4793>
PR #4868 <https://github.com/Genymobile/scrcpy/pull/4868>
2024-05-11 17:06:16 +02:00
Romain Vimont
cca2c9ffb7 Disable FPS counter when no video playback
There is no frame rate to count.
2024-04-19 12:57:18 +02:00
Romain Vimont
22d78e8a82 Fix boolean condition
Use the short-circuit operator && between booleans.
2024-04-19 12:49:03 +02:00
Romain Vimont
9aa6cc71be Forbid --no-control in OTG mode
The whole purpose of OTG is to only control the device.
2024-04-16 15:50:44 +02:00
Romain Vimont
54e08b4eae Fix code style
Limit to 80 columns.
2024-04-16 15:50:41 +02:00
Romain Vimont
aa34d63171 Fix segfault on close with --no-video
Do not call sc_screen_hide_window() if screen is not initialized.

To reproduce:

    scrcpy --no-video --record=file.mp4

This only segfaults in debug mode since commit
fd0f432e87.
2024-04-04 08:52:32 +02:00
Romain Vimont
db55edb196 Fix YUV conversion for full color range
Take the color range (full vs limited) into account to render the
picture.

Note that with the current version of SDL, it has no impact with the SDL
opengl render driver.

Fixes #4756 <https://github.com/Genymobile/scrcpy/issues/4756>
Refs <https://github.com/Genymobile/scrcpy/issues/4756#issuecomment-2003228916>
Refs libusb/#9311 <https://github.com/libsdl-org/SDL/issues/9311>

Suggested-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
2024-03-30 15:28:09 +01:00
Romain Vimont
1c3801a0b1 Add a shortcut to pause/unpause display
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continues to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <https://github.com/Genymobile/scrcpy/issues/1632>
PR #4748 <https://github.com/Genymobile/scrcpy/pull/4748>
2024-03-30 14:20:51 +01:00
Romain Vimont
be3d357a6d Use source repo tarball for libusb
Legitimate or not, we should not use sources that do not match the
repository.

Refs <https://github.com/libusb/libusb/issues/1468#issuecomment-1974787595>
Refs <https://news.ycombinator.com/item?id=39866309>
Refs #4713 <https://github.com/Genymobile/scrcpy/pull/4713>
2024-03-30 14:18:47 +01:00
Romain Vimont
af57309074 Bump version to 2.4 2024-03-02 23:22:09 +01:00
Romain Vimont
a720c946a6 Merge branch 'master' into release 2024-03-02 23:21:32 +01:00
Romain Vimont
8d87b91f69 Build dependencies from sources
The project has 3 build dependencies:
 - SDL
 - FFmpeg
 - libusb

For Windows, the release script downloaded pre-built build dependencies
(either from upstream, or from the scrcpy-deps repository).

Instead, download the source releases and build locally. This offers
more flexibility.

The official adb release is still downloaded and included as is in the
release archive (it is not a build dependency).

Also upgrade FFmpeg to 6.1.1 and libusb to 1.0.27.

PR #4713 <https://github.com/Genymobile/scrcpy/pull/4713>
2024-03-02 22:52:54 +01:00
inson1
125b1103e1 Happy new year 2024!
PR #4716 <https://github.com/Genymobile/scrcpy/pull/4716>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-03-02 16:48:21 +01:00
Romain Vimont
36189b90ea Remove spurious line 2024-03-01 09:57:10 +01:00
Romain Vimont
4dca08cfe3 Set SDL hints before creating any thread
To avoid race conditions in SDL (reported by TSAN).
2024-03-01 09:57:10 +01:00
Romain Vimont
fd0f432e87 Detect missing initializations
Write invalid data in memory to easily detect missing initializations in
debug mode.
2024-03-01 00:52:35 +01:00
Romain Vimont
cdf09805c0 Add missing initialization 2024-03-01 00:52:34 +01:00
Romain Vimont
dd479ed176 Check options specific to SDK keyboard
Fail if an option specific to --keyboard=sdk is passed with another
keyboard input mode.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:52:23 +01:00
Romain Vimont
5f12132c47 Do not fallback keyboard mode if AOA fails
Initially, if AOA initialization failed, default injection method was
used, in order to use the same command/shortcut when the device is
connected via USB or via TCP/IP, without changing the arguments.

Now that there are 3 keyboard modes, it seems unexpected to switch to
another specific mode if AOA fails (and it is inconsistent). If the user
explicitly requests AOA, then use AOA or fail.

Refs #2632 comment <https://github.com/Genymobile/scrcpy/pull/2632#issuecomment-945190859>
PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:52:19 +01:00
Romain Vimont
1c5ad0e813 Reassign -K and -M to UHID keyboard and mouse
The options were deprecated, but for convenience, reassign them to
aliases for --keyboard=uhid and --mouse=uhid respectively.

Their long version (--hid-keyboard and --hid-mouse) remain deprecated.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:52:16 +01:00
Romain Vimont
6a103c809f Add UHID mouse support
Use the following command:

    scrcpy --mouse=uhid

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:52:13 +01:00
Romain Vimont
151a6225d4 Add shortcut to open keyboard settings
The keyboard settings can be opened by:

    adb shell am start -a android.settings.HARD_KEYBOARD_SETTINGS

Add a shortcut (MOD+k) for convenience if the current keyboard is HID.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:52:10 +01:00
Simon Chan
87da68ee0d Handle UHID output
Use UHID output reports to synchronize CapsLock and VerrNum states.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-03-01 00:52:00 +01:00
Simon Chan
840680f546 Add UHID keyboard support
Use the following command:

    scrcpy --keyboard=uhid

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-03-01 00:51:54 +01:00
Romain Vimont
604e59ac7b Initialize controller before keyboards
The UHID keyboard initializer will need the controller.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:50 +01:00
Romain Vimont
4d2c2514fc Initialize controller in two steps
There is a dependency cycle in the initialization order:
 - keyboard depends on controller
 - controller depends on acksync
 - acksync depends on keyboard initialization

To break this cycle, bind the async instance to the controller in a
second step.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:47 +01:00
Romain Vimont
107f7a83ab Extract binary to hex string conversion
PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:44 +01:00
Romain Vimont
2e7f6a6fc4 Rename default keyboard implementation to "sdk"
Rename {keyboard,mouse}_inject to {keyboard,mouse}_sdk.

All implementations "inject" key events and mouse events, what differs
is the mechanism. For these implementations, the Android SDK API is used
to inject events.

Note that the input mode enum variants were already renamed
(SC_KEYBOARD_INPUT_MODE_SDK and SC_MOUSE_INPUT_MODE_SDK).

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:41 +01:00
Romain Vimont
d95276467b Extract mouse HID handling
Split the mouse implementation using AOA and the code handling HID
events, so that HID events can be reused for another protocol (UHID).

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:39 +01:00
Romain Vimont
91485e2863 Extract keyboard HID handling
Split the keyboard implementation using AOA and the code handling HID
events, so that HID events can be reused for another protocol (UHID).

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:37 +01:00
Romain Vimont
f2d6203156 Extract HID events struct
An event contained several fields:
 - the accessory id
 - the HID event data
 - a field ack_to_wait specific to the AOA implementation.

Extract the HID event part to prepare the factorization of HID event
creation.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:34 +01:00
Romain Vimont
2d32557fde Embed HID event data
In the implementation, an HID event is at most 8 bytes. Embed the data
in the HID event structure to avoid allocations and simplify the code.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:30 +01:00
Romain Vimont
ae303b8d07 Rename hid event "buffer" to "data"
This fields contains the HID event data (there is no "bufferization").

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:29 +01:00
Romain Vimont
29ce03e337 Rename "buffer" to "data"
The variable name is intended to match the parameter name of
libusb_control_transfer().

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:25 +01:00
Romain Vimont
48adae1728 Fix HID mouse documentation
The size of a mouse HID event is 4 bytes.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:21 +01:00
Simon Chan
ea98d49bae Introduce --keyboard and --mouse
Until now, there was two modes for keyboard and mouse:
 - event injection using the Android system API (default)
 - HID/AOA over USB

For this reason, the options were exposed as simple flags:
 - -K or --hid-keyboard to enable physical keyboard simulation (AOA)
 - -M or --hid-mouse to enable physical mouse simulation (AOA)

Replace them by explicit --keyboard and --mouse options, with 3 possible
values:
 - disabled
 - sdk (default)
 - aoa

This will allow to add a new mode (uhid).

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-03-01 00:51:15 +01:00
Romain Vimont
35add3daee Accept disabled keyboard or mouse
The input manager assumed that if a controller was present, then both a
key processor and a mouse processor were present.

Remove this assumption, to support disabling keyboard and mouse
separately. This prepares the introduction of new command line options
--keyboard and --mouse.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:51:02 +01:00
Romain Vimont
c0a1aee8ce Always pass input manager instance
Some functions in input_manager.c only have access to a sub-object (for
example the controller). For consistency, always pass the whole
input manager instance.

This will allow to add assertions when keyboard and mouse could be
disabled separately.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
2024-03-01 00:50:39 +01:00
Romain Vimont
a976417572 Fix typo in error message 2024-03-01 00:11:48 +01:00
Romain Vimont
ffa238b9d3 Remove duplicate lines in libusb script 2024-02-29 23:55:44 +01:00
Romain Vimont
295102a6d9 Check device messages assumptions at runtime
Do not assume the server behaves correctly (scrcpy should not require
the device to be trusted).
2024-02-27 10:06:27 +01:00
Romain Vimont
78a7e4f293 Use sc_ prefix for device sender 2024-02-23 20:07:52 +01:00
Romain Vimont
9858eff856 Fix device message deserialization checks
If any message is incomplete, the deserialization method must return
immediately.
2024-02-23 20:07:52 +01:00
Romain Vimont
9e22f3bf1c Replace unsigned char by uint8_t for buffers
For consistency.
2024-02-23 20:07:52 +01:00
Romain Vimont
a7cf4daf3b Avoid negative average buffering
The assumption that underflow and overbuffering are caused by jitter
(and that the delay between the producer and consumer will be caught up)
does not always hold.

For example, if the consumer does not consume at the expected rate (the
SDL callback is not called often enough, which is an audio output
issue), many samples will be dropped due to overbuffering, decreasing
the average buffering indefinitely.

Prevent the average buffering to become negative to limit the
consequences of an unexpected behavior.

PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:09:38 +01:00
Romain Vimont
c12fdf900f Minimize buffer underflow on starting
If playback starts too early, insert silence until the buffer is filled
up to at least target_buffering before playing.

PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:05:33 +01:00
Romain Vimont
4502126e3b Use early return to avoid additional indentation
PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:05:30 +01:00
Romain Vimont
dfa3f97a87 Fix audio player comment
PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:05:22 +01:00
Romain Vimont
edac4b8a9a Increase buffering level smoothness
The buffering level does not change continuously: it increases abruptly
when a packet is received, and decreases abruptly when an audio block is
consumed.

To estimate the buffering level, a rolling average is used.

To make the buffering more stable, increase the smoothness of this
rolling average. This decreases the risk of enabling audio compensation
due to an estimation error.

PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:03:10 +01:00
Romain Vimont
44abed5c68 Improve audio compensation thresholds
Use different thresholds for enabling and disabling compensation.

Concretely, enable compensation if the difference between the average
and the target buffering levels exceeds 4 ms (instead of 1 ms). This
avoids unnecessary compensation due to small noise in buffering level
estimation.

But keep a smaller threshold (1 ms) for disabling compensation, so that
the buffering level is restored closer to the target value. This avoids
to keep the actual level close to the compensation threshold.

PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:02:10 +01:00
Romain Vimont
cfa4f7e2f2 Replace locks by atomics in audio player
The audio output thread only reads samples from the buffer, and most of
the time, the audio receiver thread only writes samples to the buffer.
In these cases, using atomics avoids lock contention.

There are still corner cases where the audio receiver thread needs to
"read" samples (and drop them), so lock only in these cases.

PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 16:01:33 +01:00
Romain Vimont
d47ecef1b5 Limit buffering time value
This avoids unreasonable values which could lead to integer overflow.

PR #4572 <https://github.com/Genymobile/scrcpy/pull/4572>
2024-02-17 15:59:58 +01:00
Romain Vimont
3333e67452 Fix memory leak on error
Fixes #4636 <https://github.com/Genymobile/scrcpy/issues/4636>
2024-02-01 09:19:47 +01:00
Romain Vimont
2ad93d1fc0 Fix scrcpy_otg() return value on error
The function now returns an enum scrcpy_exit_code, not a bool.
2024-01-15 22:01:19 +01:00
Romain Vimont
d067a11478 Do not power on if no video
Power on the device on start only if video capture is enabled.

Note that it only impacts display mirroring, since control is completely
disabled if video source is camera.

Refs 110b3a16f6
2024-01-07 21:12:39 +01:00
Romain Vimont
cd4056d0f3 Fix include formatting 2024-01-02 10:22:28 +01:00
Till Rathmann
d2ed4510a7 Simulate tilt multitouch event by pressing Shift
PR #4529 <https://github.com/Genymobile/scrcpy/pull/4529>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-12-15 22:12:07 +01:00
Harsh Shandilya
604dfd7c6b Fix incorrect compgen usage
PR #4532 <https://github.com/Genymobile/scrcpy/pull/4532>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-12-14 17:08:19 +01:00
Harsh Shandilya
af69689ec1 Fix bash completion syntax
PR #4532 <https://github.com/Genymobile/scrcpy/pull/4532>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-12-14 17:07:20 +01:00
Romain Vimont
cbce42336d Fix manpage syntax
The '-' character must be escaped.

Fixes #4528 <https://github.com/Genymobile/scrcpy/issues/4528>
2023-12-13 13:42:57 +01:00
Romain Vimont
40f2560d98 Bump version to 2.3.1 2023-12-02 12:30:19 +01:00
Romain Vimont
ef79fcbbd2 Fix AV1 demuxing
For AV1, the config packet must not be merged with the next non-config
packet.

This fixes the following error when passing --video-codec=av1:

> INFO: [FFmpeg] libdav1d 1.3.0
> ERROR: [FFmpeg] Unknown OBU type 0 of size 29393
> ERROR: [FFmpeg] Error parsing OBU data
> ERROR: Decoder 'video': could not send video packet: -1094995529

PR #4487 <https://github.com/Genymobile/scrcpy/pull/4487>
2023-12-02 12:20:01 +01:00
Romain Vimont
9497f39fb4 Do not fail if SDL_INIT_VIDEO fails without video
The SDL video subsystem may be initialized so that clipboard
synchronization works even without video playback.

But if the video subsystem initialization fails (e.g. because no video
device is available), consider it as an error only if video playback is
enabled.

Refs 5e59ed3135
Fixes #4477 <https://github.com/Genymobile/scrcpy/issues/4477>
2023-11-29 12:16:05 +01:00
Romain Vimont
bf056b1fee Do not initialize SDL video when not necessary
The SDL video subsystem is required for video playback and clipboard
synchronization.

If neither is used, it is not necessary to initialize it.

Refs 5e59ed3135
Refs 110b3a16f6
Refs #4418 <https://github.com/Genymobile/scrcpy/issues/4418>
Refs #4477 <https://github.com/Genymobile/scrcpy/issues/4477>
2023-11-29 12:14:07 +01:00
Romain Vimont
4135c411af Fix compilation error
Fix the following warning/error:

    ../app/src/cli.c:2158:17: warning: a label can only be part of a
    statement and a declaration is not a statement [-Wpedantic]

With some compilers, this is an error rather than a pedantic warning.

Refs <https://github.com/Genymobile/scrcpy/issues/2256#issuecomment-1467008307>
2023-11-25 23:56:46 +01:00
Romain Vimont
5f3fb843f5 Bump version to 2.3
The previous version bump to 2.2 was incorrect, it was updated by:

    ./bump_version v2.2

instead of:

    ./bump_version 2.2

Correctly bump to version 2.3.

Refs #4433 <https://github.com/Genymobile/scrcpy/issues/4433#issuecomment-1816830875>
2023-11-25 21:40:27 +01:00
Romain Vimont
d037b02cc2 Fix scrcpy-console.desktop
The argument passed to scrcpy was not applied, the full command must be
passed as a single argument.

PR #4448 <https://github.com/Genymobile/scrcpy/pull/4448>
2023-11-25 21:35:04 +01:00
Kid
89761213c3 Do not quote $SHELL in .desktop files
This does not work properly on some desktop environments (KDE), and
$SHELL is unlikely to require quoting.

Fixes #4367 <https://github.com/Genymobile/scrcpy/issues/4367>
PR #4448 <https://github.com/Genymobile/scrcpy/pull/4448>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-11-25 21:28:43 +01:00
Kid
8db4e78b34 Fix Linux desktop files
There were too many backslashes in the Exec line.

Fixes #4367 <https://github.com/Genymobile/scrcpy/issues/4367>
PR #4448 <https://github.com/Genymobile/scrcpy/pull/4448>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-11-25 21:28:43 +01:00
Romain Vimont
eed06b141a Upgrade sdl (2.28.5) for Windows
Include the latest version of SDL in Windows releases.
2023-11-25 21:06:45 +01:00
Romain Vimont
825d7f72c0 Extract $VERSION for dependency scripts
This will allow to update the version only once in these files.
2023-11-25 21:06:45 +01:00
Romain Vimont
2370298b61 Download SDL prebuilt binaries from github
The server is faster than libsdl.org.
2023-11-25 21:06:45 +01:00
Romain Vimont
67f356f881 Improve crossbuild
Install all the prebuilt dependencies for Windows to a specific folder,
and use meson command line options to specify their location.

This removes crossbuild-specific code from the meson scripts and will
simplify dependency upgrades.

PR #4460 <https://github.com/Genymobile/scrcpy/pull/4460>
2023-11-25 21:06:37 +01:00
Romain Vimont
b43a9e8e7a Add --orientation
Add a shortcut to set both the display and record orientations.

PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
2023-11-23 23:34:46 +01:00
Romain Vimont
a9d6cb5837 Add --record-orientation
Add an option to store the orientation to apply in a recorded file.

Only rotations are supported (not flips).

PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
2023-11-23 23:34:46 +01:00
Romain Vimont
2f92686930 Pass --lock-video-orientation argument in degrees
For consistency with the new --display-orientation option, express the
--lock-video-orientation in degrees clockwise:

 * --lock-video-orientation=0 -> --lock-video-orientation=0
 * --lock-video-orientation=3 -> --lock-video-orientation=90
 * --lock-video-orientation=2 -> --lock-video-orientation=180
 * --lock-video-orientation=1 -> --lock-video-orientation=270

PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
2023-11-23 23:27:32 +01:00
Romain Vimont
bb88b60227 Add --display-orientation
Deprecate the option --rotation and introduce a new option
--display-orientation with the 8 possible orientations (0, 90, 180, 270,
flip0, flip90, flip180 and flip270).

New shortcuts MOD+Shift+(arrow) dynamically change the display
(horizontal or vertical) flip.

Fixes #1380 <https://github.com/Genymobile/scrcpy/issues/1380>
Fixes #3819 <https://github.com/Genymobile/scrcpy/issues/3819>
PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
2023-11-23 23:27:28 +01:00
Romain Vimont
9df92ebe37 Fix manpage style syntax 2023-11-20 14:05:54 +01:00
Romain Vimont
0801cf0627 Fix options alphabetical order
Renaming --display to --display-id broke the alphabetical order.

Refs 23e116064d
2023-11-20 14:03:51 +01:00
Romain Vimont
4658c0e5d2 Update record format error message
Recording now supports formats other than mp4 and mkv.

Refs e637feba51
2023-11-16 10:02:25 +01:00
Romain Vimont
15a3bad4ab Log PTS fixing at debug level
Audio PTS are retrieved by AudioRecord.getTimestamp(), so they do not
necessarily exactly match the number of samples (this allows to take
drift and lag into account).

As a consequence, two consecutive timestamps in microseconds may
sometimes end up within the same millisecond, causing the warning. This
is particularly true for the Matroska muxer which uses a timebase of
1/1000 (1 ms precision).

Since this is "expected", lower the log level from warning to debug.
2023-11-15 21:06:53 +01:00