aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_utils.h
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-05-24 21:15:37 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-05-24 21:15:37 +0000
commit2814b7cfc650a73146b8e18fd0a55d54c3ec613d (patch)
treeb632095b1b73c8c310e6cdd8c92ca52807061740 /src/pcm_utils.h
parent7ba357a04e75c51f898e9418cab24d10c74ab37c (diff)
downloadmpd-2814b7cfc650a73146b8e18fd0a55d54c3ec613d.tar.gz
mpd-2814b7cfc650a73146b8e18fd0a55d54c3ec613d.tar.xz
mpd-2814b7cfc650a73146b8e18fd0a55d54c3ec613d.zip
Reverting to the full lsr API. Turns out the simple API needs all of the
audio at once, so it won't work for us. The old full API code was still heavily broken, as each call to pcm_convertSampleRate() used the same state, even if it was processing two streams of audio. The new code keeps a separate state for each audio stream that's being converted. git-svn-id: https://svn.musicpd.org/mpd/trunk@6255 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/pcm_utils.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/pcm_utils.h b/src/pcm_utils.h
index 5142db17b..800ac27f4 100644
--- a/src/pcm_utils.h
+++ b/src/pcm_utils.h
@@ -25,14 +25,32 @@
#include <stdlib.h>
+#ifdef HAVE_LIBSAMPLERATE
+#include <samplerate.h>
+#endif
+
+typedef struct _ConvState {
+#ifdef HAVE_LIBSAMPLERATE
+ SRC_STATE *state;
+ SRC_DATA data;
+ size_t dataInSize;
+ size_t dataOutSize;
+ mpd_sint8 lastChannels;
+ mpd_sint32 lastInSampleRate;
+ mpd_sint32 lastOutSampleRate;
+ int error;
+#endif
+} ConvState;
+
void pcm_volumeChange(char *buffer, int bufferSize, AudioFormat * format,
int volume);
void pcm_mix(char *buffer1, char *buffer2, size_t bufferSize1,
size_t bufferSize2, AudioFormat * format, float portion1);
-void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer, size_t
- inSize, AudioFormat * outFormat, char *outBuffer);
+void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer,
+ size_t inSize, AudioFormat * outFormat,
+ char *outBuffer, ConvState *convState);
size_t pcm_sizeOfConvBuffer(AudioFormat * inFormat, size_t inSize,
AudioFormat * outFormat);