raop: add support for ALAC codec

Some Airplay devices announce themselves as using the ALAC (Apple Lossless Audio
Codec) format, while pipewire only supports the PCM codec.  A look at the
Pulseaudio RAOP reveals that ALAC is supported there, but the encoding looks
exactly like what pipewire does for PCM.  This patch adds support for ALAC, but
it uses the existing PCM infrastructure to send the audio data.
This commit is contained in:
Sebastian Koenig 2022-09-10 08:00:41 -04:00 committed by Wim Taymans
parent 0c1e4475ba
commit fd66fb8867

View file

@ -421,6 +421,7 @@ static int flush_to_udp_packet(struct impl *impl)
switch (impl->codec) { switch (impl->codec) {
case CODEC_PCM: case CODEC_PCM:
case CODEC_ALAC:
len = write_codec_pcm(dst, impl->buffer, n_frames); len = write_codec_pcm(dst, impl->buffer, n_frames);
break; break;
default: default:
@ -463,6 +464,7 @@ static int flush_to_tcp_packet(struct impl *impl)
switch (impl->codec) { switch (impl->codec) {
case CODEC_PCM: case CODEC_PCM:
case CODEC_ALAC:
len = write_codec_pcm(dst, impl->buffer, n_frames); len = write_codec_pcm(dst, impl->buffer, n_frames);
break; break;
default: default:
@ -1756,6 +1758,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
str = "PCM"; str = "PCM";
if (spa_streq(str, "PCM")) if (spa_streq(str, "PCM"))
impl->codec = CODEC_PCM; impl->codec = CODEC_PCM;
else if (spa_streq(str, "ALAC"))
impl->codec = CODEC_ALAC;
else { else {
pw_log_error( "can't handle codec type %s", str); pw_log_error( "can't handle codec type %s", str);
res = -EINVAL; res = -EINVAL;