Rename --codec-options to --video-codec-options

This prepares the introduction of --audio-codec-options.
This commit is contained in:
Romain Vimont
2023-02-21 21:46:34 +01:00
parent ad51a2b411
commit 705d69aaea
11 changed files with 49 additions and 39 deletions

View File

@@ -37,6 +37,7 @@ enum {
OPT_RENDER_DRIVER,
OPT_NO_MIPMAPS,
OPT_CODEC_OPTIONS,
OPT_VIDEO_CODEC_OPTIONS,
OPT_FORCE_ADB_FORWARD,
OPT_DISABLE_SCREENSAVER,
OPT_SHORTCUT_MOD,
@@ -120,16 +121,10 @@ static const struct sc_option options[] = {
.argdesc = "value",
},
{
// deprecated
.longopt_id = OPT_CODEC_OPTIONS,
.longopt = "codec-options",
.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,
@@ -529,6 +524,18 @@ static const struct sc_option options[] = {
.text = "Select a video codec (h264, h265 or av1).\n"
"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',
.longopt = "stay-awake",
@@ -1606,7 +1613,11 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
opts->forward_key_repeat = false;
break;
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;
case OPT_ENCODER_NAME:
opts->encoder_name = optarg;

View File

@@ -7,7 +7,7 @@ const struct scrcpy_options scrcpy_options_default = {
.window_title = NULL,
.push_target = NULL,
.render_driver = NULL,
.codec_options = NULL,
.video_codec_options = NULL,
.encoder_name = NULL,
#ifdef HAVE_V4L2
.v4l2_device = NULL,

View File

@@ -93,7 +93,7 @@ struct scrcpy_options {
const char *window_title;
const char *push_target;
const char *render_driver;
const char *codec_options;
const char *video_codec_options;
const char *encoder_name;
#ifdef HAVE_V4L2
const char *v4l2_device;

View File

@@ -328,7 +328,7 @@ scrcpy(struct scrcpy_options *options) {
.audio = options->audio,
.show_touches = options->show_touches,
.stay_awake = options->stay_awake,
.codec_options = options->codec_options,
.video_codec_options = options->video_codec_options,
.encoder_name = options->encoder_name,
.force_adb_forward = options->force_adb_forward,
.power_off_on_close = options->power_off_on_close,

View File

@@ -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
free((char *) params->req_serial);
free((char *) params->crop);
free((char *) params->codec_options);
free((char *) params->video_codec_options);
free((char *) params->encoder_name);
free((char *) params->tcpip_dst);
}
@@ -95,7 +95,7 @@ sc_server_params_copy(struct sc_server_params *dst,
COPY(req_serial);
COPY(crop);
COPY(codec_options);
COPY(video_codec_options);
COPY(encoder_name);
COPY(tcpip_dst);
#undef COPY
@@ -255,8 +255,8 @@ execute_server(struct sc_server *server,
if (params->stay_awake) {
ADD_PARAM("stay_awake=true");
}
if (params->codec_options) {
ADD_PARAM("codec_options=%s", params->codec_options);
if (params->video_codec_options) {
ADD_PARAM("video_codec_options=%s", params->video_codec_options);
}
if (params->encoder_name) {
ADD_PARAM("encoder_name=%s", params->encoder_name);

View File

@@ -27,7 +27,7 @@ struct sc_server_params {
enum sc_log_level log_level;
enum sc_codec video_codec;
const char *crop;
const char *codec_options;
const char *video_codec_options;
const char *encoder_name;
struct sc_port_range port_range;
uint32_t tunnel_host;