Add an audio decoder

PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
This commit is contained in:
Romain Vimont 2023-02-24 21:31:39 +01:00
parent 05f0e35d2a
commit e22660d698

View file

@ -43,6 +43,7 @@ struct scrcpy {
struct sc_demuxer video_demuxer;
struct sc_demuxer audio_demuxer;
struct sc_decoder video_decoder;
struct sc_decoder audio_decoder;
struct sc_recorder recorder;
#ifdef HAVE_V4L2
struct sc_v4l2_sink v4l2_sink;
@ -437,6 +438,7 @@ scrcpy(struct scrcpy_options *options) {
}
bool needs_video_decoder = options->display;
bool needs_audio_decoder = options->audio && options->display;
#ifdef HAVE_V4L2
needs_video_decoder |= !!options->v4l2_device;
#endif
@ -444,6 +446,10 @@ scrcpy(struct scrcpy_options *options) {
sc_decoder_init(&s->video_decoder, "video");
sc_demuxer_add_sink(&s->video_demuxer, &s->video_decoder.packet_sink);
}
if (needs_audio_decoder) {
sc_decoder_init(&s->audio_decoder, "audio");
sc_demuxer_add_sink(&s->audio_demuxer, &s->audio_decoder.packet_sink);
}
if (options->record_filename) {
static const struct sc_recorder_callbacks recorder_cbs = {