[vlc-commits] aout: support indirect sample format conversion (fix #5150)

Rémi Denis-Courmont git at videolan.org
Wed Aug 3 17:06:47 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug  3 17:23:39 2011 +0300| [8cfc8c969c4052f104b06816fc85cf4f8c7a3037] | committer: Rémi Denis-Courmont

aout: support indirect sample format conversion (fix #5150)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8cfc8c969c4052f104b06816fc85cf4f8c7a3037
---

 src/audio_output/filters.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 3e8904f..64e3983 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -36,6 +36,7 @@
 
 #include <vlc_aout.h>
 #include <vlc_filter.h>
+#include <vlc_cpu.h>
 #include "aout_internal.h"
 #include <libvlc.h>
 
@@ -100,7 +101,20 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt,
         midfmt->i_original_channels = infmt->i_original_channels;
     }
     else
-        return -1;
+    {
+        assert( infmt->i_format != outfmt->i_format );
+        if( AOUT_FMT_NON_LINEAR( infmt ) )
+        {
+            if( AOUT_FMT_NON_LINEAR( outfmt ) )
+                return -1; /* no indirect non-linear -> non-linear */
+            /* NOTE: our non-linear -> linear filters always output 32-bits */
+            midfmt->i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32;
+        }
+        else
+            /* NOTE: Use S16N as intermediate. We have all conversions to S16N,
+             * and all useful conversions from S16N. TODO: FL32 if HAVE_FPU. */
+            midfmt->i_format = VLC_CODEC_S16N;
+    }
 
     aout_FormatPrepare( midfmt );
     return AOUT_FMTS_IDENTICAL( infmt, midfmt ) ? -1 : 0;



More information about the vlc-commits mailing list