X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_output%2Fhd1000a.cpp;h=38d71773f685893bad5035943ed5b8bf4e3ba7b9;hb=0d4b0871ad1d55655de7b89d15980152fe568178;hp=f096fc795b7370f2ae5d5c5d2009532546c3d5fa;hpb=5e9bbe3af577f963a5b3e8d6c65da460536cb3a2;p=vlc diff --git a/modules/audio_output/hd1000a.cpp b/modules/audio_output/hd1000a.cpp index f096fc795b..38d71773f6 100644 --- a/modules/audio_output/hd1000a.cpp +++ b/modules/audio_output/hd1000a.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * hd1000a.cpp : Roku HD1000 audio output ***************************************************************************** - * Copyright (C) 2004 VideoLAN + * Copyright (C) 2004 the VideoLAN team * $Id$ * * Author: Jon Lech Johansen @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -26,12 +26,14 @@ *****************************************************************************/ extern "C" { -#include -#include #include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include -#include +#include #include "aout_internal.h" } @@ -66,12 +68,17 @@ static void Close ( vlc_object_t * ); static void Play ( aout_instance_t * ); static int Thread ( aout_instance_t * ); +static void InterleaveS16( int16_t *, int16_t * ); + /***************************************************************************** * Module descriptor *****************************************************************************/ vlc_module_begin(); - set_description( N_("HD1000 audio output") ); + set_shortname( "Roku HD1000" ); + set_description( _("Roku HD1000 audio output") ); set_capability( "audio output", 100 ); + set_category( CAT_AUDIO ); + set_subcategory( SUBCAT_AUDIO_AOUT ); set_callbacks( Open, Close ); vlc_module_end(); @@ -112,7 +119,7 @@ static int Open( vlc_object_t * p_this ) delete pPlayer; free( p_sys ); return VLC_EGENERIC; - } + } p_sys->nBuffers = __MIN( p_sys->nBuffers, 4 ); @@ -160,14 +167,14 @@ static int Open( vlc_object_t * p_this ) p_aout->output.pf_play = Play; aout_VolumeSoftInit( p_aout ); - i_volume = config_GetInt( p_aout->p_vlc, "volume" ); + i_volume = config_GetInt( p_aout->p_libvlc, "volume" ); pPlayer->SetVolume( (u32)__MIN( i_volume * 64, 0xFFFF ) ); /* Create thread and wait for its readiness. */ if( vlc_thread_create( p_aout, "aout", Thread, VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) ) { - msg_Err( p_aout, "cannot create OSS thread (%s)", strerror(errno) ); + msg_Err( p_aout, "cannot create OSS thread (%m)" ); pPlayer->Close(); delete pPlayer; free( p_sys->ppBuffers ); @@ -187,7 +194,7 @@ static void Close( vlc_object_t * p_this ) aout_instance_t * p_aout = (aout_instance_t *)p_this; struct aout_sys_t * p_sys = p_aout->output.p_sys; - p_aout->b_die = VLC_TRUE; + vlc_object_kill( p_aout ); vlc_thread_join( p_aout ); p_aout->b_die = VLC_FALSE; @@ -230,14 +237,13 @@ static int Thread( aout_instance_t * p_aout ) #define i p_sys->nNextBufferIndex if( p_buffer == NULL ) { - p_aout->p_vlc->pf_memset( p_sys->ppBuffers[ i ], 0, - p_sys->nBufferSize ); + p_aout->p_libvlc->pf_memset( p_sys->ppBuffers[ i ], 0, + p_sys->nBufferSize ); } else { - p_aout->p_vlc->pf_memcpy( p_sys->ppBuffers[ i ], - p_buffer->p_buffer, - p_sys->nBufferSize ); + InterleaveS16( (int16_t *)p_buffer->p_buffer, + (int16_t *)p_sys->ppBuffers[ i ] ); aout_BufferFree( p_buffer ); } @@ -245,7 +251,7 @@ static int Thread( aout_instance_t * p_aout ) p_sys->nBufferSize / 2 ) ) { msg_Err( p_aout, "QueueBuffer failed" ); - } + } i = (i + 1) % p_sys->nBuffers; #undef i @@ -253,3 +259,15 @@ static int Thread( aout_instance_t * p_aout ) return VLC_SUCCESS; } + +/***************************************************************************** + * InterleaveS16: interleave samples + *****************************************************************************/ +static void InterleaveS16( int16_t * p_in, int16_t * p_out ) +{ + for( int i = 0; i < FRAME_SIZE; i++ ) + { + p_out[ i * 2 + 0 ] = p_in[ i * 2 + 1 ]; + p_out[ i * 2 + 1 ] = p_in[ i * 2 + 0 ]; + } +}