[vlc-commits] audioqueue: feed the decoder' s sample rate to the OS and enforce FL32 instead of S16N

Felix Paul Kühne git at videolan.org
Sat Jan 19 20:15:55 CET 2013


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Jan 19 20:15:29 2013 +0100| [3ce32a8030105a014f62e09a5de83f1f0d33963d] | committer: Felix Paul Kühne

audioqueue: feed the decoder's sample rate to the OS and enforce FL32 instead of S16N

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

 modules/audio_output/audioqueue.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/audio_output/audioqueue.c b/modules/audio_output/audioqueue.c
index ea7acc4..45b2863 100644
--- a/modules/audio_output/audioqueue.c
+++ b/modules/audio_output/audioqueue.c
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * audioqueue.c : AudioQueue audio output plugin for vlc
  *****************************************************************************
- * Copyright (C) 2010-2012 VLC authors and VideoLAN
+ * Copyright (C) 2010-2013 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Romain Goyet <romain.goyet at likid.org>
@@ -83,15 +83,14 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
 
     // Setup the audio device.
     AudioStreamBasicDescription deviceFormat;
-    deviceFormat.mSampleRate = 44100;
+    deviceFormat.mSampleRate = fmt->i_rate;
     deviceFormat.mFormatID = kAudioFormatLinearPCM;
-    deviceFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; // Signed integer, little endian
-    deviceFormat.mBytesPerPacket = 4;
+    deviceFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked; // FL32
     deviceFormat.mFramesPerPacket = 1;
-    deviceFormat.mBytesPerFrame = 4;
     deviceFormat.mChannelsPerFrame = 2;
-    deviceFormat.mBitsPerChannel = 16;
-    deviceFormat.mReserved = 0;
+    deviceFormat.mBitsPerChannel = 32;
+    deviceFormat.mBytesPerFrame = deviceFormat.mBitsPerChannel * deviceFormat.mChannelsPerFrame / 8;
+    deviceFormat.mBytesPerPacket = deviceFormat.mBytesPerFrame * deviceFormat.mFramesPerPacket;
 
     // Create a new output AudioQueue for the device.
     status = AudioQueueNewOutput(&deviceFormat,         // Format
@@ -106,9 +105,8 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
     if (status != noErr)
         return VLC_EGENERIC;
 
-    fmt->i_format = VLC_CODEC_S16N;
+    fmt->i_format = VLC_CODEC_FL32;
     fmt->i_physical_channels = AOUT_CHANS_STEREO;
-    fmt->i_rate = 44100;
     aout_FormatPrepare(fmt);
 
     p_aout->sys->b_stopped = false;



More information about the vlc-commits mailing list