Refactor command line checks

Several checks are performed when opts->record_filename is not NULL.
Group them in a single block.

PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978>
This commit is contained in:
Romain Vimont 2023-05-07 12:22:01 +02:00
parent be86e14e05
commit 98f4f4e68a

View file

@ -1959,7 +1959,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
return false; return false;
} }
if (opts->record_filename && !opts->record_format) { if (opts->record_filename) {
if (!opts->record_format) {
opts->record_format = guess_record_format(opts->record_filename); opts->record_format = guess_record_format(opts->record_filename);
if (!opts->record_format) { if (!opts->record_format) {
LOGE("No format specified for \"%s\" " LOGE("No format specified for \"%s\" "
@ -1969,10 +1970,11 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
} }
} }
if (opts->record_filename && opts->audio_codec == SC_CODEC_RAW) { if (opts->audio_codec == SC_CODEC_RAW) {
LOGW("Recording does not support RAW audio codec"); LOGW("Recording does not support RAW audio codec");
return false; return false;
} }
}
if (opts->audio_codec == SC_CODEC_RAW) { if (opts->audio_codec == SC_CODEC_RAW) {
if (opts->audio_bit_rate) { if (opts->audio_bit_rate) {