Commit Graph

2250 Commits (camera.24)
 

Author SHA1 Message Date
Romain Vimont fe8b63b921 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%)

Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
7 months ago
Simon Chan 9b38f63ab1 Add --camera-facing
Add an option to select the camera by its lens facing (any, front, back
or external).

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
7 months ago
Romain Vimont 88edb20e53 Make camera id optional
If no camera id is provided, use the first camera available.
7 months ago
Romain Vimont 24c5a38fc0 Handle camera disconnection 7 months ago
Romain Vimont 645d06bc93 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.
7 months ago
Romain Vimont c122c351b8 DONOTMERGE workaround for Android 11 testing 7 months ago
Simon Chan 31bbb97650 Add camera mirroring
Add --video-source=camera, and related options:
 - --camera-id=ID: select the camera (ids are listed by --list-cameras);
 - --camera-size=WIDTHxHEIGHT: select the capture size.

Signed-off-by: Romain Vimont <rom@rom1v.com>
7 months ago
Romain Vimont 4d059cab52 Add --list-camera-sizes 7 months ago
Simon Chan 5406c93283 Add --list-cameras
Add an option to list the device cameras.

Co-authored-by: Romain Vimont <rom@rom1v.com>
7 months ago
Romain Vimont 8c96ab130e Factorize --list- options handling
This will limit code duplication as more list options will be added.
7 months ago
Romain Vimont c191e9a46e Make separator configurable for parsing integers
The separator was hardcoded to ':'. This will allow to reuse the
function to parse sizes as WIDTHxHEIGHT.
7 months ago
Simon Chan e30b7575b2 Extract SurfaceCapture from ScreenEncoder
Extract an interface SurfaceCapture from ScreenEncoder, representing a
video source which can be rendered to a Surface for encoding.

Split ScreenEncoder into:
 - ScreenCapture, implementing SurfaceCapture to capture the device
   screen,
 - SurfaceEncoder, to encode any SurfaceCapture.

This separation prepares the introduction of another SurfaceCapture
implementation to capture the camera instead of the device screen.

Co-authored-by: Romain Vimont <rom@rom1v.com>
7 months ago
Romain Vimont c79e0f6989 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).
7 months ago
Romain Vimont b7ad652a75 Move empty string test for crop option parsing
For consistency with other options.
7 months ago
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>
7 months ago
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>
7 months ago
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>
7 months ago
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.
7 months ago
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>
7 months ago
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>
7 months ago
Romain Vimont 9fdb882509 Fix --pause-on-exit parsing
The function incorrectly returned `false` instead of a valid (and
expected) enum value.
7 months ago
Romain Vimont 8e7b041f35 Add missing `void`s for empty parameter list 7 months ago
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>
7 months ago
Avinash Sonawane 90ba885547 Remove redundant `;`
PR #4371 <https://github.com/Genymobile/scrcpy/pull/4371>

Signed-off-by: Romain Vimont <rom@rom1v.com>
7 months ago
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>
7 months ago
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>
8 months ago
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>
8 months ago
Romain Vimont a7c3c9a54c Make fillBaseContext() method private
This is consistent with fillAppInfo() and fillAppContext(), which are
also private.
9 months ago
Romain Vimont 111d02fca4 Add missing 'final' in Java classes
For consistency.
9 months ago
Romain Vimont 36670dda40 Fix warning typo
A parenthesis was missing.
10 months ago
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>
10 months ago
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>
10 months ago
Aritz T 1ee46970e3 Fix TCP/IP link in README
Refs 328ed3650d
PR #4173 <https://github.com/Genymobile/scrcpy/pull/4173>

Signed-off-by: Romain Vimont <rom@rom1v.com>
10 months ago
Romain Vimont fcdf847dd3 Add missing syntax highlighting in audio doc 11 months ago
Romain Vimont ad05a01800 Add Encoder section
This will allow to reference the encoder section directly in issues.
11 months ago
Romain Vimont 328ed3650d Extract device connection to a separate doc page
Create a new "Connection" documentation page.
11 months ago
Romain Vimont c14668b177 Move display section to video documentation 11 months ago
Romain Vimont 637f48f360 Update links to v2.1.1 11 months ago
Romain Vimont d391fc3b69 Bump version to 2.1.1 11 months ago
Romain Vimont 75ad925423 Merge branch 'master' into release 11 months ago
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>
11 months ago
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
11 months ago
Romain Vimont fe6e9acb36 Log device selection at INFO level
The selected device should be logged by default.
11 months ago
Cédric Skwar 625934fb1b Fix fedora package in build instructions
In Fedora, the package is libusb1-devel.

Fixes #4131 <https://github.com/Genymobile/scrcpy/issues/4131>
PR #4132 <https://github.com/Genymobile/scrcpy/pull/4132>

Signed-off-by: Romain Vimont <rom@rom1v.com>
11 months ago
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>
11 months ago
Romain Vimont 7b7076ef85 Add direct links to donations 11 months ago
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>
11 months ago
Romain Vimont 0049b3ce07 Remove superfluous log
This line was committed by error in commit
a52053421a.
12 months ago
Romain Vimont 5764f47fee Update links to v2.1 12 months ago
Romain Vimont 2dab1f7024 Bump version to 2.1 12 months ago