diff --git a/app/src/cli.c b/app/src/cli.c index ee0319ee..e5b18277 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -1496,6 +1496,9 @@ get_record_format(const char *name) { if (!strcmp(name, "opus")) { return SC_RECORD_FORMAT_OPUS; } + if (!strcmp(name, "aac")) { + return SC_RECORD_FORMAT_AAC; + } return 0; } @@ -1996,6 +1999,13 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[], "(try with --audio-codec=opus)"); return false; } + + if (opts->record_format == SC_RECORD_FORMAT_AAC + && opts->audio_codec != SC_CODEC_AAC) { + LOGE("Recording to AAC file requires an AAC audio stream " + "(try with --audio-codec=aac)"); + return false; + } } if (opts->audio_codec == SC_CODEC_RAW) { diff --git a/app/src/options.h b/app/src/options.h index 0547b4ec..7c442149 100644 --- a/app/src/options.h +++ b/app/src/options.h @@ -24,13 +24,15 @@ enum sc_record_format { SC_RECORD_FORMAT_M4A, SC_RECORD_FORMAT_MKA, SC_RECORD_FORMAT_OPUS, + SC_RECORD_FORMAT_AAC, }; static inline bool sc_record_format_is_audio_only(enum sc_record_format fmt) { return fmt == SC_RECORD_FORMAT_M4A || fmt == SC_RECORD_FORMAT_MKA - || fmt == SC_RECORD_FORMAT_OPUS; + || fmt == SC_RECORD_FORMAT_OPUS + || fmt == SC_RECORD_FORMAT_AAC; } enum sc_codec { diff --git a/app/src/recorder.c b/app/src/recorder.c index b0c41df0..be1cbe71 100644 --- a/app/src/recorder.c +++ b/app/src/recorder.c @@ -62,6 +62,7 @@ sc_recorder_get_format_name(enum sc_record_format format) { switch (format) { case SC_RECORD_FORMAT_MP4: case SC_RECORD_FORMAT_M4A: + case SC_RECORD_FORMAT_AAC: return "mp4"; case SC_RECORD_FORMAT_MKV: case SC_RECORD_FORMAT_MKA: