[FFmpeg-devel] [PATCH]Support *law in alsa
Carl Eugen Hoyos
cehoyos at ag.or.at
Wed Apr 13 13:47:09 CEST 2011
Hi!
Surprisingly, attached patch works with -f alsa plughw - audio encoded in
mulaw or alaw is played fine (SND_PCM_FORMAT_IMA_ADPCM leads to division by
zero, and with a work-around, I can only hear - recognisable - noise, somebody
else will have to fix/explain).
If nobody objects (I did not check if there is a supported Alsa version that
does not define the formats), I will apply together with the unsigned versions
of the already supported formats.
Carl Eugen
-------------- next part --------------
diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
index 8ebe389..b4fb158 100644
--- a/libavdevice/alsa-audio-common.c
+++ b/libavdevice/alsa-audio-common.c
@@ -47,6 +47,8 @@ static av_cold snd_pcm_format_t codec_id_to_pcm_format(int codec_id)
case CODEC_ID_PCM_S16LE: return SND_PCM_FORMAT_S16_LE;
case CODEC_ID_PCM_S16BE: return SND_PCM_FORMAT_S16_BE;
case CODEC_ID_PCM_S8: return SND_PCM_FORMAT_S8;
+ case CODEC_ID_PCM_MULAW: return SND_PCM_FORMAT_MU_LAW;
+ case CODEC_ID_PCM_ALAW: return SND_PCM_FORMAT_A_LAW;
default: return SND_PCM_FORMAT_UNKNOWN;
}
}
More information about the ffmpeg-devel
mailing list