Romain Vimont
f6f2868868
Handle window events from screen.c
...
Only the screen knows what to do on window events.
This paves the way to handle more window events.
2019-11-11 15:02:26 +01:00
Romain Vimont
6996cbf5d3
Log device disconnection
...
If scrcpy closes due to socket disconnection, log a warning.
2019-11-09 21:17:03 +01:00
Romain Vimont
b08a98324d
Fix segfault on empty file recorded
...
Write the file trailer only if the file header have been written, to
avoid a segfault in libav.
Fixes <https://github.com/Genymobile/scrcpy/issues/918 >.
2019-11-07 21:58:57 +01:00
Romain Vimont
c916af0984
Add --prefer-text option
...
Expose an option to configure how key/text events are forwarded to the
Android device.
Enabling the option avoids issues when combining multiple keys to enter
special characters, but breaks the expected behavior of alpha keys in
games (typically WASD).
Fixes <https://github.com/Genymobile/scrcpy/issues/650 >
2019-11-07 19:01:35 +01:00
Romain Vimont
ff061b4f30
Deprecate short options for advanced features
...
The short options will be removed in the future (and may be reused for
other features).
2019-11-07 10:01:59 +01:00
Romain Vimont
157c60feb4
Fix indentation
2019-11-07 09:48:48 +01:00
Romain Vimont
2d90e1befd
Fix include recorder.h
2019-11-06 22:22:46 +01:00
Romain Vimont
0e301ddf19
Factorize scrcpy options and command-line args
...
Do not duplicate all scrcpy options fields in the structure storing the
parsed command-line arguments.
2019-11-06 22:06:54 +01:00
Romain Vimont
c42ff75b74
Pass screen to mouse event converters
...
Mouse events coordinates depend on the screen size and location, so the
converter need to access the screen.
The fact that it needs the position or the size is an internal detail,
so pass a pointer to the whole screen structure.
2019-11-06 21:24:36 +01:00
Romain Vimont
b0db1178d1
Move event conversion to input_manager
...
Only keep helper functions separated.
This will help to convert coordinates internally when necessary.
2019-11-06 21:24:36 +01:00
Romain Vimont
8d601d3210
Rename "input_manager" variables to "im"
...
It is used a lot, a short name improves readability.
2019-11-06 21:24:36 +01:00
Romain Vimont
683f7ca848
Document how to attach a debugger to the server
2019-11-03 19:42:37 +01:00
Romain Vimont
120f08ee96
Fix manpage option parameter format
...
The parameter for --window-title was not underlined the same way as
others.
2019-11-03 16:51:47 +01:00
Romain Vimont
0415672a75
Merge branch 'master' into dev
2019-11-03 15:56:10 +01:00
Romain Vimont
95fd64b5de
Add scrcpy version in recorded video metadata
...
It might help to understand problems in recorded videos.
2019-10-31 20:57:57 +01:00
yangfl
4696878a97
Add manpage for scrcpy
2019-10-31 18:18:19 +08:00
Romain Vimont
3da95b52bd
Rename scrcpy-server.jar to scrcpy-server
...
The server name ending with .jar has several drawbacks:
- meson requires the jar executable to attempt to modify it:
<https://github.com/Genymobile/scrcpy/issues/404#issuecomment-456065923 >
<https://github.com/mesonbuild/meson/issues/4844 >
- meson warns during "ninja install"
<https://github.com/Genymobile/scrcpy/issues/458 >
- some users try to execute it on the computer as a java executable
Removing the extension solves all these problems.
2019-10-31 10:54:29 +01:00
Romain Vimont
c72f677435
Merge branch 'master' into dev
2019-10-30 23:29:44 +01:00
Romain Vimont
1380f6e00f
Fix help for --record-format
...
Record format requires a parameter.
2019-10-30 22:51:40 +01:00
Romain Vimont
17d53be3ef
Fix mouse events conversion
...
The conversion from SDL mouse state to Android mouse state used wrong
constants as mask.
Fixes <https://github.com/Genymobile/scrcpy/issues/635 >
2019-10-25 11:09:06 +02:00
Romain Vimont
f6c8460ebb
Rename window size functions for clarity
...
Now, get_window_size() returns the current window size (fullscreen or
not), while get_windowed_window_size() always returned the windowed size
(the size when fullscreen is disabled).
2019-10-20 16:08:16 +02:00
Romain Vimont
6220456def
Merge mouse and touch events
...
Both are handled the very same way on the device.
2019-10-03 20:37:49 +02:00
Romain Vimont
30168f0428
Ignore duplicate mouse events
...
In SDL, a touch event may simulate an identical mouse event. Since we
already handle touch event, ignore these duplicates.
2019-10-03 20:05:29 +02:00
Romain Vimont
b5a2d99bc2
Send touch events from the client
...
On SDL touch events, send control messages to the server.
2019-10-03 20:05:29 +02:00
Romain Vimont
77f876e29c
Add "inject touch" control message
...
Add a control message type in the protocol to forward touch events to
the device.
2019-10-03 20:05:27 +02:00
Romain Vimont
810ff80ba7
Add buffer_write64be()
...
Add a function to write 64 bits in big-endian from a uint64_t.
2019-10-02 21:40:26 +02:00
Romain Vimont
1f8ba1ca79
Include config.h everywhere
...
Ref: <https://github.com/Genymobile/scrcpy/issues/829 >
Suggested-by: Louis Kruger <louisk@gmail.com>
2019-09-29 22:39:53 +02:00
Louis Kruger
129dabcfa4
Include config.h to fix HIDPI support
...
Ref: <https://github.com/Genymobile/scrcpy/issues/829 >
Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-09-29 22:39:47 +02:00
Yu-Chen Lin
795d103032
input_manager.c: Correct log
...
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
2019-09-28 10:37:25 +08:00
Ta-da
513d1ac96d
Fix option "record-format" related short opt
2019-09-27 10:04:41 +08:00
Romain Vimont
ffdbf5990b
Rename event converter functions
...
Rename "XXX_from_sdl_to_android" to "convert_XXX", to avoid huge
function names.
2019-09-15 17:29:03 +02:00
Romain Vimont
9463850c24
Rename "convert.h" to "event_converter.h"
...
The filename gave no hint about what was converted.
2019-09-15 17:29:03 +02:00
Romain Vimont
a9c8fa305d
Fix segfault on recording with old FFmpeg
...
The AVPacket fields side_data and side_data_elems were not initialized
by av_packet_ref() in old FFmpeg versions (prior to [1]).
As a consequence, on av_packet_unref(), side_data was freed, causing a
segfault.
Fixes <https://github.com/Genymobile/scrcpy/issues/707 >
[1]: <http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commitdiff;h=3b4026e15110547892d5d770b6b43c9e34df458f >
2019-08-13 18:58:36 +02:00
Romain Vimont
8507fea271
Record a packet with its duration
...
Record a packet only once the following has been received, so that we
can set its duration before muxing it.
Fixes <https://github.com/Genymobile/scrcpy/issues/702 >
2019-08-08 18:57:52 +02:00
Arne Schwabe
c05056343b
Fix building on OS X (missing NULL in queue.h)
...
Headers seem to be a bit different in Apple land and you need to include
stddef.h explicitly to the NULL declaration.
This also makes the code a bit more correct, as stddef.h is the header
in the C standard that defines NULL
(https://en.cppreference.com/w/cpp/header/cstddef ).
2019-08-05 15:02:05 +02:00
Romain Vimont
b0184f2869
Initialize queue "last" field
...
The compiler is not always able to see that "last" is always initialized
before being used, so always initialize it.
2019-08-04 16:22:39 +02:00
Romain Vimont
e2ac996183
Use Cmd instead of Ctrl on macOS when possible
...
Fixes <https://github.com/Genymobile/scrcpy/issues/642 >
2019-08-03 23:13:44 +02:00
Romain Vimont
5e4ccfd832
Use generic FIFO queue for recording
...
Replace the specific recording queue by the new generic FIFO queue
implementation.
2019-08-01 23:15:47 +02:00
Romain Vimont
53b6ee2cf4
Add generic intrusive FIFO queue
...
We need several FIFO queues (a queue of packets, a queue of messages,
etc.).
Some of them are implemented using cbuf, a generic circular buffer. But
for recording, we need to store the packets in an unbounded queue until
they are written, so the queue was implemented manually.
Create a generic implementation (using macros) to avoid reimplementing
it every time.
2019-08-01 23:14:50 +02:00
Romain Vimont
26213f1031
Fix cbuf documentation
2019-08-01 22:50:03 +02:00
Romain Vimont
96b5067cbf
Remove unnecessary backslash in cbuf
2019-08-01 22:08:34 +02:00
Romain Vimont
6abb4902c6
Log recording failure
...
If recording fails, log "recording failed" instead of "recording
complete".
2019-07-31 11:04:38 +02:00
Romain Vimont
d4ed8b6f26
Log scrcpy version and URL on start
...
Keep --version which also print the version of dependencies.
2019-07-31 01:55:43 +02:00
Romain Vimont
35d9185f6c
Record asynchronously
...
The record file was written from the stream thread. As a consequence,
any blocking I/O to write the file delayed the decoder.
For maximum performance even when recording is enabled, send
(refcounted) packets to a separate recording thread.
2019-07-31 01:55:40 +02:00
Romain Vimont
63af7fbafe
Reduce latency by 1 frame
...
To packetize the H.264 raw stream, av_parser_parse2() (called by
av_read_frame()) knows that it has received a full frame only after it
has received some data for the next frame. As a consequence, the client
always waited until the next frame before sending the current frame to
the decoder!
On the device side, we know packets boundaries. To reduce latency,
make the device always transmit the "frame meta" to packetize the stream
manually (it was already implemented to send PTS, but only enabled on
recording).
On the client side, replace av_read_frame() by manual packetizing and
parsing.
<https://stackoverflow.com/questions/50682518/replacing-av-read-frame-to-reduce-delay >
<https://trac.ffmpeg.org/ticket/3354 >
2019-07-31 01:55:32 +02:00
Romain Vimont
a90ccbdf3b
Add option to change the push target
...
A drag & drop always pushed the file to /sdcard/.
Add an option to customize the target directory.
Fixes <https://github.com/Genymobile/scrcpy/issues/659 >
2019-07-31 01:53:16 +02:00
Romain Vimont
ca970e8aa6
Merge branch 'master' into dev
2019-07-31 00:14:17 +02:00
Romain Vimont
3c55d0c69b
Fix double-free on error
...
If writing the recording header fails, do not clean the resources
immediately to avoid double-free.
2019-07-12 21:07:06 +02:00
Romain Vimont
4961256123
Close decoder on stream ended
...
Add missing call to decoder_close().
2019-06-26 23:50:39 +02:00
beango1
8e65c10720
Add option --window-title
...
Add an option to set a custom window title.
Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-06-24 19:58:00 +02:00