Add record audio support

Make the recorder accept two input sources (video and audio), and mux
them into a single file.

PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
This commit is contained in:
Romain Vimont
2023-02-18 18:02:43 +01:00
parent 7a4fe1e8f6
commit 43d6d0d4bc
3 changed files with 333 additions and 81 deletions

View File

@@ -424,8 +424,8 @@ scrcpy(struct scrcpy_options *options) {
.on_ended = sc_recorder_on_ended,
};
if (!sc_recorder_init(&s->recorder, options->record_filename,
options->record_format, info->frame_size,
&recorder_cbs, NULL)) {
options->record_format, options->audio,
info->frame_size, &recorder_cbs, NULL)) {
goto end;
}
recorder_initialized = true;
@@ -436,6 +436,10 @@ scrcpy(struct scrcpy_options *options) {
recorder_started = true;
sc_demuxer_add_sink(&s->video_demuxer, &s->recorder.video_packet_sink);
if (options->audio) {
sc_demuxer_add_sink(&s->audio_demuxer,
&s->recorder.audio_packet_sink);
}
}
struct sc_controller *controller = NULL;