Commit graph

1477 commits

Author SHA1 Message Date
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
Romain Vimont
200488111e Add support for RAW audio (WAV) recording
RAW audio forwarding was supported but not for recording.

Add support for recording a raw audio stream to a `.wav` file (and
`.mkv`).
2023-11-15 21:05:38 +01:00
Romain Vimont
1713422c13 Upgrade FFmpeg build to 6.1-scrcpy-2
Use a build with WAV muxer.
2023-11-15 12:02:57 +01:00
Romain Vimont
258eaaae2a Increase default audio buffer for FLAC
FLAC is not low latency: the default encoder produces blocks of 4096
samples, which represent ~85.333ms.

Increase the audio buffer by default so that audio playback works.
2023-11-15 12:02:57 +01:00
megapro17
4857c5dd59 Add support for FLAC audio codec
PR #4410 <#https://github.com/Genymobile/scrcpy/pull/4410>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-11-15 12:02:57 +01:00
Romain Vimont
f23be823fd Upgrade FFmpeg build to 6.1-scrcpy
Upgrade to FFmpeg 6.1, and with FLAC support enabled.
2023-11-15 12:02:57 +01:00
Romain Vimont
e637feba51 Update muxers documentation
Recording now supports formats other than mp4 and mkv.
2023-11-14 09:08:24 +01:00
Romain Vimont
5e59ed3135 Always initialize SDL with the video subsystem
Clipboard synchronization requires SDL_INIT_VIDEO, so always initialize
the video subsystem, even if --no-video or --no-video-playback is
passed.

Refs caf594c90e
Fixes #4418 <https://github.com/Genymobile/scrcpy/issues/4418>
2023-11-11 11:41:15 +01:00
Romain Vimont
3c45625324 Log recording RAW audio codec as error
It is not possible to record with a RAW audio codec, so the log before
exiting should be an error rather than a warning.
2023-11-11 11:24:47 +01:00
Romain Vimont
c3c7bf7af3 Bump version to v2.2 2023-11-01 18:36:33 +01:00
Romain Vimont
855ae4adb1 Upgrade SDL (2.28.4) for Windows
Include the latest version of SDL in Windows releases.
2023-11-01 18:36:10 +01:00
Romain Vimont
a8db3ec9e2 Upgrade platform-tools (34.0.5) for Windows
Include the latest version of adb in Windows releases.
2023-11-01 18:36:10 +01:00
Romain Vimont
c64d150202 Improve manpage formatting 2023-10-31 19:20:59 +01:00
Romain Vimont
8350a61926 Simplify URLs in manpage
The .UR-formatted URLs are not always rendered correctly. Use simple
brackets instead.
2023-10-31 19:19:34 +01:00
Andrew Gunnerson
6af4bd601f Add support for high frame rate camera capture
Add --camera-high-speed to enable high frame rate camera capture. If
the option is enabled, then --camera-fps is mandatory.

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

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-31 15:57:06 +01:00
Andrew Gunnerson
4722bff423 Add --camera-fps
Add a new option for specifying the camera frame rate.

By default, Android's default frame rate (30 fps) is used.

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

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-31 15:57:06 +01:00
Romain Vimont
928f8b8eb3 Do not arbitrary limit --max-fps to 1000
Limit to the variable type size, for consistency.

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 15:57:06 +01:00
Romain Vimont
dd36d6135f Support camera size selection using -m/--camera-ar
In addition to --camera-size to specify an explicit size, make it
possible to select the camera size automatically, respecting the maximum
size (already used for display mirroring) and an aspect ratio.

For example, "scrcpy --video-source=camera" followed by:
 - (no additional arguments)
    : mirrors at the maximum size, any a-r
 - -m1920
    : only consider valid sizes having both dimensions not above 1920
 - --camera-ar=4:3
    : only consider valid sizes having an aspect ratio of 4:3 (+/- 10%)
 - -m2048 --camera-ar=1.6
    : only consider valid sizes having both dimensions not above 2048
      and an aspect ratio of 1.6 (+/- 10%)

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

Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
2023-10-31 15:57:06 +01:00
Simon Chan
faebb7d70a Add --camera-facing
Add an option to select the camera by its lens facing (front, back or
external).

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

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-31 15:57:06 +01:00
Romain Vimont
7f8d079c8c Make camera id optional
If no camera id is provided, use the first camera available.

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 15:57:06 +01:00
Romain Vimont
d544e577c0 Automatically select audio source
If --audio-source is not specified, select the default value
according to the video source:
 - for display mirroring, use device audio by default;
 - for camera mirroring, use microphone by default.

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 15:57:06 +01:00
Simon Chan
bfeecc0131 Add camera mirroring
Add --video-source=camera, and related options:
 - --camera-id=<id>: select the camera by its id (see --list-cameras);
 - --camera-size=<width>x<height>: select the capture size.

