mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-03-05 11:44:29 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd2da81dd8 | ||
|
|
be75bb13f8 | ||
|
|
6f223cb0c6 | ||
|
|
07843d8b3d | ||
|
|
f78b84d674 | ||
|
|
826cf41813 | ||
|
|
457bac5261 | ||
|
|
f49459a493 | ||
|
|
e02e1c04be | ||
|
|
8c7531ef44 | ||
|
|
fa2af4ee40 | ||
|
|
f63a3caee9 | ||
|
|
eff110897b |
54
app/scrcpy.1
54
app/scrcpy.1
@@ -45,15 +45,15 @@ Set a list of comma-separated key:type=value options for the device audio encode
|
||||
|
||||
The possible values for 'type' are 'int' (default), 'long', 'float' and 'string'.
|
||||
|
||||
The list of possible codec options is available in the Android documentation:
|
||||
|
||||
<https://d.android.com/reference/android/media/MediaFormat>
|
||||
The list of possible codec options is available in the Android documentation
|
||||
.UR https://d.android.com/reference/android/media/MediaFormat
|
||||
.UE .
|
||||
|
||||
.TP
|
||||
.BI "\-\-audio\-encoder " name
|
||||
Use a specific MediaCodec audio encoder (depending on the codec provided by \fB\-\-audio\-codec\fR).
|
||||
|
||||
The available encoders can be listed by \fB\-\-list\-encoders\fR.
|
||||
The available encoders can be listed by \-\-list\-encoders.
|
||||
|
||||
.TP
|
||||
.BI "\-\-audio\-source " source
|
||||
@@ -79,19 +79,19 @@ Default is 8M (8000000).
|
||||
.BI "\-\-camera\-ar " ar
|
||||
Select the camera size by its aspect ratio (+/- 10%).
|
||||
|
||||
Possible values are "sensor" (use the camera sensor aspect ratio), "\fInum\fR:\fIden\fR" (e.g. "4:3") and "\fIvalue\fR" (e.g. "1.6").
|
||||
Possible values are "sensor" (use the camera sensor aspect ratio), "<num>:<den>" (e.g. "4:3") and "<value>" (e.g. "1.6").
|
||||
|
||||
.TP
|
||||
.B \-\-camera\-high\-speed
|
||||
Enable high-speed camera capture mode.
|
||||
|
||||
This mode is restricted to specific resolutions and frame rates, listed by \fB\-\-list\-camera\-sizes\fR.
|
||||
This mode is restricted to specific resolutions and frame rates, listed by --list-camera-sizes.
|
||||
|
||||
.TP
|
||||
.BI "\-\-camera\-id " id
|
||||
Specify the device camera id to mirror.
|
||||
|
||||
The available camera ids can be listed by \fB\-\-list\-cameras\fR.
|
||||
The available camera ids can be listed by \-\-list\-cameras.
|
||||
|
||||
.TP
|
||||
.BI "\-\-camera\-facing " facing
|
||||
@@ -131,7 +131,7 @@ Disable screensaver while scrcpy is running.
|
||||
.BI "\-\-display\-id " id
|
||||
Specify the device display id to mirror.
|
||||
|
||||
The available display ids can be listed by \fB\-\-list\-displays\fR.
|
||||
The available display ids can be listed by \-\-list\-displays.
|
||||
|
||||
Default is 0.
|
||||
|
||||
@@ -189,11 +189,9 @@ Inject computer clipboard text as a sequence of key events on Ctrl+v (like MOD+S
|
||||
|
||||
This is a workaround for some devices not behaving as expected when setting the device clipboard programmatically.
|
||||
|
||||
.TP
|
||||
.B \-\-list\-camera\-sizes
|
||||
List the valid camera capture sizes.
|
||||
|
||||
.TP
|
||||
.B \-\-list\-cameras
|
||||
List cameras available on the device.
|
||||
|
||||
@@ -241,7 +239,7 @@ Disable device control (mirror the device in read\-only).
|
||||
|
||||
.TP
|
||||
.B \-N, \-\-no\-playback
|
||||
Disable video and audio playback on the computer (equivalent to \fB\-\-no\-video\-playback \-\-no\-audio\-playback\fR).
|
||||
Disable video and audio playback on the computer (equivalent to --no-video-playback --no-audio-playback).
|
||||
|
||||
.TP
|
||||
.B \-\-no\-audio
|
||||
@@ -363,7 +361,8 @@ Request SDL to use the given render driver (this is just a hint).
|
||||
|
||||
Supported names are currently "direct3d", "opengl", "opengles2", "opengles", "metal" and "software".
|
||||
|
||||
<https://wiki.libsdl.org/SDL_HINT_RENDER_DRIVER>
|
||||
.UR https://wiki.libsdl.org/SDL_HINT_RENDER_DRIVER
|
||||
.UE
|
||||
|
||||
.TP
|
||||
.B \-\-require\-audio
|
||||
@@ -411,13 +410,13 @@ Set the maximum mirroring time, in seconds.
|
||||
|
||||
.TP
|
||||
.BI "\-\-tunnel\-host " ip
|
||||
Set the IP address of the adb tunnel to reach the scrcpy server. This option automatically enables \fB\-\-force\-adb\-forward\fR.
|
||||
Set the IP address of the adb tunnel to reach the scrcpy server. This option automatically enables --force-adb-forward.
|
||||
|
||||
Default is localhost.
|
||||
|
||||
.TP
|
||||
.BI "\-\-tunnel\-port " port
|
||||
Set the TCP port of the adb tunnel to reach the scrcpy server. This option automatically enables \fB\-\-force\-adb\-forward\fR.
|
||||
Set the TCP port of the adb tunnel to reach the scrcpy server. This option automatically enables --force-adb-forward.
|
||||
|
||||
Default is 0 (not forced): the local port used for establishing the tunnel will be used.
|
||||
|
||||
@@ -457,15 +456,15 @@ Set a list of comma-separated key:type=value options for the device video encode
|
||||
|
||||
The possible values for 'type' are 'int' (default), 'long', 'float' and 'string'.
|
||||
|
||||
The list of possible codec options is available in the Android documentation:
|
||||
|
||||
<https://d.android.com/reference/android/media/MediaFormat>
|
||||
The list of possible codec options is available in the Android documentation
|
||||
.UR https://d.android.com/reference/android/media/MediaFormat
|
||||
.UE .
|
||||
|
||||
.TP
|
||||
.BI "\-\-video\-encoder " name
|
||||
Use a specific MediaCodec video encoder (depending on the codec provided by \fB\-\-video\-codec\fR).
|
||||
|
||||
The available encoders can be listed by \fB\-\-list\-encoders\fR.
|
||||
The available encoders can be listed by \-\-list\-encoders.
|
||||
|
||||
.TP
|
||||
.BI "\-\-video\-source " source
|
||||
@@ -635,7 +634,7 @@ Path to adb.
|
||||
|
||||
.TP
|
||||
.B ANDROID_SERIAL
|
||||
Device serial to use if no selector (\fB-s\fR, \fB-d\fR, \fB-e\fR or \fB\-\-tcpip=\fIaddr\fR) is specified.
|
||||
Device serial to use if no selector (-s, -d, -e or --tcpip=<addr>) is specified.
|
||||
|
||||
.TP
|
||||
.B SCRCPY_ICON_PATH
|
||||
@@ -658,14 +657,23 @@ for the Debian Project (and may be used by others).
|
||||
|
||||
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to <https://github.com/Genymobile/scrcpy/issues>.
|
||||
Report bugs to
|
||||
.UR https://github.com/Genymobile/scrcpy/issues
|
||||
.UE .
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2018 Genymobile <https://www.genymobile.com>
|
||||
Copyright \(co 2018 Genymobile
|
||||
.UR https://www.genymobile.com
|
||||
Genymobile
|
||||
.UE
|
||||
|
||||
Copyright \(co 2018\-2023 Romain Vimont <rom@rom1v.com>
|
||||
Copyright \(co 2018\-2023
|
||||
.MT rom@rom1v.com
|
||||
Romain Vimont
|
||||
.ME
|
||||
|
||||
Licensed under the Apache License, Version 2.0.
|
||||
|
||||
.SH WWW
|
||||
<https://github.com/Genymobile/scrcpy>
|
||||
.UR https://github.com/Genymobile/scrcpy
|
||||
.UE
|
||||
|
||||
@@ -8,11 +8,6 @@ import android.util.Log;
|
||||
*/
|
||||
public final class Ln {
|
||||
|
||||
public interface ConsolePrinter {
|
||||
void printOut(String message);
|
||||
void printErr(String message, Throwable throwable);
|
||||
}
|
||||
|
||||
private static final String TAG = "scrcpy";
|
||||
private static final String PREFIX = "[server] ";
|
||||
|
||||
@@ -20,17 +15,12 @@ public final class Ln {
|
||||
VERBOSE, DEBUG, INFO, WARN, ERROR
|
||||
}
|
||||
|
||||
private static ConsolePrinter consolePrinter = new DefaultConsolePrinter();
|
||||
private static Level threshold = Level.INFO;
|
||||
|
||||
private Ln() {
|
||||
// not instantiable
|
||||
}
|
||||
|
||||
public static void setConsolePrinter(ConsolePrinter consolePrinter) {
|
||||
Ln.consolePrinter = consolePrinter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the log level.
|
||||
* <p>
|
||||
@@ -49,28 +39,31 @@ public final class Ln {
|
||||
public static void v(String message) {
|
||||
if (isEnabled(Level.VERBOSE)) {
|
||||
Log.v(TAG, message);
|
||||
consolePrinter.printOut(PREFIX + "VERBOSE: " + message + '\n');
|
||||
System.out.print(PREFIX + "VERBOSE: " + message + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(String message) {
|
||||
if (isEnabled(Level.DEBUG)) {
|
||||
Log.d(TAG, message);
|
||||
consolePrinter.printOut(PREFIX + "DEBUG: " + message + '\n');
|
||||
System.out.print(PREFIX + "DEBUG: " + message + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
public static void i(String message) {
|
||||
if (isEnabled(Level.INFO)) {
|
||||
Log.i(TAG, message);
|
||||
consolePrinter.printOut(PREFIX + "INFO: " + message + '\n');
|
||||
System.out.print(PREFIX + "INFO: " + message + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
public static void w(String message, Throwable throwable) {
|
||||
if (isEnabled(Level.WARN)) {
|
||||
Log.w(TAG, message, throwable);
|
||||
consolePrinter.printErr(PREFIX + "WARN: " + message + '\n', throwable);
|
||||
System.err.print(PREFIX + "WARN: " + message + '\n');
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,26 +74,14 @@ public final class Ln {
|
||||
public static void e(String message, Throwable throwable) {
|
||||
if (isEnabled(Level.ERROR)) {
|
||||
Log.e(TAG, message, throwable);
|
||||
consolePrinter.printErr(PREFIX + "ERROR: " + message + '\n', throwable);
|
||||
System.err.print(PREFIX + "ERROR: " + message + "\n");
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void e(String message) {
|
||||
e(message, null);
|
||||
}
|
||||
|
||||
public static class DefaultConsolePrinter implements ConsolePrinter {
|
||||
@Override
|
||||
public void printOut(String message) {
|
||||
System.out.print(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printErr(String message, Throwable throwable) {
|
||||
System.err.print(message);
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ public final class Server {
|
||||
}
|
||||
|
||||
private static void scrcpy(Options options) throws IOException, ConfigurationException {
|
||||
Ln.i("Device: [" + Build.MANUFACTURER + "] " + Build.BRAND + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")");
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S && options.getVideoSource() == VideoSource.CAMERA) {
|
||||
Ln.e("Camera mirroring is not supported before Android 12");
|
||||
throw new ConfigurationException("Camera mirroring is not supported");
|
||||
@@ -206,8 +208,6 @@ public final class Server {
|
||||
|
||||
Ln.initLogLevel(options.getLogLevel());
|
||||
|
||||
Ln.i("Device: [" + Build.MANUFACTURER + "] " + Build.BRAND + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")");
|
||||
|
||||
if (options.getList()) {
|
||||
if (options.getCleanup()) {
|
||||
CleanUp.unlinkSelf();
|
||||
|
||||
@@ -14,12 +14,6 @@ import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -61,12 +55,6 @@ public final class Workarounds {
|
||||
mustFillAppInfo = true;
|
||||
mustFillBaseContext = true;
|
||||
mustFillAppContext = true;
|
||||
} else if (Build.MANUFACTURER.equalsIgnoreCase("xiaomi")) {
|
||||
// Trash the messages printed to the console by direct calls to System.out and System.err.
|
||||
// Xiaomi device ROMs may print internal errors using e.printStackTrace(), flooding the console with irrelevant errors.
|
||||
ExclusiveConsolePrinter exclusiveConsolePrinter = new ExclusiveConsolePrinter();
|
||||
exclusiveConsolePrinter.installNullSystemStreams();
|
||||
Ln.setConsolePrinter(new ExclusiveConsolePrinter());
|
||||
}
|
||||
|
||||
if (audio && Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
|
||||
@@ -318,48 +306,4 @@ public final class Workarounds {
|
||||
throw new RuntimeException("Cannot create AudioRecord");
|
||||
}
|
||||
}
|
||||
|
||||
static class ExclusiveConsolePrinter implements Ln.ConsolePrinter {
|
||||
|
||||
static class NullOutputStream extends OutputStream {
|
||||
@Override
|
||||
public void write(byte[] b) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
private final PrintStream realOut = new PrintStream(new FileOutputStream(FileDescriptor.out));
|
||||
private final PrintStream realErr = new PrintStream(new FileOutputStream(FileDescriptor.err));
|
||||
|
||||
void installNullSystemStreams() {
|
||||
PrintStream nullStream = new PrintStream(new NullOutputStream());
|
||||
System.setOut(nullStream);
|
||||
System.setErr(nullStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printOut(String message) {
|
||||
realOut.print(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printErr(String message, Throwable throwable) {
|
||||
realErr.print(message);
|
||||
if (throwable != null) {
|
||||
StringWriter errors = new StringWriter();
|
||||
throwable.printStackTrace(new PrintWriter(errors));
|
||||
realErr.print(errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user