Rename --codec-options to --video-codec-options
This prepares the introduction of --audio-codec-options. PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
This commit is contained in:
parent
9087e85c3f
commit
31555fa530
11 changed files with 49 additions and 39 deletions
|
@ -3,7 +3,6 @@ _scrcpy() {
|
||||||
local opts="
|
local opts="
|
||||||
--always-on-top
|
--always-on-top
|
||||||
-b --video-bit-rate=
|
-b --video-bit-rate=
|
||||||
--codec-options=
|
|
||||||
--crop=
|
--crop=
|
||||||
-d --select-usb
|
-d --select-usb
|
||||||
--disable-screensaver
|
--disable-screensaver
|
||||||
|
@ -55,6 +54,7 @@ _scrcpy() {
|
||||||
-V --verbosity=
|
-V --verbosity=
|
||||||
-v --version
|
-v --version
|
||||||
--video-codec=
|
--video-codec=
|
||||||
|
--video-codec-options=
|
||||||
-w --stay-awake
|
-w --stay-awake
|
||||||
--window-borderless
|
--window-borderless
|
||||||
--window-title=
|
--window-title=
|
||||||
|
|
|
@ -10,7 +10,6 @@ local arguments
|
||||||
arguments=(
|
arguments=(
|
||||||
'--always-on-top[Make scrcpy window always on top \(above other windows\)]'
|
'--always-on-top[Make scrcpy window always on top \(above other windows\)]'
|
||||||
{-b,--video-bit-rate=}'[Encode the video at the given bit-rate]'
|
{-b,--video-bit-rate=}'[Encode the video at the given bit-rate]'
|
||||||
'--codec-options=[Set a list of comma-separated key\:type=value options for the device encoder]'
|
|
||||||
'--crop=[\[width\:height\:x\:y\] Crop the device screen on the server]'
|
'--crop=[\[width\:height\:x\:y\] Crop the device screen on the server]'
|
||||||
{-d,--select-usb}'[Use USB device]'
|
{-d,--select-usb}'[Use USB device]'
|
||||||
'--disable-screensaver[Disable screensaver while scrcpy is running]'
|
'--disable-screensaver[Disable screensaver while scrcpy is running]'
|
||||||
|
@ -60,6 +59,7 @@ arguments=(
|
||||||
{-V,--verbosity=}'[Set the log level]:verbosity:(verbose debug info warn error)'
|
{-V,--verbosity=}'[Set the log level]:verbosity:(verbose debug info warn error)'
|
||||||
{-v,--version}'[Print the version of scrcpy]'
|
{-v,--version}'[Print the version of scrcpy]'
|
||||||
'--video-codec=[Select the video codec]:codec:(h264 h265 av1)'
|
'--video-codec=[Select the video codec]:codec:(h264 h265 av1)'
|
||||||
|
'--video-codec-options=[Set a list of comma-separated key\:type=value options for the device video encoder]'
|
||||||
{-w,--stay-awake}'[Keep the device on while scrcpy is running, when the device is plugged in]'
|
{-w,--stay-awake}'[Keep the device on while scrcpy is running, when the device is plugged in]'
|
||||||
'--window-borderless[Disable window decorations \(display borderless window\)]'
|
'--window-borderless[Disable window decorations \(display borderless window\)]'
|
||||||
'--window-title=[Set a custom window title]'
|
'--window-title=[Set a custom window title]'
|
||||||
|
|
20
app/scrcpy.1
20
app/scrcpy.1
|
@ -25,16 +25,6 @@ Encode the video at the given bit\-rate, expressed in bits/s. Unit suffixes are
|
||||||
|
|
||||||
Default is 8M (8000000).
|
Default is 8M (8000000).
|
||||||
|
|
||||||
.TP
|
|
||||||
.BI "\-\-codec\-options " key\fR[:\fItype\fR]=\fIvalue\fR[,...]
|
|
||||||
Set a list of comma-separated key:type=value options for the device encoder.
|
|
||||||
|
|
||||||
The possible values for 'type' are 'int' (default), 'long', 'float' and 'string'.
|
|
||||||
|
|
||||||
The list of possible codec options is available in the Android documentation
|
|
||||||
.UR https://d.android.com/reference/android/media/MediaFormat
|
|
||||||
.UE .
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-crop " width\fR:\fIheight\fR:\fIx\fR:\fIy
|
.BI "\-\-crop " width\fR:\fIheight\fR:\fIx\fR:\fIy
|
||||||
Crop the device screen on the server.
|
Crop the device screen on the server.
|
||||||
|
@ -329,6 +319,16 @@ Select a video codec (h264, h265 or av1).
|
||||||
|
|
||||||
Default is h264.
|
Default is h264.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BI "\-\-video\-codec\-options " key\fR[:\fItype\fR]=\fIvalue\fR[,...]
|
||||||
|
Set a list of comma-separated key:type=value options for the device video encoder.
|
||||||
|
|
||||||
|
The possible values for 'type' are 'int' (default), 'long', 'float' and 'string'.
|
||||||
|
|
||||||
|
The list of possible codec options is available in the Android documentation
|
||||||
|
.UR https://d.android.com/reference/android/media/MediaFormat
|
||||||
|
.UE .
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-w, \-\-stay-awake
|
.B \-w, \-\-stay-awake
|
||||||
Keep the device on while scrcpy is running, when the device is plugged in.
|
Keep the device on while scrcpy is running, when the device is plugged in.
|
||||||
|
|
|
@ -38,6 +38,7 @@ enum {
|
||||||
OPT_RENDER_DRIVER,
|
OPT_RENDER_DRIVER,
|
||||||
OPT_NO_MIPMAPS,
|
OPT_NO_MIPMAPS,
|
||||||
OPT_CODEC_OPTIONS,
|
OPT_CODEC_OPTIONS,
|
||||||
|
OPT_VIDEO_CODEC_OPTIONS,
|
||||||
OPT_FORCE_ADB_FORWARD,
|
OPT_FORCE_ADB_FORWARD,
|
||||||
OPT_DISABLE_SCREENSAVER,
|
OPT_DISABLE_SCREENSAVER,
|
||||||
OPT_SHORTCUT_MOD,
|
OPT_SHORTCUT_MOD,
|
||||||
|
@ -127,16 +128,10 @@ static const struct sc_option options[] = {
|
||||||
.argdesc = "value",
|
.argdesc = "value",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
// deprecated
|
||||||
.longopt_id = OPT_CODEC_OPTIONS,
|
.longopt_id = OPT_CODEC_OPTIONS,
|
||||||
.longopt = "codec-options",
|
.longopt = "codec-options",
|
||||||
.argdesc = "key[:type]=value[,...]",
|
.argdesc = "key[:type]=value[,...]",
|
||||||
.text = "Set a list of comma-separated key:type=value options for the "
|
|
||||||
"device encoder.\n"
|
|
||||||
"The possible values for 'type' are 'int' (default), 'long', "
|
|
||||||
"'float' and 'string'.\n"
|
|
||||||
"The list of possible codec options is available in the "
|
|
||||||
"Android documentation: "
|
|
||||||
"<https://d.android.com/reference/android/media/MediaFormat>",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_CROP,
|
.longopt_id = OPT_CROP,
|
||||||
|
@ -536,6 +531,18 @@ static const struct sc_option options[] = {
|
||||||
.text = "Select a video codec (h264, h265 or av1).\n"
|
.text = "Select a video codec (h264, h265 or av1).\n"
|
||||||
"Default is h264.",
|
"Default is h264.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.longopt_id = OPT_VIDEO_CODEC_OPTIONS,
|
||||||
|
.longopt = "video-codec-options",
|
||||||
|
.argdesc = "key[:type]=value[,...]",
|
||||||
|
.text = "Set a list of comma-separated key:type=value options for the "
|
||||||
|
"device video encoder.\n"
|
||||||
|
"The possible values for 'type' are 'int' (default), 'long', "
|
||||||
|
"'float' and 'string'.\n"
|
||||||
|
"The list of possible codec options is available in the "
|
||||||
|
"Android documentation: "
|
||||||
|
"<https://d.android.com/reference/android/media/MediaFormat>",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.shortopt = 'w',
|
.shortopt = 'w',
|
||||||
.longopt = "stay-awake",
|
.longopt = "stay-awake",
|
||||||
|
@ -1616,7 +1623,11 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
opts->forward_key_repeat = false;
|
opts->forward_key_repeat = false;
|
||||||
break;
|
break;
|
||||||
case OPT_CODEC_OPTIONS:
|
case OPT_CODEC_OPTIONS:
|
||||||
opts->codec_options = optarg;
|
LOGW("--codec-options is deprecated, use --video-codec-options "
|
||||||
|
"instead.");
|
||||||
|
// fall through
|
||||||
|
case OPT_VIDEO_CODEC_OPTIONS:
|
||||||
|
opts->video_codec_options = optarg;
|
||||||
break;
|
break;
|
||||||
case OPT_ENCODER_NAME:
|
case OPT_ENCODER_NAME:
|
||||||
opts->encoder_name = optarg;
|
opts->encoder_name = optarg;
|
||||||
|
|
|
@ -7,7 +7,7 @@ const struct scrcpy_options scrcpy_options_default = {
|
||||||
.window_title = NULL,
|
.window_title = NULL,
|
||||||
.push_target = NULL,
|
.push_target = NULL,
|
||||||
.render_driver = NULL,
|
.render_driver = NULL,
|
||||||
.codec_options = NULL,
|
.video_codec_options = NULL,
|
||||||
.encoder_name = NULL,
|
.encoder_name = NULL,
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
.v4l2_device = NULL,
|
.v4l2_device = NULL,
|
||||||
|
|
|
@ -93,7 +93,7 @@ struct scrcpy_options {
|
||||||
const char *window_title;
|
const char *window_title;
|
||||||
const char *push_target;
|
const char *push_target;
|
||||||
const char *render_driver;
|
const char *render_driver;
|
||||||
const char *codec_options;
|
const char *video_codec_options;
|
||||||
const char *encoder_name;
|
const char *encoder_name;
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
const char *v4l2_device;
|
const char *v4l2_device;
|
||||||
|
|
|
@ -328,7 +328,7 @@ scrcpy(struct scrcpy_options *options) {
|
||||||
.audio = options->audio,
|
.audio = options->audio,
|
||||||
.show_touches = options->show_touches,
|
.show_touches = options->show_touches,
|
||||||
.stay_awake = options->stay_awake,
|
.stay_awake = options->stay_awake,
|
||||||
.codec_options = options->codec_options,
|
.video_codec_options = options->video_codec_options,
|
||||||
.encoder_name = options->encoder_name,
|
.encoder_name = options->encoder_name,
|
||||||
.force_adb_forward = options->force_adb_forward,
|
.force_adb_forward = options->force_adb_forward,
|
||||||
.power_off_on_close = options->power_off_on_close,
|
.power_off_on_close = options->power_off_on_close,
|
||||||
|
|
|
@ -71,7 +71,7 @@ sc_server_params_destroy(struct sc_server_params *params) {
|
||||||
// The server stores a copy of the params provided by the user
|
// The server stores a copy of the params provided by the user
|
||||||
free((char *) params->req_serial);
|
free((char *) params->req_serial);
|
||||||
free((char *) params->crop);
|
free((char *) params->crop);
|
||||||
free((char *) params->codec_options);
|
free((char *) params->video_codec_options);
|
||||||
free((char *) params->encoder_name);
|
free((char *) params->encoder_name);
|
||||||
free((char *) params->tcpip_dst);
|
free((char *) params->tcpip_dst);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ sc_server_params_copy(struct sc_server_params *dst,
|
||||||
|
|
||||||
COPY(req_serial);
|
COPY(req_serial);
|
||||||
COPY(crop);
|
COPY(crop);
|
||||||
COPY(codec_options);
|
COPY(video_codec_options);
|
||||||
COPY(encoder_name);
|
COPY(encoder_name);
|
||||||
COPY(tcpip_dst);
|
COPY(tcpip_dst);
|
||||||
#undef COPY
|
#undef COPY
|
||||||
|
@ -255,8 +255,8 @@ execute_server(struct sc_server *server,
|
||||||
if (params->stay_awake) {
|
if (params->stay_awake) {
|
||||||
ADD_PARAM("stay_awake=true");
|
ADD_PARAM("stay_awake=true");
|
||||||
}
|
}
|
||||||
if (params->codec_options) {
|
if (params->video_codec_options) {
|
||||||
ADD_PARAM("codec_options=%s", params->codec_options);
|
ADD_PARAM("video_codec_options=%s", params->video_codec_options);
|
||||||
}
|
}
|
||||||
if (params->encoder_name) {
|
if (params->encoder_name) {
|
||||||
ADD_PARAM("encoder_name=%s", params->encoder_name);
|
ADD_PARAM("encoder_name=%s", params->encoder_name);
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct sc_server_params {
|
||||||
enum sc_log_level log_level;
|
enum sc_log_level log_level;
|
||||||
enum sc_codec video_codec;
|
enum sc_codec video_codec;
|
||||||
const char *crop;
|
const char *crop;
|
||||||
const char *codec_options;
|
const char *video_codec_options;
|
||||||
const char *encoder_name;
|
const char *encoder_name;
|
||||||
struct sc_port_range port_range;
|
struct sc_port_range port_range;
|
||||||
uint32_t tunnel_host;
|
uint32_t tunnel_host;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class Options {
|
||||||
private int displayId;
|
private int displayId;
|
||||||
private boolean showTouches;
|
private boolean showTouches;
|
||||||
private boolean stayAwake;
|
private boolean stayAwake;
|
||||||
private List<CodecOption> codecOptions;
|
private List<CodecOption> videoCodecOptions;
|
||||||
private String encoderName;
|
private String encoderName;
|
||||||
private boolean powerOffScreenOnClose;
|
private boolean powerOffScreenOnClose;
|
||||||
private boolean clipboardAutosync = true;
|
private boolean clipboardAutosync = true;
|
||||||
|
@ -146,12 +146,12 @@ public class Options {
|
||||||
this.stayAwake = stayAwake;
|
this.stayAwake = stayAwake;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CodecOption> getCodecOptions() {
|
public List<CodecOption> getVideoCodecOptions() {
|
||||||
return codecOptions;
|
return videoCodecOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodecOptions(List<CodecOption> codecOptions) {
|
public void setVideoCodecOptions(List<CodecOption> videoCodecOptions) {
|
||||||
this.codecOptions = codecOptions;
|
this.videoCodecOptions = videoCodecOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEncoderName() {
|
public String getEncoderName() {
|
||||||
|
|
|
@ -61,7 +61,6 @@ public final class Server {
|
||||||
private static void scrcpy(Options options) throws IOException, ConfigurationException {
|
private static void scrcpy(Options options) throws IOException, ConfigurationException {
|
||||||
Ln.i("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")");
|
Ln.i("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")");
|
||||||
final Device device = new Device(options);
|
final Device device = new Device(options);
|
||||||
List<CodecOption> codecOptions = options.getCodecOptions();
|
|
||||||
|
|
||||||
Thread initThread = startInitThread(options);
|
Thread initThread = startInitThread(options);
|
||||||
|
|
||||||
|
@ -117,8 +116,8 @@ public final class Server {
|
||||||
|
|
||||||
Streamer videoStreamer = new Streamer(connection.getVideoFd(), options.getVideoCodec(), options.getSendCodecId(),
|
Streamer videoStreamer = new Streamer(connection.getVideoFd(), options.getVideoCodec(), options.getSendCodecId(),
|
||||||
options.getSendFrameMeta());
|
options.getSendFrameMeta());
|
||||||
ScreenEncoder screenEncoder = new ScreenEncoder(device, videoStreamer, options.getVideoBitRate(), options.getMaxFps(), codecOptions,
|
ScreenEncoder screenEncoder = new ScreenEncoder(device, videoStreamer, options.getVideoBitRate(), options.getMaxFps(),
|
||||||
options.getEncoderName(), options.getDownsizeOnError());
|
options.getVideoCodecOptions(), options.getEncoderName(), options.getDownsizeOnError());
|
||||||
try {
|
try {
|
||||||
// synchronous
|
// synchronous
|
||||||
screenEncoder.streamScreen();
|
screenEncoder.streamScreen();
|
||||||
|
@ -242,9 +241,9 @@ public final class Server {
|
||||||
boolean stayAwake = Boolean.parseBoolean(value);
|
boolean stayAwake = Boolean.parseBoolean(value);
|
||||||
options.setStayAwake(stayAwake);
|
options.setStayAwake(stayAwake);
|
||||||
break;
|
break;
|
||||||
case "codec_options":
|
case "video_codec_options":
|
||||||
List<CodecOption> codecOptions = CodecOption.parse(value);
|
List<CodecOption> videoCodecOptions = CodecOption.parse(value);
|
||||||
options.setCodecOptions(codecOptions);
|
options.setVideoCodecOptions(videoCodecOptions);
|
||||||
break;
|
break;
|
||||||
case "encoder_name":
|
case "encoder_name":
|
||||||
if (!value.isEmpty()) {
|
if (!value.isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue