Commit b1462b33 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* fix a few things in the auhal module. Still doesn't work.

 I might be feeding the wrong data to the auhal core, but i'm not sure what is wrong beyond that.
parent 9bb196b5
...@@ -254,7 +254,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -254,7 +254,7 @@ static int Open( vlc_object_t * p_this )
&i_param_size, &i_param_size,
layout )); layout ));
} }
msg_Dbg( p_aout, "Layout of AUHAL has %d channels" , (int)layout->mNumberChannelDescriptions ); msg_Dbg( p_aout, "Layout of AUHAL has %d channels" , (int)layout->mNumberChannelDescriptions );
p_aout->output.output.i_physical_channels = 0; p_aout->output.output.i_physical_channels = 0;
...@@ -314,9 +314,9 @@ static int Open( vlc_object_t * p_this ) ...@@ -314,9 +314,9 @@ static int Open( vlc_object_t * p_this )
/* Calculate framesizes and stuff */ /* Calculate framesizes and stuff */
aout_FormatPrepare( &p_aout->output.output ); aout_FormatPrepare( &p_aout->output.output );
DeviceFormat.mBytesPerFrame = p_aout->output.output.i_bytes_per_frame; DeviceFormat.mFramesPerPacket = 1;
DeviceFormat.mFramesPerPacket = p_aout->output.output.i_frame_length; DeviceFormat.mBytesPerFrame = DeviceFormat.mBitsPerChannel * DeviceFormat.mChannelsPerFrame / 8;
DeviceFormat.mBytesPerPacket = p_aout->output.output.i_bytes_per_frame * p_aout->output.output.i_frame_length; DeviceFormat.mBytesPerPacket = DeviceFormat.mBytesPerFrame * DeviceFormat.mFramesPerPacket;
i_param_size = sizeof(AudioStreamBasicDescription); i_param_size = sizeof(AudioStreamBasicDescription);
/* Set desired format (Use CAStreamBasicDescription )*/ /* Set desired format (Use CAStreamBasicDescription )*/
...@@ -339,7 +339,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -339,7 +339,7 @@ static int Open( vlc_object_t * p_this )
msg_Dbg( p_aout, STREAM_FORMAT_MSG( "the actual set AU format is " , DeviceFormat ) ); msg_Dbg( p_aout, STREAM_FORMAT_MSG( "the actual set AU format is " , DeviceFormat ) );
p_aout->output.i_nb_samples = 69 * p_aout->output.output.i_frame_length;
aout_VolumeSoftInit( p_aout ); aout_VolumeSoftInit( p_aout );
/* Let's pray for the following operation to be atomic... */ /* Let's pray for the following operation to be atomic... */
...@@ -356,12 +356,14 @@ static int Open( vlc_object_t * p_this ) ...@@ -356,12 +356,14 @@ static int Open( vlc_object_t * p_this )
kAudioUnitProperty_SetRenderCallback, kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, kAudioUnitScope_Input,
0, &input, sizeof( input ) ) ); 0, &input, sizeof( input ) ) );
input.inputProc = (AURenderCallback) RenderCallbackAnalog;
input.inputProcRefCon = p_aout;
/* AU initiliaze */ /* AU initiliaze */
verify_noerr( AudioUnitInitialize(p_sys->au_unit) ); verify_noerr( AudioUnitInitialize(p_sys->au_unit) );
verify_noerr( AudioOutputUnitStart(p_sys->au_unit) ); verify_noerr( AudioOutputUnitStart(p_sys->au_unit) );
return( VLC_SUCCESS ); return( VLC_SUCCESS );
} }
...@@ -577,6 +579,7 @@ static OSStatus RenderCallbackAnalog( vlc_object_t *_p_aout, ...@@ -577,6 +579,7 @@ static OSStatus RenderCallbackAnalog( vlc_object_t *_p_aout,
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
AudioTimeStamp host_time; AudioTimeStamp host_time;
mtime_t current_date; mtime_t current_date;
unsigned int i_samples;
aout_instance_t * p_aout = (aout_instance_t *)_p_aout; aout_instance_t * p_aout = (aout_instance_t *)_p_aout;
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->output.p_sys;
...@@ -596,19 +599,24 @@ msg_Dbg( p_aout, "inNumberFrames: %d", inNumberFrames); ...@@ -596,19 +599,24 @@ msg_Dbg( p_aout, "inNumberFrames: %d", inNumberFrames);
current_date = (mtime_t) p_sys->clock_diff + mdate() + current_date = (mtime_t) p_sys->clock_diff + mdate() +
(mtime_t) ( 1000000 * 1 ); (mtime_t) ( 1000000 * 1 );
p_aout->output.i_nb_samples = inNumberFrames;
msg_Dbg( p_aout, "start audio packet BADABOEM");
#define B_SPDI (p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i')) #define B_SPDI (p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i'))
p_buffer = aout_OutputNextBuffer( p_aout, current_date, VLC_FALSE ); p_buffer = aout_OutputNextBuffer( p_aout, mdate() + (mtime_t) ( 1000000 * 1 ), VLC_FALSE );
#undef B_SPDI #undef B_SPDI
msg_Dbg( p_aout, "start audio packet BADABOEM");
if( p_buffer != NULL ) if( p_buffer != NULL )
{ {
msg_Dbg( p_aout, "expected mDataByteSize:%d", ioData->mBuffers[0].mDataByteSize );
msg_Dbg( p_aout, "retrieved nb bytes:%d", p_buffer->i_nb_bytes );
if( ioData != NULL && ioData->mNumberBuffers > 0 ) if( ioData != NULL && ioData->mNumberBuffers > 0 )
{ {
if( p_buffer->i_nb_bytes*8 != ioData->mBuffers[0].mDataByteSize ) if( p_buffer->i_nb_bytes != ioData->mBuffers[0].mDataByteSize )
{ {
msg_Dbg( p_aout, "byte sizes don't match %d:%d", p_buffer->i_nb_bytes*8, ioData->mBuffers[0].mDataByteSize); msg_Dbg( p_aout, "byte sizes don't match %d:%d", p_buffer->i_nb_bytes, ioData->mBuffers[0].mDataByteSize);
} }
else else
{ {
...@@ -621,11 +629,14 @@ msg_Dbg( p_aout, "start audio packet BADABOEM"); ...@@ -621,11 +629,14 @@ msg_Dbg( p_aout, "start audio packet BADABOEM");
p_buffer->p_buffer, ioData->mBuffers[i].mDataByteSize ); p_buffer->p_buffer, ioData->mBuffers[i].mDataByteSize );
} }
msg_Dbg( p_aout, "yeah first:" ); msg_Dbg( p_aout, "yeah first:" );
aout_BufferFree( p_buffer );
msg_Dbg( p_aout, "yeah" );
} }
} }
else msg_Dbg( p_aout, "no iodata or buffers"); else
{
msg_Dbg( p_aout, "no iodata or buffers");
}
aout_BufferFree( p_buffer );
msg_Dbg( p_aout, "yeah the buffer free thing :D" );
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment