From: Carl Eugen Hoyos <[email protected]>

Signed-off-by: Anton Khirnov <[email protected]>
---
 libavdevice/alsa-audio-common.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
index c4262dc..b533741 100644
--- a/libavdevice/alsa-audio-common.c
+++ b/libavdevice/alsa-audio-common.c
@@ -36,6 +36,8 @@
 static av_cold snd_pcm_format_t codec_id_to_pcm_format(int codec_id)
 {
     switch(codec_id) {
+        case CODEC_ID_PCM_S32LE: return SND_PCM_FORMAT_S32_LE;
+        case CODEC_ID_PCM_S32BE: return SND_PCM_FORMAT_S32_BE;
         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;
@@ -83,6 +85,8 @@ static void alsa_reorder_ ## NAME ## _out_71(const void 
*in_v, void *out_v, int
 
 REORDER_OUT_51(s16, int16_t)
 REORDER_OUT_71(s16, int16_t)
+REORDER_OUT_51(s32, int32_t)
+REORDER_OUT_71(s32, int32_t)
 
 #define REORDER_DUMMY ((void *)1)
 
@@ -90,7 +94,13 @@ static av_cold ff_reorder_func find_reorder_func(int 
codec_id,
                                                  int64_t layout,
                                                  int out)
 {
-    if (codec_id != CODEC_ID_PCM_S16LE && codec_id != CODEC_ID_PCM_S16BE)
+    int is_32bit;
+
+    if (codec_id == CODEC_ID_PCM_S16LE && codec_id == CODEC_ID_PCM_S16BE)
+        is_32bit = 0;
+    else if (codec_id != CODEC_ID_PCM_S32LE && codec_id != CODEC_ID_PCM_S32BE)
+        is_32bit = 1;
+    else
         return NULL;
 
     /* reordering input is not currently supported */
@@ -102,10 +112,10 @@ static av_cold ff_reorder_func find_reorder_func(int 
codec_id,
         return REORDER_DUMMY;
 
     if (layout == AV_CH_LAYOUT_5POINT1_BACK || layout == AV_CH_LAYOUT_5POINT1)
-        return alsa_reorder_s16_out_51;
+        return is_32bit ? alsa_reorder_s16_out_51 : alsa_reorder_s32_out_51;
 
     if (layout == AV_CH_LAYOUT_7POINT1)
-        return alsa_reorder_s16_out_71;
+        return is_32bit ? alsa_reorder_s16_out_71 : alsa_reorder_s32_out_71;
 
     return NULL;
 }
-- 
1.7.5.3

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to