more little bits of code in prep for resample/audioFormat conversion,
now to just write the actual audioFormat conversion code! git-svn-id: https://svn.musicpd.org/mpd/trunk@970 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
9dd098f09b
commit
7626d9a547
|
@ -167,7 +167,6 @@ void initAudioConfig() {
|
|||
}
|
||||
|
||||
switch(audio_configFormat->bits) {
|
||||
case 8:
|
||||
case 16:
|
||||
break;
|
||||
default:
|
||||
|
@ -184,7 +183,6 @@ void initAudioConfig() {
|
|||
}
|
||||
|
||||
switch(audio_configFormat->channels) {
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -38,10 +38,32 @@ void flushOutputBuffer(OutputBuffer * cb) {
|
|||
}
|
||||
|
||||
int sendDataToOutputBuffer(OutputBuffer * cb, DecoderControl * dc,
|
||||
char * data, long datalen, float time, mpd_uint16 bitRate)
|
||||
char * dataIn, long dataInLen, float time, mpd_uint16 bitRate)
|
||||
{
|
||||
mpd_uint16 dataToSend;
|
||||
mpd_uint16 chunkLeft;
|
||||
char * data;
|
||||
size_t datalen;
|
||||
static char * convBuffer = NULL;
|
||||
static long convBufferLen = 0;
|
||||
|
||||
if(memcmp(&(cb->audioFormat),&(dc->audioFormat),sizeof(AudioFormat))==0)
|
||||
{
|
||||
data = dataIn;
|
||||
datalen = dataInLen;
|
||||
}
|
||||
else {
|
||||
datalen = pcm_sizeOfOutputBufferForAudioFormatConversion(
|
||||
&(dc->audioFormat), dataIn, dataInLen,
|
||||
&(cb->audioFormat));
|
||||
if(datalen > convBufferLen) {
|
||||
convBuffer = realloc(convBuffer,datalen);
|
||||
convBufferLen = datalen;
|
||||
}
|
||||
data = convBuffer;
|
||||
pcm_convertAudioFormat(&(dc->audioFormat), dataIn, dataInLen,
|
||||
&(cb->audioFormat),data);
|
||||
}
|
||||
|
||||
while(datalen) {
|
||||
if(currentChunk != cb->end) {
|
||||
|
|
|
@ -136,4 +136,21 @@ void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1,
|
|||
|
||||
pcm_add(buffer1,buffer2,bufferSize1,bufferSize2,vol1,1000-vol1,format);
|
||||
}
|
||||
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
||||
|
||||
void pcm_convertAudioFormat(AudioFormat * inFormat, char * inBuffer, size_t
|
||||
inSize, AudioFormat * outFormat, char * outBuffer)
|
||||
{
|
||||
abort();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
size_t pcm_sizeOfOutputBufferForAudioFormatConversion(AudioFormat * inFormat,
|
||||
char * inBuffer, size_t inSize, AudioFormat * outFormat)
|
||||
{
|
||||
abort();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
|
||||
|
|
|
@ -33,8 +33,10 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
|
|||
void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1,
|
||||
size_t bufferSize2, AudioFormat * format, float portion1);
|
||||
|
||||
void pmc_convertAudioFormat(AudioFormat * inFormat, char * inBuffer, size_t
|
||||
inSize, size_t * inLeft, AudioFormat * outFormat,
|
||||
char * outBuffer, size_t outSize, size_t * outLeft);
|
||||
void pcm_convertAudioFormat(AudioFormat * inFormat, char * inBuffer, size_t
|
||||
inSize, AudioFormat * outFormat, char * outBuffer);
|
||||
|
||||
size_t pcm_sizeOfOutputBufferForAudioFormatConversion(AudioFormat * inFormat,
|
||||
char * inBuffer, size_t inSize, AudioFormat * outFormat);
|
||||
#endif
|
||||
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
||||
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
|
||||
|
|
Loading…
Reference in New Issue