Fixed #241 <https://github.com/Genymobile/scrcpy/issues/241>
PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-31 15:57:06 +01:00
Romain Vimont
f032262cd7 Add --list-camera-sizes
Add an option to list the device camera declared sizes.

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 15:57:06 +01:00
Simon Chan
cd63896d63 Add --list-cameras
Add an option to list the device cameras.

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

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-31 15:56:25 +01:00
Romain Vimont
f085765e04 Factorize --list- options handling
This will limit code duplication as more list options will be added.

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 12:45:40 +01:00
Romain Vimont
23e116064d Rename --display to --display-id
The option is named "display id" everywhere.

This will be consistent with --camera-id (there will be many camera
options, so an option --camera would be confusing).

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 12:45:40 +01:00
Romain Vimont
3432029a3d Make separator configurable for parsing integers
The separator was hardcoded to ':'. This will allow to reuse the
function to parse sizes as WIDTHxHEIGHT.

PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
2023-10-31 12:45:31 +01:00
Avinash Sonawane
76a99a7fcd Replace raw number by its name
PR #4373 <https://github.com/Genymobile/scrcpy/pull/4373>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-25 16:13:36 +02:00
Avinash Sonawane
68b55ef2fe Replace sprintf() with safer snprintf()
PR #4373 <https://github.com/Genymobile/scrcpy/pull/4373>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-25 16:13:34 +02:00
Avinash Sonawane
bc8913e12b Use char * for pointer arithmetic
PR #4374 <https://github.com/Genymobile/scrcpy/pull/4374>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-24 23:12:36 +02:00
Avinash Sonawane
8cef8bac94 Declare local functions as static
PR #4374 <https://github.com/Genymobile/scrcpy/pull/4374>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-24 23:06:57 +02:00
Avinash Sonawane
0bbe8a7007 Wrap macros in do-while(0)
To fix the warnings of stray `;`.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-24 22:58:33 +02:00
Romain Vimont
9fdb882509 Fix --pause-on-exit parsing
The function incorrectly returned `false` instead of a valid (and
expected) enum value.
2023-10-24 22:53:41 +02:00
Romain Vimont
8e7b041f35 Add missing voids for empty parameter list 2023-10-23 21:50:40 +02:00
Avinash Sonawane
9ade389069 Make sc_usb_devices_destroy() static
It is only called from the implementation file.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-23 15:39:19 +02:00
Avinash Sonawane
90ba885547 Remove redundant ;
PR #4371 <https://github.com/Genymobile/scrcpy/pull/4371>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-23 15:09:26 +02:00
Avinash Sonawane
7adf98e9d4 Use void for empty function parameter list
PR #4371 <https://github.com/Genymobile/scrcpy/pull/4371>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2023-10-23 15:07:24 +02:00
Romain Vimont
1c864a88eb Use --pause-on-exit from launchers
The terminal opened by scrcpy-console (.bat or .desktop) must not close
if scrcpy terminates with an error, so that error messages can be read.

Refs #3817 <https://github.com/Genymobile/scrcpy/pull/3817>
Refs #3822 <https://github.com/Genymobile/scrcpy/pull/3822>
PR #4130 <https://github.com/Genymobile/scrcpy/pull/4130>
2023-10-11 09:43:44 +02:00
Romain Vimont
1650b7c058 Add --pause-on-exit
Add an option to make scrcpy pause on exit.

Three behaviors are possible:
 - always pause on exit:
    --pause-on-exit
    --pause-on-exit=true
 - never pause on exit:
    (no option)
    --pause-on-exit=false
 - pause when scrcpy returns with an error (a non-zero exit code):
    --pause-on-exit=if-error

This is useful to prevent the terminal window from automatically
closing, so that error messages can be read.

Refs #3817 <https://github.com/Genymobile/scrcpy/pull/3817>
Refs #3822 <https://github.com/Genymobile/scrcpy/pull/3822>
PR #4130 <https://github.com/Genymobile/scrcpy/pull/4130>
2023-10-11 09:43:44 +02:00
Romain Vimont
36670dda40 Fix warning typo
A parenthesis was missing.
2023-08-07 20:22:17 +02:00
Romain Vimont
0983f0a194 Report device disconnection on audio EOS
If --no-video was set, then device disconnection was not reported. To
avoid the problem, report device disconnection also on audio
end-of-stream (EOS).

If both video and audio are enabled, then a device disconnection event
will be sent twice, but only the first one will be handled (since it
makes scrcpy exit).

Fixes #4207 <https://github.com/Genymobile/scrcpy/issues/4207>
2023-08-01 12:05:16 +02:00
Romain Vimont
110b3a16f6 Do not disable controls without video playback
Some control messages can still be used even when video playback is
disabled (i.e. there is no window), for example to turn the screen off.

This reverts commit 92483fe11b
(semantically).

Fixes #4175 <https://github.com/Genymobile/scrcpy/issues/4175>
2023-07-28 14:45:33 +02:00