Commit Graph

565 Commits (e2996e85c0e2e75b012b259ba4346b0b6d7b1e9a)
 

Author SHA1 Message Date
Yu-Chen Lin 1630f923ef Return success count in injectText
It will insert as many text as possible now.
Fix #509, tested on Windows 10 and Arch Linux.

Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
5 years ago
Romain Vimont e443518ed9 Print adb command on error
When the execution of an adb command fails, print the command. This will
help to understand what went wrong.

See <https://github.com/Genymobile/scrcpy/issues/530>.
5 years ago
Romain Vimont eeb8e8420f Use size_t for command length
The size of an array should have type size_t.
5 years ago
Romain Vimont 39b5893c42 Merge pull request #522 from dos1/compositor
Disable X11 compositor bypass
5 years ago
Sebastian Krzyszkowiak b941854c73 Disable X11 compositor bypass
Compositor bypass is meant for fullscreen games consuming lots of GPU
resources. For a light app that will usually be windowed, this only
causes unnecessary compositor suspends, especially visible (and
annoying) with complying window manager like KWin.

Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Sebastian Krzyszkowiak 068253a3a2 Fix mouse focus clickthrough
Mouse focus clickthrough didn't work due to compat.h header not being
included in scrcpy.c.

Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont c8338b2918 Recover if expand/collapse panels is not available
Some devices don't have the required method. Recover gracefully without
crashing the server.

Fixes <https://github.com/Genymobile/scrcpy/issues/506>.
5 years ago
Romain Vimont 2837c6eaab Add method to log error without throwable
Add Ln.e(message) in addition to Ln.e(message, error).
5 years ago
Romain Vimont 668e54fd4b Upgrade gradle 5 years ago
Romain Vimont 01664777c8 Merge branch 'master' into dev 5 years ago
Gerdal ffa8c66979 Fix link error on Windows Subsystem for Linux
Build failed on WSL because of lack of reference to WinMain@16 during
linking.

Fixes <https://github.com/Genymobile/scrcpy/issues/316>

Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont 5254e585c6 Run server tests on release 5 years ago
Romain Vimont 66baf0f95b Run tests with ASAN enabled
This may capture more errors (like
e2ef39fae5).
5 years ago
Romain Vimont f11b0ec204 Fix server checkstyle errors
Fix errors reported by:

    gradle -p server check
5 years ago
Romain Vimont e2ef39fae5 Fix overflow in test
The serialized text is not nul-terminated (its size is explicitely
provided), but the input text in the event is a nul-terminated string.

The test was failing with ASAN enabled.
5 years ago
Romain Vimont 3eda38e5fc Do not call codec.stop() on exception
On exception, the codec is not in a state were .stop() can be called.
5 years ago
Andrew Rabert a16cf95b8e Remove deprecated Arch Linux package
The `scrcpy-prebuiltserver` has been deprecated in favor of the `scrcpy`
package.

<https://aur.archlinux.org/cgit/aur.git/commit/?h=scrcpy-prebuiltserver&id=2ef4359b2e45fc278a191fae014d381b486ffcfe>

Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont 71fd238b0a Update developer documentation for v1.8 5 years ago
Romain Vimont d795144a36 Add note about Ctrl+C on Windows while recording
Ctrl+C kills the app on Windows, so the recorded file is broken.
5 years ago
Romain Vimont c287826f8e Update links to v1.8 in README and BUILD 5 years ago
Romain Vimont 1323e3c43e Bump version to 1.8 5 years ago
Romain Vimont 50dac2eaee Log "new texture" at INFO level
The "initial texture" is logged at INFO level. For consistency, log "new
texture" at the same level.
5 years ago
Romain Vimont b8ff35efe6 Remove empty line 5 years ago
Romain Vimont 7fad611dfb Merge branch 'dev' 5 years ago
Romain Vimont a7b3901c31 Add more consts
Some decoder and recorder functions must not write to AVCodec and
AVPacket.
5 years ago
Romain Vimont fc81d0d771
Merge pull request #442 from npes87184/master
server/meson.build: support relative path for prebuilt_server
5 years ago
Romain Vimont f7efafd846 Explicitly pass control flag to input manager
Replace the "global" control flag in the input_manager by a function
parameter to make explicit that the behavior depends whether
--no-control has been set.
5 years ago
Yu-Chen Lin c456e38264 server/meson.build: support relative path for prebuilt_server
If we don't do this trick, the prebuilt_server will be
../server/[the_user_defined_path]. In general, we will not give an relative path
based on build directory, which leads to wrong prebuilt_server path.

The building error:

ninja: error: '../scrcpy-server-v1.7.jar', needed by
'server/scrcpy-server.jar', missing and no known rule to make it

Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
5 years ago
Romain Vimont 6baed8a06f Do not init SDL video subsystem if no display
The SDL video subsystem is not necessary if we don't display the video.

Move the sdl_init_and_configure() function from screen.c to scrcpy.c,
because it is not only related to the screen display.
5 years ago
Romain Vimont 8595862005 Use explicit output parameter for skipped frame
The function video_buffer_offer_decoded_frame() returned a bool to
indicate whether the previous frame had been consumed.

