From f3dd07bb1f768e67574d77b62a94bce050065b9b Mon Sep 17 00:00:00 2001 From: Jon Lech Johansen Date: Sun, 30 Mar 2003 23:35:06 +0000 Subject: [PATCH] * ALL: Move CoreAudio aout into seperate module. --- configure.ac.in | 28 +++++++++---- modules/audio_output/Modules.am | 1 + .../aout.m => audio_output/coreaudio.c} | 41 +++++++++++++------ modules/gui/macosx/Modules.am | 1 - modules/gui/macosx/macosx.m | 11 +---- 5 files changed, 50 insertions(+), 32 deletions(-) rename modules/{gui/macosx/aout.m => audio_output/coreaudio.c} (97%) diff --git a/configure.ac.in b/configure.ac.in index 53863e1f52..e19d9ddb00 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -1992,7 +1992,7 @@ dnl dnl freetype module dnl AC_ARG_ENABLE(freetype, - [ --enable-freetype freetype support (default enabled)]) + [ --enable-freetype freetype support (default enabled)]) if test "x${enable_freetype}" != "xno" then FREETYPE_PATH="${PATH}" @@ -2262,6 +2262,22 @@ if test "x${enable_waveout}" != "xno"; then fi fi +dnl +dnl CoreAudio plugin +dnl +AC_ARG_ENABLE(coreaudio, + [ --enable-coreaudio CoreAudio module (default enabled on MacOS X)]) +if test "x${enable_coreaudio}" != "xno" && + (test "x${SYS}" = "xdarwin" || test "x${enable_coreaudio}" = "xyes") +then + AC_CHECK_HEADERS(CoreAudio/CoreAudio.h, + [ BUILTINS="${BUILTINS} coreaudio" + PLUGINS="${PLUGINS} coreaudio_resampler" + LDFLAGS_coreaudio="${LDFLAGS_coreaudio} -framework CoreAudio" + LDFLAGS_coreaudio_resampler="${LDFLAGS_coreaudio_resampler} -framework AudioToolbox" ], + [ AC_MSG_ERROR([cannot find CoreAudio headers]) ]) +fi + dnl dnl Interface plugins dnl @@ -2278,7 +2294,7 @@ dnl dnl Skins module dnl AC_ARG_ENABLE(skins, - [ --enable-skins Win32 skins module (default enabled on Win32)]) + [ --enable-skins Win32 skins module (default enabled on Win32)]) if test "x${enable_skins}" != "xno"; then if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then PLUGINS="${PLUGINS} skins" @@ -2630,15 +2646,11 @@ AC_ARG_ENABLE(macosx, [if test "x${enable_macosx}" = "xyes" then BUILTINS="${BUILTINS} macosx" - PLUGINS="${PLUGINS} coreaudio_resampler" - LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC" - LDFLAGS_coreaudio_resampler="${LDFLAGS_coreaudio_resampler} -framework AudioToolbox" + LDFLAGS_macosx="${LDFLAGS_macosx} -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC" fi], [AC_CHECK_HEADERS(Cocoa/Cocoa.h, BUILTINS="${BUILTINS} macosx" - PLUGINS="${PLUGINS} coreaudio_resampler" - LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC" - LDFLAGS_coreaudio_resampler="${LDFLAGS_coreaudio_resampler} -framework AudioToolbox" + LDFLAGS_macosx="${LDFLAGS_macosx} -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC" )]) dnl diff --git a/modules/audio_output/Modules.am b/modules/audio_output/Modules.am index 2faf24f352..7239c0c4ac 100644 --- a/modules/audio_output/Modules.am +++ b/modules/audio_output/Modules.am @@ -1,5 +1,6 @@ SOURCES_alsa = modules/audio_output/alsa.c SOURCES_arts = modules/audio_output/arts.c +SOURCES_coreaudio = modules/audio_output/coreaudio.c SOURCES_aout_directx = modules/audio_output/directx.c SOURCES_esd = modules/audio_output/esd.c SOURCES_aout_file = modules/audio_output/file.c diff --git a/modules/gui/macosx/aout.m b/modules/audio_output/coreaudio.c similarity index 97% rename from modules/gui/macosx/aout.m rename to modules/audio_output/coreaudio.c index d65b269856..53c85c152d 100644 --- a/modules/gui/macosx/aout.m +++ b/modules/audio_output/coreaudio.c @@ -1,8 +1,8 @@ /***************************************************************************** - * aout.m: CoreAudio output plugin + * coreaudio.c: CoreAudio output plugin ***************************************************************************** * Copyright (C) 2002-2003 VideoLAN - * $Id: aout.m,v 1.29 2003/03/16 20:06:34 jlj Exp $ + * $Id: coreaudio.c,v 1.1 2003/03/30 23:35:06 jlj Exp $ * * Authors: Colin Delacroix * Jon Lech Johansen @@ -35,9 +35,7 @@ #include "aout_internal.h" -#include -#include -#include +#include #define A52_FRAME_NB 1536 @@ -187,6 +185,9 @@ static void FreeStreamInfo ( UInt32 i_dev, aout_instance_t * p_aout, static void InitDeviceVar ( aout_instance_t * p_aout, int i_option, vlc_bool_t b_change ); +static int Open ( vlc_object_t * ); +static void Close ( vlc_object_t * ); + static void Play ( aout_instance_t * p_aout ); static OSStatus IOCallback ( AudioDeviceID inDevice, @@ -211,10 +212,23 @@ static OSStatus StreamListener ( AudioStreamID inStream, AudioDevicePropertyID inPropertyID, void * inClientData ); +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +#define ADEV_TEXT N_("audio device") + +vlc_module_begin(); + set_description( _("CoreAudio output") ); + set_capability( "audio output", 100 ); + set_callbacks( Open, Close ); + add_category_hint( N_("Audio"), NULL, VLC_FALSE ); + add_integer( "coreaudio-dev", -1, NULL, ADEV_TEXT, ADEV_TEXT, VLC_FALSE ); +vlc_module_end(); + /***************************************************************************** * Open: open a CoreAudio HAL device *****************************************************************************/ -int E_(OpenAudio)( vlc_object_t * p_this ) +static int Open( vlc_object_t * p_this ) { OSStatus err; UInt32 i_param_size; @@ -246,7 +260,7 @@ int E_(OpenAudio)( vlc_object_t * p_this ) if( var_Type( p_aout, "audio-device" ) == 0 ) { - InitDeviceVar( p_aout, config_GetInt( p_aout, "macosx-adev" ), + InitDeviceVar( p_aout, config_GetInt( p_aout, "coreaudio-dev" ), VLC_FALSE ); } @@ -501,9 +515,10 @@ int E_(OpenAudio)( vlc_object_t * p_this ) /***************************************************************************** * Close: close the CoreAudio HAL device *****************************************************************************/ -void E_(CloseAudio)( aout_instance_t * p_aout ) +static void Close( vlc_object_t * p_this ) { OSStatus err; + aout_instance_t * p_aout = (aout_instance_t *)p_this; struct aout_sys_t * p_sys = p_aout->output.p_sys; if( p_sys->b_dev_alive ) @@ -581,9 +596,9 @@ static OSStatus IOCallback( AudioDeviceID inDevice, if( p_buffer != NULL ) { /* move data into output data buffer */ - BlockMoveData( p_buffer->p_buffer, - outOutputData->mBuffers[ 0 ].mData, - p_sys->i_buffer_size ); + p_aout->p_vlc->pf_memcpy( outOutputData->mBuffers[ 0 ].mData, + p_buffer->p_buffer, + p_sys->i_buffer_size ); aout_BufferFree( p_buffer ); } @@ -1250,7 +1265,7 @@ static int InitDevice( aout_instance_t * p_aout ) return( VLC_EGENERIC ); } - config_PutInt( p_aout, "macosx-adev", i_option ); + config_PutInt( p_aout, "coreaudio-dev", i_option ); p_sys->i_sel_opt = i_option; p_sys->devid = p_dev->devid; @@ -1463,7 +1478,7 @@ static void InitDeviceVar( aout_instance_t * p_aout, int i_option, { p_sys->i_sel_opt = i; var_Set( p_aout, "audio-device", val ); - config_PutInt( p_aout, "macosx-adev", i_option ); + config_PutInt( p_aout, "coreaudio-dev", i_option ); } } diff --git a/modules/gui/macosx/Modules.am b/modules/gui/macosx/Modules.am index 0e182394e3..951f9d1fa2 100644 --- a/modules/gui/macosx/Modules.am +++ b/modules/gui/macosx/Modules.am @@ -1,7 +1,6 @@ SOURCES_macosx = \ modules/gui/macosx/applescript.h \ modules/gui/macosx/applescript.m \ - modules/gui/macosx/aout.m \ modules/gui/macosx/controls.h \ modules/gui/macosx/controls.m \ modules/gui/macosx/intf.m \ diff --git a/modules/gui/macosx/macosx.m b/modules/gui/macosx/macosx.m index 77645d42d5..04bc46ed53 100644 --- a/modules/gui/macosx/macosx.m +++ b/modules/gui/macosx/macosx.m @@ -2,7 +2,7 @@ * macosx.m: MacOS X plugin for vlc ***************************************************************************** * Copyright (C) 2001-2003 VideoLAN - * $Id: macosx.m,v 1.5 2003/03/30 18:14:38 gbazin Exp $ + * $Id: macosx.m,v 1.6 2003/03/30 23:35:06 jlj Exp $ * * Authors: Colin Delacroix * Eugenio Jarosiewicz @@ -38,16 +38,12 @@ int E_(OpenIntf) ( vlc_object_t * ); void E_(CloseIntf) ( vlc_object_t * ); -int E_(OpenAudio) ( vlc_object_t * ); -void E_(CloseAudio) ( vlc_object_t * ); - int E_(OpenVideo) ( vlc_object_t * ); void E_(CloseVideo) ( vlc_object_t * ); /***************************************************************************** * Module descriptor *****************************************************************************/ -#define ADEV_TEXT N_("audio device") #define VDEV_TEXT N_("video device") vlc_module_begin(); @@ -60,10 +56,5 @@ vlc_module_begin(); set_callbacks( E_(OpenVideo), E_(CloseVideo) ); add_category_hint( N_("Video"), NULL, VLC_FALSE ); add_integer( "macosx-vdev", 0, NULL, VDEV_TEXT, VDEV_TEXT, VLC_FALSE ); - add_submodule(); - set_capability( "audio output", 100 ); - set_callbacks( E_(OpenAudio), E_(CloseAudio) ); - add_category_hint( N_("Audio"), NULL, VLC_FALSE ); - add_integer( "macosx-adev", -1, NULL, ADEV_TEXT, ADEV_TEXT, VLC_FALSE ); vlc_module_end(); -- 2.39.2