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
ff579990c2
Shutdown connection before joining threads
...
Interrupting async processors may require to shutdown the connection to
wake up blocking calls.
Therefore, shutdown the connection first, then join the threads, then
close the connection.
Refs commit 9c08eb79cb
2023-11-01 18:36:10 +01:00
Romain Vimont
b8c5853aa6
Disable default stdout/stderr
...
Some devices (mostly Xiaomi) print internal errors using
e.printStackTrace(), flooding the console with irrelevant errors.
Disable system streams used via System.out and System.err streams, to
print only the logs from scrcpy.
Refs #994 <https://github.com/Genymobile/scrcpy/issues/994 >
Refs #4213 <https://github.com/Genymobile/scrcpy/pull/4213 >
2023-11-01 18:36:04 +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
Romain Vimont
5580803406
Always print device model and version
...
Print the log before checking for --list-* options so that it is
printed in all cases.
2023-10-31 19:19:33 +01:00
Romain Vimont
9bfc749803
Add camera documentation
...
PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213 >
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 and Simon Chan
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
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
64930e71b9
Handle camera disconnection
...
Stop mirroring on camera disconnection.
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
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
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
41ccb5883e
Force server exit at the end of main()
...
By default, the Java process exits when all non-daemon threads are
terminated.
The Android SDK might start some non-daemon threads internally,
preventing the scrcpy server to exit in some cases.
So force the process to exit explicitly.
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
Romain Vimont
7a2b756f1e
Fix incorrect comment about AV1 constant
...
MediaFormat.MIMETYPE_VIDEO_AV1 has been added in API 29, not 21.
2023-10-31 12:35:04 +01:00
Romain Vimont
b7ad652a75
Move empty string test for crop option parsing
...
For consistency with other options.
2023-10-26 22:42:46 +02:00
Romain Vimont
3c2013de10
Enable missing-prototypes warning
...
Warn if a global function is defined without a previous prototype
declaration. It is not enabled by default at warning_level=2.
2023-10-24 23:06:57 +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
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
a7c3c9a54c
Make fillBaseContext() method private
...
This is consistent with fillAppInfo() and fillAppContext(), which are
also private.
2023-08-22 20:10:06 +02:00
Romain Vimont
111d02fca4
Add missing 'final' in Java classes
...
For consistency.
2023-08-22 18:52:29 +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
Romain Vimont
fcdf847dd3
Add missing syntax highlighting in audio doc
2023-07-14 23:37:19 +02:00
Romain Vimont
ad05a01800
Add Encoder section
...
This will allow to reference the encoder section directly in issues.
2023-07-14 23:36:21 +02:00
Romain Vimont
328ed3650d
Extract device connection to a separate doc page
...
Create a new "Connection" documentation page.
2023-07-14 23:31:26 +02:00
Romain Vimont
c14668b177
Move display section to video documentation
2023-07-14 23:26:52 +02:00
Romain Vimont
637f48f360
Update links to v2.1.1
2023-07-14 23:09:44 +02:00
Romain Vimont
d391fc3b69
Bump version to 2.1.1
2023-07-14 18:58:58 +02:00
Romain Vimont
75ad925423
Merge branch 'master' into release
2023-07-14 18:58:34 +02:00
Romain Vimont
7e936fa879
Fix meizu deadlock
...
Some devices (Meizu) assume that the video encoding thread has a
Looper. By moving video encoding to a separate thread, commit
feab87053a broke this assumption.
Call Looper.prepare() from this thread to fix the problem.
Fixes #4143 <https://github.com/Genymobile/scrcpy/issues/4143 >
2023-07-13 21:46:50 +02:00
Romain Vimont
01d785d9a3
Increase attempts to start AudioRecord
...
Making the shell app foreground (specific for Android 11) may take more
than 300ms on some devices, so increase the number of attempts from 3 to
5 (separated by 100ms).
Fixes #4147 <https://github.com/Genymobile/scrcpy/issues/4147 >
Refs #3796 <https://github.com/Genymobile/scrcpy/issues/3796 >
Refs 02f4ff7534
2023-07-07 18:21:17 +02:00
Romain Vimont
fe6e9acb36
Log device selection at INFO level
...
The selected device should be logged by default.
2023-07-04 18:22:33 +02:00
Romain Vimont
85b55b3c4e
Fix possible division by zero
...
On sway (a window manager), SDL_WINDOWEVENT_EXPOSED and
SDL_WINDOWEVENT_SIZE_CHANGED might not be called before a mouse event is
triggered. As a consequence, the "content rectangle" might not be
initialized when the mouse event is processed, causing a division by
zero.
To avoid the problem, initialize the content rect immediately when the
window is shown.
Fixes #4115 <https://github.com/Genymobile/scrcpy/issues/4115 >
2023-06-29 19:18:32 +02:00
Romain Vimont
7b7076ef85
Add direct links to donations
2023-06-28 10:58:00 +02:00
Romain Vimont
808bd14e30
Ignore fold change events for other display ids
...
Scrcpy mirrors a specific display id, it must ignore events for other
display ids.
Fixes #4120 <https://github.com/Genymobile/scrcpy/issues/4120 >
2023-06-27 18:43:22 +02:00
Romain Vimont
0049b3ce07
Remove superfluous log
...
This line was committed by error in commit
a52053421a .
2023-06-23 08:23:29 +02:00
Romain Vimont
5764f47fee
Update links to v2.1
2023-06-22 01:18:17 +02:00
Romain Vimont
2dab1f7024
Bump version to 2.1
2023-06-22 01:15:44 +02:00
Romain Vimont
744312ec64
Merge branch 'master' into release
2023-06-22 01:15:39 +02:00
Romain Vimont
b9315620e2
Fix adb forward initialization
...
In forward mode, the dummy byte must be written immediately after the
first accept(), otherwise the client will wait indefinitely, causing a
deadlock (or a timeout).
Regression introduced by 8c650e53cd .
2023-06-22 01:13:53 +02:00
Romain Vimont
ea59d525bd
Fix code style
...
The code should fit in 80 columns.
2023-06-22 01:07:09 +02:00
Romain Vimont
0ffcfa0f5c
Accept failure in rotation or fold registration
...
Do not make scrcpy fail if rotation or display fold listeners could not
be registered.
2023-06-22 00:52:54 +02:00
Romain Vimont
c0f3c080b6
Register DisplayFoldListener only for Android 10+
...
This listener does not exist on Android < 10, and it makes scrcpy fail.
2023-06-22 00:49:11 +02:00
Romain Vimont
d046678f85
Upgrade platform-tools (34.0.3) for Windows
...
Include the latest version of adb in Windows releases.
2023-06-22 00:10:37 +02:00
Romain Vimont
fae3fbc934
Update developer documentation
2023-06-22 00:03:26 +02:00
Romain Vimont
5061b7e02c
Fix build without gradle
...
Add missing class generation from IDisplayFoldListener.aidl.
Refs 24999d0d32
2023-06-22 00:03:26 +02:00
Romain Vimont
09009c2aa7
Upgrade SDL (2.28.0) for Windows
...
Include the latest version of SDL in Windows releases.
Fixes #3825 <https://github.com/Genymobile/scrcpy/issues/3825 >
Refs libsdl/#7478 <https://github.com/libsdl-org/SDL/issues/7478 >
2023-06-20 21:45:14 +02:00
Romain Vimont and Simon Chan
fb21bbf763
Add workarounds for Honor devices
...
Audio did not work on Honor devices.
To make it work, a system context must be set as a base context of
FakeContext (so that a PackageManager is available), and a current
Application and ActivityThread must be set.
These workarounds must not be applied for all devices, because they
might cause other issues.
Fixes #4015 <https://github.com/Genymobile/scrcpy/issues/4015 >
Refs #3085 <https://github.com/Genymobile/scrcpy/issues/3805 >
Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com >
2023-06-19 18:45:40 +02:00
Romain Vimont
0f1afff7a6
Move workarounds execution
...
Expose a single public static method in the Workarounds class to apply
all necessary workarounds.
2023-06-19 18:45:11 +02:00
Romain Vimont
48a00fb481
Log device BRAND
...
The BRAND value is not always the same as the MANUFACTURER value.
2023-06-17 00:25:01 +02:00
Romain Vimont
3b7e2ca9c8
Fix lint warning
...
Suppress lint "DiscouragedPrivateApi" in Workarounds.java.
2023-06-16 23:24:08 +02:00
Romain Vimont
d3c2955fb9
Add --time-limit
...
Add an option to stop scrcpy automatically after a given delay.
PR #4052 <https://github.com/Genymobile/scrcpy/pull/4052 >
Fixes #3752 <https://github.com/Genymobile/scrcpy/issues/3752 >
2023-06-10 16:04:51 +02:00
Romain Vimont
5042f8de93
Improve recording documentation
2023-06-10 16:03:27 +02:00
Romain Vimont
7536f95d1c
Rename raw_video_stream to raw_stream
...
This server-specific option impacts both the video and audio streams.
2023-06-10 12:09:43 +02:00
Romain Vimont
6832e8d629
Remove spurious empty line
2023-06-10 12:07:35 +02:00
Romain Vimont
28313631e5
Reformat Java code
...
Fix code style.
2023-06-09 22:28:01 +02:00
Romain Vimont
fdbc9397a7
Name Java threads
...
Give a user-friendly name to Java threads created by the server.
2023-06-09 22:27:35 +02:00
Romain Vimont
4ad7479425
Add missing shortcut in documentation
...
MOD+Backspace also triggers BACK.
2023-06-08 08:52:21 +02:00
Romain Vimont
a3cdf1a6b8
Add option to kill adb on close
...
Killing adb on close by default would be incorrect, since it would break
any other usage of adb in parallel.
It could be easily done manually by calling "adb kill-server" once
scrcpy terminates, but add an option --kill-adb-on-close for
convenience.
Fixes #205 <https://github.com/Genymobile/scrcpy/issues/205 >
Fixes #2580 <https://github.com/Genymobile/scrcpy/issues/2580 >
Fixes #4049 <https://github.com/Genymobile/scrcpy/issues/4049 >
2023-06-05 19:48:21 +02:00
Romain Vimont
b16d4d1835
Fix adb server vs adb daemon confusion
...
The adb daemon runs on the device, the adb server runs as a background
process on the computer.
2023-06-05 19:45:20 +02:00
Romain Vimont
b8d43866d2
Fix options alphabetical order
...
Commit fc52b24503 missed this one.
2023-06-05 19:44:15 +02:00
Romain Vimont
2d79aeb117
Simplify command in documentation
...
If --no-video is passed, --no-playback is equivalent to
--no-audio-playback.
2023-06-04 18:43:35 +02:00
Romain Vimont
888a5aae7d
Fix typo in recording documentation
...
The option is --record, not --record-file.
2023-06-04 18:40:55 +02:00
Romain Vimont
323ea2f1d9
Fix PTS when not monotonically increasing
...
Some decoders fail to guarantee that PTS is strictly monotonically
increasing. Fix the (rescaled) PTS when it does not respect this
constraint.
Fixes #4054 <https://github.com/Genymobile/scrcpy/issues/4054 >
2023-06-03 18:50:28 +02:00
Romain Vimont
9ca554ca41
Extract stream-specific structure in recorder
...
For now, it only contains the stream index, but more fields will be
added.
2023-06-03 18:48:01 +02:00
Romain Vimont
9d3c656414
Fix recorder waiting when stream disabled
...
In the recorder, if the video or audio stream is disabled, do not wait
for its initialization (it will never happen) to process the header.
In that case (scrcpy --no-audio --record=file.mp4), this caused the
whole content to be buffered in memory, and written only on exit.
2023-06-03 18:46:39 +02:00
Romain Vimont
379caf8551
Use a single condvar in recorder
...
The sc_cond_wait() in sc_recorder_process_header() needs to be notified
of changes to video_init/audio_init (protected by stream_cond) and
video_queue/audio_queue (protected by queue_cond).
Use only one condition variable to simplify.
2023-06-03 15:10:42 +02:00
Romain Vimont
2aec7b4c9d
Mention how to interrupt scrcpy without video
...
There is no window to close if video playback is disabled.
2023-06-02 09:00:33 +02:00
Romain Vimont
fc52b24503
Reorder options in alphabetical order
...
Fix the options order, using the short option as key first (if any) in
all cases for consistency.
2023-06-01 12:52:48 +02:00
Romain Vimont
ff5ffc892f
Add option to select audio source
...
Pass --audio-source=mic to capture the microphone instead of the device
audio output.
2023-06-01 09:21:09 +02:00
Romain Vimont
360f2fea1e
Extract AudioCapture creation
...
This will allow to pass capture options without code duplication.
2023-06-01 09:21:09 +02:00
Romain Vimont
8e2c0d6407
Rename rotationChanged to resetCapture
...
The flag is used to reset the capture (restart the encoding) on rotation
change. It will also be used for other events (on folding change), so
rename it.
PR #3979 <https://github.com/Genymobile/scrcpy/pull/3979 >
2023-06-01 09:20:00 +02:00
Romain Vimont
9a2abba098
Update demuxer comment
...
The comment was outdated:
- the "meta" header is now always present (not only when recording is
enabled);
- it is not only used for the video stream, but also for the audio
stream.
2023-06-01 09:04:00 +02:00
Romain Vimont
4c4a03ebe1
Reorder options to maintain alphabetical order
2023-05-30 21:36:48 +02:00
Romain Vimont
c4caa6b81d
Document --no-{video,audio}-playback
...
PR #4033 <https://github.com/Genymobile/scrcpy/pull/4033 >
2023-05-27 10:08:10 +02:00
Romain Vimont
1efbfe1175
Add separate video and audio playback options
...
Add --no-video-playback and --no-audio-playback. The option
--no-playback is now an alias for both.
PR #4033 <https://github.com/Genymobile/scrcpy/pull/4033 >
2023-05-27 10:08:10 +02:00
Romain Vimont
751c09f47a
Simplify V4L2/USB ifdefs
...
Define local variables whose value depends on ifdefs, to avoid
cluttering all conditions with ifdefs.
2023-05-27 09:55:49 +02:00
Romain Vimont
6ad46d70b8
Define v4l2_buffer only if HAVE_V4L2
...
If V4L2 support is disabled, there is no v4l2 buffer option.
2023-05-27 09:55:49 +02:00
Romain Vimont
f46758d1c5
Fix V4L2 error message when disabled
...
For consistency, use the same error message for --v4l2-sink and
--v4l2-buffer.
2023-05-27 09:55:49 +02:00
Romain Vimont
e71f5358b3
Reorder command line options checks
...
Perform checks that impact the options first.
2023-05-27 09:55:49 +02:00
Romain Vimont
a2c8910006
Rename --no-mirror to --no-playback
...
This option impacts video and audio _playback_. For example, if we use
V4L2, the device is still "mirrored" (via V4L2), even if playback is
disabled. Therefore, "playback" is more approriate than "mirror".
The initial option --no-display option was renamed to --no-mirror by
commit 6928acdeac , but this has never been
released, so it is ok to rename it one more time.
Refs #3978 <https://github.com/Genymobile/scrcpy/pull/3978#issuecomment-1549420103 >
PR #4033 <https://github.com/Genymobile/scrcpy/pull/4033 >
2023-05-27 09:55:38 +02:00
Romain Vimont
597d2ccc01
Rename FORMAT to ENCODING
...
The AudioFormat contains several properties. This specific value is
named "encoding".
2023-05-24 22:13:09 +02:00
Romain Vimont
38900d7730
Extract audio source to a static constant
...
For consistency with the other parameters.
2023-05-24 22:13:09 +02:00
Romain Vimont
e926bf1fe8
Delay window resize when minimized
...
On some window managers (e.g. on Windows), performing a resize while the
window is minimized does nothing (the restored window keeps its old
size).
Therefore, like for maximized and fullscreen states, wait for the window
to be restored to apply a resize.
Refs #3947 <https://github.com/Genymobile/scrcpy/issues/3947 >
2023-05-22 18:22:45 +02:00
Romain Vimont
6298ef095f
Accept texture failures
...
When the scrcpy window is minimized on Windows with D3D9, texture
creation and update fail.
In that case, do not terminate scrcpy. Instead, store the pending size
or frame to update, to attempt again during the next update or
rendering.
Fixes #3947 <https://github.com/Genymobile/scrcpy/issues/3947 >
2023-05-22 18:21:10 +02:00
Romain Vimont
7d33798b40
Upgrade FFmpeg build to 6.0-scrcpy-4
...
Use FFmpeg DLLs which do not depend on zlib1.dll.
2023-05-15 21:55:22 +02:00
Romain Vimont
d500550212
Update audio recording documentation
...
Document how to record audio-only to .opus and .aac files.
PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978 >
2023-05-15 14:28:55 +02:00
Romain Vimont
a166eee909
Upgrade FFmpeg build to 6.0-scrcpy-3
...
Use a build which includes the opus muxer, to support recording to .opus
files.
Refs <https://github.com/rom1v/scrcpy-deps/commits/6.0-scrcpy-3 >
PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978 >
2023-05-15 14:28:53 +02:00
Romain Vimont
b11b363e8e
Add recording to aac file
...
It is just an alias for mp4.
PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978 >
2023-05-08 17:11:34 +02:00
Romain Vimont
7321db6f28
Add recording to opus file
...
Use the FFmpeg opus muxer to record an opus file.
PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978 >
2023-05-08 17:11:34 +02:00
Romain Vimont
d6bcde565f
Accept .m4a and .mka
...
These are just aliases for mp4 and mkv when there is no video stream.
PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978 >
2023-05-08 17:11:34 +02:00
Romain Vimont
98f4f4e68a
Refactor command line checks
...
Several checks are performed when opts->record_filename is not NULL.
Group them in a single block.
PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978 >
2023-05-08 17:11:34 +02:00