This was confusing, because we could expect the returned bool report
whether the action succeeded.

Make the semantic explicit by using an output parameter.

Also revert the flag (report if the frame has been skipped instead of
consumed) to avoid confusion for the first frame (the previous is
neither skipped nor consumed because there is no previous frame).
5 years ago
Romain Vimont 9ef345fdd0 Make owned serial a pointer-to-non-const
The server owns the serial, so it needs to free it. Therefore, it should
not be a pointer-to-const.
5 years ago
Romain Vimont dfed1b250e Replace SDL types by C99 standard types
Scrcpy is a C11 project. Use the C99 standard types instead of the
SDL-specific types:

    SDL_bool -> bool
    SintXX   -> intXX_t
    UintXX   -> uintXX_t
5 years ago
Romain Vimont 8655ba7197 Add option to mirror in read-only
Add an option to disable device control: -n/--no-control.
5 years ago
Romain Vimont 163cd36ccc Rename -n/--no-window to -N/--no-display
The description of scrcpy is "Display and control your Android device".
We want an option to disable display, another one to disable control.

For naming consistency, name it --no-display.

Also change the shortname to -N, so that we can use -n for --no-control
later.
5 years ago
Romain Vimont db6644f1f9 Add missing no_window initialization
Initialize the field no_window in "struct args"
5 years ago
Romain Vimont 36191b7eec Avoid unnecessary call if display is disabled
If --no-window is passed, there is no need to register an event watcher.
5 years ago
Romain Vimont 33ccb1368f Extract event processing out of event_loop()
To avoid too many levels of nested blocks, move the event handling logic
in a separate function.
5 years ago
Romain Vimont aeda583a2c Update code style
Limit source code to 80 chars, and declare functions return type and
modifiers on a separate line.

This allows to avoid very long lines, and all function names are
aligned.

(We do this on VLC, and I like it.)
5 years ago
Romain Vimont b2fe005498 Replace uint64_t by Uint64 for consistency
The field pts is declared Uint64 in struct frame_meta.
5 years ago
Romain Vimont ef118cc633 Describe the --no-window feature in README 5 years ago
Romain Vimont 89812e4eee Implement the --no-window flag
Disable decoder, screen (display), file_handler and controller when
--no-window is requested.

<https://github.com/Genymobile/scrcpy/pull/418>
5 years ago
CapsLock 421a1141e2 Add a new option: -n/--no-window
This option will allow scrcpy to record the stream without display.

Signed-off-by: Romain Vimont <rom@rom1v.com>
5 years ago
Romain Vimont e6e011baaf Add stream layer
The decoder initially read from the socket, decoded the video and sent
the decoded frames to the screen:

              +---------+      +----------+
  socket ---> | decoder | ---> |  screen  |
              +---------+      +----------+

The design was simple, but the decoder had several responsabilities.

Then we added the recording feature, so we added a recorder, which
reused the packets received from the socket managed by the decoder:

                                    +----------+
                               ---> |  screen  |
              +---------+     /     +----------+
  socket ---> | decoder | ----
              +---------+     \     +----------+
                               ---> | recorder |
                                    +----------+

This lack of separation of concerns now have concrete implications: we
could not (properly) disable the decoder/display to only record the
video.

Therefore, split the decoder to extract the stream:

                                    +----------+      +----------+
                               ---> | decoder  | ---> |  screen  |
              +---------+     /     +----------+      +----------+
  socket ---> | stream  | ----
              +---------+     \     +----------+
                               ---> | recorder |
                                    +----------+

This will allow to record the stream without decoding the video.
5 years ago
Romain Vimont e7b7b083aa Store the recording request in a local bool
This avoids to test explicitly whether options->record_filename is NULL.
5 years ago
Romain Vimont 8aeb5c0e3c Fix cleanup order
The order of cleanup was not the reverse as the initialization order. As
a consequence, recorder_destroy() could theoretically be called even if
recorder_init() failed.
5 years ago
Romain Vimont bcd4090d51 Fix recording with old decoding/encoding API
The deprecated avcodec_decode_video2() should always the whole packet,
so there is no need to loop (cf doc/examples/demuxing_decoding.c in
FFmpeg).

This hack changed the packet size and data pointer. This broke recording
which used the same packet.
5 years ago
Romain Vimont 84270e2d18 Rename "stop" to "interrupt"
The purpose of video_buffer_stop() is to interrupt any blocking call, so
rename it to video_buffer_interrupt().
5 years ago
Romain Vimont fff87095d9 Rename "frames" to "video_buffer"
It better describes the purpose of the structure.
5 years ago
Romain Vimont aacb09a3d6 Remove unused mutex field in decoder 5 years ago
Romain Vimont 7d10ec2b5a Add shortcut to expand/collapse notification panel
Use Ctrl+n to expand, Ctrl+Shift+n to collapse.

Fixes <https://github.com/Genymobile/scrcpy/issues/392>
5 years ago