summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authornplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-14 12:41:42 +0000
committernplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-14 12:41:42 +0000
commit585a341c9410c5fb1ad15285b18ef5fb36b760b4 (patch)
tree0e2edafed0e180e462a23a5c0ac4ed0b6c0d851d /libao2
parenteeec580edcc0d1f72e883dcc6ae07886006e2be9 (diff)
downloadmpv-585a341c9410c5fb1ad15285b18ef5fb36b760b4.tar.bz2
mpv-585a341c9410c5fb1ad15285b18ef5fb36b760b4.tar.xz
removes the use of AudioConverters. patch by Alexander Strange <alexander.strange@ithinksw.com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15723 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_macosx.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/libao2/ao_macosx.c b/libao2/ao_macosx.c
index 0b9b933a8e..a621ccdb46 100644
--- a/libao2/ao_macosx.c
+++ b/libao2/ao_macosx.c
@@ -74,7 +74,6 @@ typedef struct ao_macosx_s
{
/* AudioUnit */
AudioUnit theOutputUnit;
- AudioConverterRef theConverter;
int packetSize;
/* Ring-buffer */
@@ -155,18 +154,13 @@ static int read_buffer(unsigned char* data,int len){
return len;
}
-/* end ring buffer stuff */
-
-OSStatus ACComplexInputProc(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets, AudioBufferList *ioData, AudioStreamPacketDescription **outDataPacketDescription, void *inUserData)
+OSStatus theRenderProc(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData)
{
int amt=buf_used();
-int req=(*ioNumberDataPackets)*ao->packetSize;
+int req=(inNumFrames)*ao->packetSize;
ioData->mBuffers[0].mData = ao->chunk;
- ioData->mBuffers[0].mDataByteSize = req;
-
-// fprintf(stderr, "##### req=%d amt=%d #####\n", req, amt);
if(amt>req)
amt=req;
@@ -174,36 +168,11 @@ int req=(*ioNumberDataPackets)*ao->packetSize;
if(amt)
read_buffer((unsigned char *)ioData->mBuffers[0].mData, amt);
- if(req-amt)
- memset(ioData->mBuffers[0].mData+amt, 0, req-amt);
+ ioData->mBuffers[0].mDataByteSize = amt;
return noErr;
}
-OSStatus theRenderProc(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData)
-{
-OSStatus err = noErr;
-void *inInputDataProcUserData = NULL;
-AudioStreamPacketDescription *outPacketDescription = NULL;
-
-
- err = AudioConverterFillComplexBuffer(ao->theConverter, ACComplexInputProc, inInputDataProcUserData, &inNumFrames, ioData, outPacketDescription);
-
- /*Parameters for AudioConverterFillComplexBuffer()
- converter - the converter being used
- ACComplexInputProc() - input procedure to supply data to the Audio Converter
- inInputDataProcUserData - Used to hold any data that needs to be passed on.
- inNumFrames - The amount of requested data. On output, this number is the amount actually received.
- ioData - Buffer of the converted data recieved on return
- outPacketDescription - contains the format of the returned data.
- */
-
- if(err)
- ao_msg(MSGT_AO, MSGL_WARN, "AudioConverterFillComplexBuffer failed status %-8d\n", err);
-
- return err;
-}
-
static int control(int cmd,void *arg){
switch (cmd) {
case AOCONTROL_SET_DEVICE:
@@ -333,13 +302,10 @@ UInt32 size, maxFrames;
}
size = sizeof(AudioStreamBasicDescription);
- err = AudioUnitGetProperty(ao->theOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &outDesc, &size);
- print_format("destination: ", &outDesc);
- err = AudioUnitSetProperty(ao->theOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &outDesc, size);
+ err = AudioUnitSetProperty(ao->theOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &inDesc, size);
- err = AudioConverterNew(&inDesc, &outDesc, &(ao->theConverter));
if (err) {
- ao_msg(MSGT_AO, MSGL_WARN, "Unable to create the AudioConverter component (err=%d)\n", err);
+ ao_msg(MSGT_AO, MSGL_WARN, "Unable to set the input format (err=%d)\n", err);
return CONTROL_FALSE;
}
@@ -417,7 +383,6 @@ static void uninit(int immed)
reset();
- AudioConverterDispose(ao->theConverter);
AudioOutputUnitStop(ao->theOutputUnit);
AudioUnitUninitialize(ao->theOutputUnit);
CloseComponent(ao->theOutputUnit);