Commit 35d31acd authored by Jon Lech Johansen's avatar Jon Lech Johansen

* Fixed a problem in the MacOS X aout which caused the previously

    played audio frames to be played when there were no new frames
    available.
  * MacOS X vout now uses the height/width calculated in video_output.c
parent c58149f5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_macosx.c : CoreAudio output plugin * aout_macosx.c : CoreAudio output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: aout_macosx.c,v 1.15 2002/03/19 03:33:52 jlj Exp $ * $Id: aout_macosx.c,v 1.16 2002/03/22 00:47:47 jlj Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -50,8 +50,9 @@ typedef struct aout_sys_s ...@@ -50,8 +50,9 @@ typedef struct aout_sys_s
AudioStreamBasicDescription s_src_stream_format; AudioStreamBasicDescription s_src_stream_format;
AudioStreamBasicDescription s_dst_stream_format; AudioStreamBasicDescription s_dst_stream_format;
Ptr p_buffer; // ptr to the 32 bit float data Ptr p_buffer; // ptr to the 32 bit float data
UInt32 ui_buffer_size; // audio device buffer size UInt32 ui_buffer_size; // audio device buffer size
boolean_t b_buffer_data; // available buffer data?
vlc_mutex_t mutex_lock; // pthread locks for sync of vlc_mutex_t mutex_lock; // pthread locks for sync of
vlc_cond_t cond_sync; // aout_Play and callback vlc_cond_t cond_sync; // aout_Play and callback
} aout_sys_t; } aout_sys_t;
...@@ -110,7 +111,7 @@ static int aout_Open( aout_thread_t *p_aout ) ...@@ -110,7 +111,7 @@ static int aout_Open( aout_thread_t *p_aout )
memset( p_aout->p_sys, 0, sizeof( aout_sys_t ) ); memset( p_aout->p_sys, 0, sizeof( aout_sys_t ) );
/* get the default output device */ /* get the default output device */
ui_param_size = sizeof( p_aout->p_sys->device ); ui_param_size = sizeof( p_aout->p_sys->device );
err = AudioHardwareGetProperty( kAudioHardwarePropertyDefaultOutputDevice, err = AudioHardwareGetProperty( kAudioHardwarePropertyDefaultOutputDevice,
&ui_param_size, &ui_param_size,
(void *)&p_aout->p_sys->device ); (void *)&p_aout->p_sys->device );
...@@ -283,9 +284,14 @@ static OSStatus CAIOCallback( AudioDeviceID inDevice, ...@@ -283,9 +284,14 @@ static OSStatus CAIOCallback( AudioDeviceID inDevice,
vlc_cond_signal( &p_sys->cond_sync ); vlc_cond_signal( &p_sys->cond_sync );
/* move data into output data buffer */ /* move data into output data buffer */
BlockMoveData( p_sys->p_buffer, if( p_sys->b_buffer_data )
outOutputData->mBuffers[ 0 ].mData, {
p_sys->ui_buffer_size ); BlockMoveData( p_sys->p_buffer,
outOutputData->mBuffers[ 0 ].mData,
p_sys->ui_buffer_size );
p_sys->b_buffer_data = 0;
}
vlc_mutex_unlock( &p_sys->mutex_lock ); vlc_mutex_unlock( &p_sys->mutex_lock );
...@@ -309,6 +315,10 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) ...@@ -309,6 +315,10 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
intf_ErrMsg( "aout error: ConvertBuffer failed: %d", err ); intf_ErrMsg( "aout error: ConvertBuffer failed: %d", err );
} }
else
{
p_aout->p_sys->b_buffer_data = 1;
}
/* /*
* wait for a callback to occur (to flush the buffer), so aout_Play * wait for a callback to occur (to flush the buffer), so aout_Play
...@@ -354,7 +364,7 @@ static int CABeginFormat( aout_thread_t *p_aout ) ...@@ -354,7 +364,7 @@ static int CABeginFormat( aout_thread_t *p_aout )
((s64)p_aout->i_rate * AOUT_BUFFER_DURATION) / 1000000; ((s64)p_aout->i_rate * AOUT_BUFFER_DURATION) / 1000000;
/* set the buffer size that the device uses for IO */ /* set the buffer size that the device uses for IO */
ui_param_size = sizeof( p_aout->p_sys->ui_buffer_size ); ui_param_size = sizeof( p_aout->p_sys->ui_buffer_size );
err = AudioDeviceSetProperty( p_aout->p_sys->device, 0, 0, false, err = AudioDeviceSetProperty( p_aout->p_sys->device, 0, 0, false,
kAudioDevicePropertyBufferSize, kAudioDevicePropertyBufferSize,
ui_param_size, ui_param_size,
......
...@@ -118,8 +118,9 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -118,8 +118,9 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->p_sys->b_mouse_pointer_visible = 1; p_vout->p_sys->b_mouse_pointer_visible = 1;
p_vout->p_sys->s_rect.size.width = p_vout->render.i_width; /* set window size */
p_vout->p_sys->s_rect.size.height = p_vout->render.i_height; p_vout->p_sys->s_rect.size.width = p_vout->i_window_width;
p_vout->p_sys->s_rect.size.height = p_vout->i_window_height;
if( ( err = EnterMovies() ) != noErr ) if( ( err = EnterMovies() ) != noErr )
{ {
......
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