diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | cfg-mplayer.h | 3 | ||||
-rwxr-xr-x | configure | 182 | ||||
-rw-r--r-- | input/input.c | 16 | ||||
-rw-r--r-- | libao2/ao_arts.c | 148 | ||||
-rw-r--r-- | libao2/ao_esd.c | 477 | ||||
-rw-r--r-- | libao2/ao_portaudio.c | 431 | ||||
-rw-r--r-- | libao2/ao_pulse.c | 2 | ||||
-rw-r--r-- | libao2/ao_sgi.c | 301 | ||||
-rw-r--r-- | libao2/audio_out.c | 11 | ||||
-rw-r--r-- | libmpcodecs/ad_mpg123.c | 248 | ||||
-rw-r--r-- | m_config.c | 116 | ||||
-rw-r--r-- | m_config.h | 5 | ||||
-rw-r--r-- | m_option.c | 457 | ||||
-rw-r--r-- | m_option.h | 71 | ||||
-rw-r--r-- | m_struct.c | 7 | ||||
-rw-r--r-- | mplayer.c | 38 | ||||
-rw-r--r-- | parser-mpcmd.c | 8 | ||||
-rw-r--r-- | parser-mpcmd.h | 3 | ||||
-rw-r--r-- | sub/font_load_ft.c | 2 |
20 files changed, 760 insertions, 1770 deletions
@@ -438,7 +438,6 @@ SRCS_MPLAYER-$(AA) += libvo/vo_aa.c SRCS_MPLAYER-$(ALSA) += libao2/ao_alsa.c SRCS_MPLAYER-$(APPLE_IR) += input/appleir.c SRCS_MPLAYER-$(APPLE_REMOTE) += input/ar.c -SRCS_MPLAYER-$(ARTS) += libao2/ao_arts.c SRCS_MPLAYER-$(BL) += libvo/vo_bl.c SRCS_MPLAYER-$(CACA) += libvo/vo_caca.c SRCS_MPLAYER-$(COREAUDIO) += libao2/ao_coreaudio.c @@ -449,7 +448,6 @@ SRCS_MPLAYER-$(DIRECT3D) += libvo/vo_direct3d.c libvo/w32_common.c SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c SRCS_MPLAYER-$(DIRECTX) += libao2/ao_dsound.c libvo/vo_directx.c SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c -SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c @@ -471,10 +469,10 @@ SRCS_MPLAYER-$(OPENAL) += libao2/ao_openal.c SRCS_MPLAYER-$(OSS) += libao2/ao_oss.c SRCS_MPLAYER-$(PNM) += libvo/vo_pnm.c SRCS_MPLAYER-$(PULSE) += libao2/ao_pulse.c +SRCS_MPLAYER-$(PORTAUDIO) += libao2/ao_portaudio.c SRCS_MPLAYER-$(RSOUND) += libao2/ao_rsound.c SRCS_MPLAYER-$(S3FB) += libvo/vo_s3fb.c SRCS_MPLAYER-$(SDL) += libao2/ao_sdl.c libvo/vo_sdl.c libvo/sdl_common.c -SRCS_MPLAYER-$(SGIAUDIO) += libao2/ao_sgi.c SRCS_MPLAYER-$(SUNAUDIO) += libao2/ao_sun.c SRCS_MPLAYER-$(SVGA) += libvo/vo_svga.c SRCS_MPLAYER-$(TDFXFB) += libvo/vo_tdfxfb.c diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 1d18949ce0..b94b1cf7cc 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -373,7 +373,8 @@ const m_option_t common_opts[] = { // ------------------------- common options -------------------- OPT_MAKE_FLAGS("quiet", quiet, CONF_GLOBAL), {"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL}, - {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL}, + // -v is handled in command line preparser + {"v", NULL, CONF_TYPE_FLAG, CONF_NOCFG, 0, 0, NULL}, {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, {"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, {"nomsgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL}, @@ -209,7 +209,6 @@ dragonfly() { issystem "DragonFly"; } freebsd() { issystem "FreeBSD" || issystem "GNU/kFreeBSD"; } gnu() { issystem "GNU"; } hpux() { issystem "HP-UX"; } -irix() { issystem "IRIX"; } linux() { issystem "Linux"; } mingw32() { issystem "MINGW32"; } morphos() { issystem "MorphOS"; } @@ -440,14 +439,12 @@ Video output: Audio output: --disable-alsa disable ALSA audio output [autodetect] --disable-ossaudio disable OSS audio output [autodetect] - --disable-arts disable aRts audio output [autodetect] - --disable-esd disable esd audio output [autodetect] --disable-rsound disable RSound audio output [autodetect] --disable-pulse disable Pulseaudio audio output [autodetect] + --disable-portaudio disable PortAudio audio output [autodetect] --disable-jack disable JACK audio output [autodetect] --enable-openal enable OpenAL audio output [disable] --disable-nas disable NAS audio output [autodetect] - --disable-sgiaudio disable SGI audio output [autodetect] --disable-sunaudio disable Sun audio output [autodetect] --disable-win32waveout disable Windows waveout audio output [autodetect] --disable-coreaudio disable CoreAudio audio output [autodetect] @@ -599,10 +596,9 @@ _iconv=auto _langinfo=auto _rtc=auto _ossaudio=auto -_arts=auto -_esd=auto _rsound=auto _pulse=auto +_portaudio=auto _jack=auto _openal=no _libcdio=auto @@ -637,7 +633,6 @@ _mga=auto _xmga=auto _vm=auto _xf86keysym=auto -_sgiaudio=auto _sunaudio=auto _alsa=auto _fastmemcpy=yes @@ -918,14 +913,12 @@ for ac_option do --disable-libdv) _libdv=no ;; --enable-ossaudio) _ossaudio=yes ;; --disable-ossaudio) _ossaudio=no ;; - --enable-arts) _arts=yes ;; - --disable-arts) _arts=no ;; - --enable-esd) _esd=yes ;; - --disable-esd) _esd=no ;; --enable-rsound) _rsound=yes ;; --disable-rsound) _rsound=no ;; --enable-pulse) _pulse=yes ;; --disable-pulse) _pulse=no ;; + --enable-portaudio) _portaudio=yes ;; + --disable-portaudio) _portaudio=no ;; --enable-jack) _jack=yes ;; --disable-jack) _jack=no ;; --enable-openal) _openal=yes ;; @@ -992,8 +985,6 @@ for ac_option do --disable-xf86keysym) _xf86keysym=no ;; --enable-sunaudio) _sunaudio=yes ;; --disable-sunaudio) _sunaudio=no ;; - --enable-sgiaudio) _sgiaudio=yes ;; - --disable-sgiaudio) _sgiaudio=no ;; --enable-alsa) _alsa=yes ;; --disable-alsa) _alsa=no ;; --enable-tv) _tv=yes ;; @@ -1254,9 +1245,6 @@ if test -z "$_target" ; then Haiku) system_name=BeOS ;; - IRIX*) - system_name=IRIX - ;; GNU/kFreeBSD) system_name=FreeBSD ;; @@ -1355,9 +1343,6 @@ fi if darwin; then extra_cflags="-mdynamic-no-pic $extra_cflags" - if test "$(basename $_cc)" != "clang" ; then - extra_cflags="-falign-loops=16 -shared-libgcc $extra_cflags" - fi _timer=timer-darwin.c fi @@ -1365,9 +1350,7 @@ if aix ; then extra_ldflags="$extra_ldflags -lC" fi -if irix ; then - _ranlib='ar -r' -elif linux ; then +if linux ; then _ranlib='true' fi @@ -2169,24 +2152,6 @@ EOF arch='mips' iproc='mips' - if irix ; then - echocheck "CPU type" - proc=$(hinv -c processor | grep CPU | cut -d " " -f3) - case "$(echo $proc)" in - R3000) _march='-mips1' _mcpu='-mtune=r2000' ;; - R4000) _march='-mips3' _mcpu='-mtune=r4000' ;; - R4400) _march='-mips3' _mcpu='-mtune=r4400' ;; - R4600) _march='-mips3' _mcpu='-mtune=r4600' ;; - R5000) _march='-mips4' _mcpu='-mtune=r5000' ;; - R8000|R10000|R12000|R14000|R16000) _march='-mips4' _mcpu='-mtune=r8000' ;; - esac - # gcc < 3.x does not support -mtune. - if test "$cc_vendor" = "gnu" && test "$_cc_major" -lt 3 ; then - _mcpu='' - fi - echores "$proc" - fi - test $_fast_clz = "auto" && _fast_clz=yes ;; @@ -2339,6 +2304,10 @@ else warn_cflags=yes fi +if darwin && test "$cc_vendor" = "gnu" ; then + extra_cflags="-falign-loops=16 -shared-libgcc $extra_cflags" +fi + if test "$cc_vendor" = "gnu" ; then cflag_check -Wundef && WARNFLAGS="-Wundef $WARNFLAGS" # -std=gnu99 is not a warning flag but is placed in WARN_CFLAGS because @@ -4004,12 +3973,11 @@ echocheck "VDPAU" if test "$_vdpau" = auto && test "$_x11" = yes ; then _vdpau=no if test "$_dl" = yes ; then - return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -lvdpau && _vdpau=yes + pkg_config_add 'vdpau >= 0.2' && _vdpau=yes fi fi if test "$_vdpau" = yes ; then def_vdpau='#define CONFIG_VDPAU 1' - libs_mplayer="$libs_mplayer -lvdpau" vomodules="vdpau $vomodules" else def_vdpau='#define CONFIG_VDPAU 0' @@ -4274,11 +4242,6 @@ fi echocheck "PNG support" if test "$_png" = auto ; then _png=no - if irix ; then - # Don't check for -lpng on irix since it has its own libpng - # incompatible with the GNU libpng - res_comment="disabled on irix (not GNU libpng)" - else cat > $TMPC << EOF #include <stdio.h> #include <string.h> @@ -4289,8 +4252,7 @@ int main(void) { return strcmp(PNG_LIBPNG_VER_STRING, png_libpng_ver); } EOF - cc_check -lpng -lz $_ld_lm && _png=yes - fi + cc_check -lpng -lz $_ld_lm && _png=yes fi echores "$_png" if test "$_png" = yes ; then @@ -4561,15 +4523,17 @@ int main(int argc, char *argv[]) { } EOF _gl=no - for _ld_tmp in "" -lGL "-lGL -lXdamage" "-lGL $_ld_pthread" ; do - if cc_check $_ld_tmp $_ld_lm ; then - _gl=yes - _gl_x11=yes - libs_mplayer="$libs_mplayer $_ld_tmp $_ld_dl" - break - fi - done - if cc_check -DGL_WIN32 -lopengl32 ; then + if test "$_x11" = yes ; then + for _ld_tmp in "" -lGL "-lGL -lXdamage" "-lGL $_ld_pthread" ; do + if cc_check $_ld_tmp $_ld_lm ; then + _gl=yes + _gl_x11=yes + libs_mplayer="$libs_mplayer $_ld_tmp $_ld_dl" + break + fi + done + fi + if win32 && cc_check -DGL_WIN32 -lopengl32 ; then _gl=yes _gl_win32=yes libs_mplayer="$libs_mplayer -lopengl32 -lgdi32" @@ -4806,51 +4770,6 @@ fi echores "$_ossaudio" -echocheck "aRts" -if test "$_arts" = auto ; then - _arts=no - if ( artsc-config --version ) >> "$TMPLOG" 2>&1 ; then - statement_check artsc.h 'arts_init()' $(artsc-config --libs) $(artsc-config --cflags) && - _arts=yes - fi -fi - -if test "$_arts" = yes ; then - def_arts='#define CONFIG_ARTS 1' - aomodules="arts $aomodules" - libs_mplayer="$libs_mplayer $(artsc-config --libs)" - extra_cflags="$extra_cflags $(artsc-config --cflags)" -else - noaomodules="arts $noaomodules" -fi -echores "$_arts" - - -echocheck "EsounD" -if test "$_esd" = auto ; then - _esd=no - if ( esd-config --version ) >> "$TMPLOG" 2>&1 ; then - statement_check esd.h 'esd_open_sound("test")' $(esd-config --libs) $(esd-config --cflags) && _esd=yes - fi -fi -echores "$_esd" - -if test "$_esd" = yes ; then - def_esd='#define CONFIG_ESD 1' - aomodules="esd $aomodules" - libs_mplayer="$libs_mplayer $(esd-config --libs)" - extra_cflags="$extra_cflags $(esd-config --cflags)" - - echocheck "esd_get_latency()" - statement_check esd.h 'esd_get_latency(0)' $(esd-config --libs) $(esd-config --cflags) && - _esd_latency=yes && def_esd_latency='#define CONFIG_ESD_LATENCY 1' - echores "$_esd_latency" -else - def_esd='#undef CONFIG_ESD' - def_esd_latency='#undef CONFIG_ESD_LATENCY' - noaomodules="esd $noaomodules" -fi - echocheck "RSound" if test "$_rsound" = auto ; then _rsound=no @@ -4902,6 +4821,28 @@ else fi +echocheck "PortAudio" +if test "$_portaudio" = auto && test "$_pthreads" != yes ; then + _portaudio=no + res_comment="pthreads not enabled" +fi +if test "$_portaudio" = auto ; then + _portaudio=no + if pkg_config_add 'portaudio-2.0 >= 19' ; then + _portaudio=yes + fi +fi +echores "$_portaudio" + +if test "$_portaudio" = yes ; then + def_portaudio='#define CONFIG_PORTAUDIO 1' + aomodules="portaudio $aomodules" +else + def_portaudio='#undef CONFIG_PORTAUDIO' + noaomodules="portaudio $noaomodules" +fi + + echocheck "JACK" if test "$_jack" = auto ; then _jack=no @@ -5012,24 +4953,6 @@ echores $_coreaudio fi #if darwin -if irix; then -echocheck "SGI audio" -if test "$_sgiaudio" = auto ; then - _sgiaudio=no - header_check dmedia/audio.h && _sgiaudio=yes -fi -if test "$_sgiaudio" = "yes" ; then - def_sgiaudio='#define CONFIG_SGI_AUDIO 1' - libs_mplayer="$libs_mplayer -laudio" - aomodules="sgi $aomodules" -else - def_sgiaudio='#undef CONFIG_SGI_AUDIO' - noaomodules="sgi $noaomodules" -fi -echores "$_sgiaudio" -fi #if irix - - # set default CD/DVD devices if win32 ; then default_cdrom_device="D:" @@ -5085,11 +5008,10 @@ echores "$_vcd" echocheck "Blu-ray support" if test "$_bluray" = auto ; then _bluray=no - statement_check libbluray/bluray.h 'bd_get_title_info(0, 0, 0)' -lbluray && _bluray=yes + pkg_config_add 'libbluray >= 0.2.1' && _bluray=yes fi if test "$_bluray" = yes ; then def_bluray='#define CONFIG_LIBBLURAY 1' - extra_ldflags="$extra_ldflags -lbluray" inputmodules="bluray $inputmodules" else def_bluray='#undef CONFIG_LIBBLURAY' @@ -5411,12 +5333,13 @@ else fi echores "$_theora" -# Any version of libmpg123 shall be fine. +# Any version of libmpg123 that knows MPG123_RESYNC_LIMIT shall be fine. +# That is, 1.2.0 onwards. Recommened is 1.14 onwards, though. echocheck "mpg123 support" def_mpg123='#undef CONFIG_MPG123' if test "$_mpg123" = auto; then _mpg123=no - statement_check mpg123.h 'mpg123_init()' -lmpg123 && _mpg123=yes && extra_ldflags="$extra_ldflags -lmpg123" + pkg_config_add 'libmpg123 >= 1.2.0' && _mpg123=yes fi if test "$_mpg123" = yes ; then def_mpg123='#define CONFIG_MPG123 1' @@ -6379,7 +6302,6 @@ AA = $_aa ALSA = $_alsa APPLE_IR = $_apple_ir APPLE_REMOTE = $_apple_remote -ARTS = $_arts AUDIO_INPUT = $_audio_input BITMAP_FONT = $_bitmap_font BL = $_bl @@ -6400,7 +6322,6 @@ DVDNAV_INTERNAL = $dvdnav_internal DVDREAD = $_dvdread DVDREAD_INTERNAL = $_dvdread_internal DXR3 = $_dxr3 -ESD = $_esd FAAD = $_faad FASTMEMCPY = $_fastmemcpy FBDEV = $_fbdev @@ -6452,6 +6373,7 @@ PNG = $_png PNM = $_pnm PRIORITY = $_priority PULSE = $_pulse +PORTAUDIO = $_portaudio PVR = $_pvr QTX_CODECS = $_qtx QTX_CODECS_WIN32 = $_qtx_codecs_win32 @@ -6464,7 +6386,6 @@ S3FB = $_s3fb SDL = $_sdl SPEEX = $_speex STREAM_CACHE = $_stream_cache -SGIAUDIO = $_sgiaudio SUNAUDIO = $_sunaudio SVGA = $_svga TDFXFB = $_tdfxfb @@ -6717,10 +6638,7 @@ $def_xmms /* Audio output drivers */ $def_alsa -$def_arts $def_coreaudio -$def_esd -$def_esd_latency $def_jack $def_nas $def_openal @@ -6729,8 +6647,8 @@ $def_ossaudio $def_ossaudio_devdsp $def_ossaudio_devmixer $def_pulse +$def_portaudio $def_rsound -$def_sgiaudio $def_sunaudio $def_win32waveout diff --git a/input/input.c b/input/input.c index ffa69043f8..89eb847385 100644 --- a/input/input.c +++ b/input/input.c @@ -631,16 +631,16 @@ struct input_ctx { int async_quit_request; -static int print_key_list(m_option_t *cfg); -static int print_cmd_list(m_option_t *cfg); +static int print_key_list(m_option_t *cfg, char *optname, char *optparam); +static int print_cmd_list(m_option_t *cfg, char *optname, char *optparam); // Our command line options static const m_option_t input_conf[] = { OPT_STRING("conf", input.config_file, CONF_GLOBAL), OPT_INT("ar-delay", input.ar_delay, CONF_GLOBAL), OPT_INT("ar-rate", input.ar_rate, CONF_GLOBAL), - { "keylist", print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL }, - { "cmdlist", print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL }, + { "keylist", print_key_list, CONF_TYPE_PRINT_FUNC, CONF_NOCFG }, + { "cmdlist", print_cmd_list, CONF_TYPE_PRINT_FUNC, CONF_NOCFG }, OPT_STRING("js-dev", input.js_dev, CONF_GLOBAL), OPT_STRING("ar-dev", input.ar_dev, CONF_GLOBAL), OPT_STRING("file", input.in_file, CONF_GLOBAL), @@ -1915,16 +1915,16 @@ void mp_input_register_options(m_config_t *cfg) m_config_register_options(cfg, mp_input_opts); } -static int print_key_list(m_option_t *cfg) +static int print_key_list(m_option_t *cfg, char *optname, char *optparam) { int i; printf("\n"); for (i = 0; key_names[i].name != NULL; i++) printf("%s\n", key_names[i].name); - exit(0); + return M_OPT_EXIT; } -static int print_cmd_list(m_option_t *cfg) +static int print_cmd_list(m_option_t *cfg, char *optname, char *optparam) { const mp_cmd_t *cmd; int i, j; @@ -1953,7 +1953,7 @@ static int print_cmd_list(m_option_t *cfg) } printf("\n"); } - exit(0); + return M_OPT_EXIT; } void mp_input_wakeup(struct input_ctx *ictx) diff --git a/libao2/ao_arts.c b/libao2/ao_arts.c deleted file mode 100644 index d828e7953e..0000000000 --- a/libao2/ao_arts.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * aRts audio output driver for MPlayer - * - * copyright (c) 2002 Michele Balistreri <brain87@gmx.net> - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <artsc.h> -#include <stdio.h> - -#include "config.h" -#include "audio_out.h" -#include "audio_out_internal.h" -#include "libaf/af_format.h" -#include "mp_msg.h" - -#define OBTAIN_BITRATE(a) (((a != AF_FORMAT_U8) && (a != AF_FORMAT_S8)) ? 16 : 8) - -/* Feel free to experiment with the following values: */ -#define ARTS_PACKETS 10 /* Number of audio packets */ -#define ARTS_PACKET_SIZE_LOG2 11 /* Log2 of audio packet size */ - -static arts_stream_t stream; - -static const ao_info_t info = -{ - "aRts audio output", - "arts", - "Michele Balistreri <brain87@gmx.net>", - "" -}; - -LIBAO_EXTERN(arts) - -static int control(int cmd, void *arg) -{ - return CONTROL_UNKNOWN; -} - -static int init(int rate_hz, int channels, int format, int flags) -{ - int err; - int frag_spec; - - if( (err=arts_init()) ) { - mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ARTS] %s\n", arts_error_text(err)); - return 0; - } - mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] Connected to sound server.\n"); - - /* - * arts supports 8bit unsigned and 16bit signed sample formats - * (16bit apparently in little endian format, even in the case - * when artsd runs on a big endian cpu). - * - * Unsupported formats are translated to one of these two formats - * using mplayer's audio filters. - */ - switch (format) { - case AF_FORMAT_U8: - case AF_FORMAT_S8: - format = AF_FORMAT_U8; - break; - default: - format = AF_FORMAT_S16_LE; /* artsd always expects little endian?*/ - break; - } - - ao_data.format = format; - ao_data.channels = channels; - ao_data.samplerate = rate_hz; - ao_data.bps = (rate_hz*channels); - - if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) - ao_data.bps*=2; - - stream=arts_play_stream(rate_hz, OBTAIN_BITRATE(format), channels, "MPlayer"); - - if(stream == NULL) { - mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ARTS] Unable to open a stream.\n"); - arts_free(); - return 0; - } - - /* Set the stream to blocking: it will not block anyway, but it seems */ - /* to be working better */ - arts_stream_set(stream, ARTS_P_BLOCKING, 1); - frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16; - arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); - ao_data.buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); - mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] Stream opened.\n"); - - mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] buffer size: %d\n", - ao_data.buffersize); - mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] buffer size: %d\n", - arts_stream_get(stream, ARTS_P_PACKET_SIZE)); - - return 1; -} - -static void uninit(int immed) -{ - arts_close_stream(stream); - arts_free(); -} - -static int play(void* data,int len,int flags) -{ - return arts_write(stream, data, len); -} - -static void audio_pause(void) -{ -} - -static void audio_resume(void) -{ -} - -static void reset(void) -{ -} - -static int get_space(void) -{ - return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); -} - -static float get_delay(void) -{ - return ((float) (ao_data.buffersize - arts_stream_get(stream, - ARTS_P_BUFFER_SPACE))) / ((float) ao_data.bps); -} diff --git a/libao2/ao_esd.c b/libao2/ao_esd.c deleted file mode 100644 index e7c6701aa0..0000000000 --- a/libao2/ao_esd.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * EsounD audio output driver for MPlayer - * - * copyright (c) 2002 Juergen Keil <jk@tools.de> - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - - /* - * TODO / known problems: - * - does not work well when the esd daemon has autostandby disabled - * (workaround: run esd with option "-as 2" - fortunatelly this is - * the default) - * - plays noise on a linux 2.4.4 kernel with a SB16PCI card, when using - * a local tcp connection to the esd daemon; there is no noise when using - * a unix domain socket connection. - * (there are EIO errors reported by the sound card driver, so this is - * most likely a linux sound card driver problem) - */ - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/socket.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <fcntl.h> -#include <time.h> -#ifdef __svr4__ -#include <stropts.h> -#endif -#include <esd.h> - -#include "config.h" -#include "audio_out.h" -#include "audio_out_internal.h" -#include "libaf/af_format.h" -#include "mp_msg.h" - - -#define ESD_RESAMPLES 0 -#define ESD_DEBUG 0 - -#if ESD_DEBUG -#define dprintf(...) printf(__VA_ARGS__) -#else -#define dprintf(...) /**/ -#endif - - -#define ESD_CLIENT_NAME "MPlayer" -#define ESD_MAX_DELAY (1.0f) /* max amount of data buffered in esd (#sec) */ - -static const ao_info_t info = -{ - "EsounD audio output", - "esd", - "Juergen Keil <jk@tools.de>", - "" -}; - -LIBAO_EXTERN(esd) - -static int esd_fd = -1; -static int esd_play_fd = -1; -static esd_server_info_t *esd_svinfo; -static int esd_latency; -static int esd_bytes_per_sample; -static unsigned long esd_samples_written; -static struct timeval esd_play_start; -extern float audio_delay; - -/* - * to set/get/query special features/parameters - */ -static int control(int cmd, void *arg) -{ - esd_player_info_t *esd_pi; - esd_info_t *esd_i; - time_t now; - static time_t vol_cache_time; - static ao_control_vol_t vol_cache; - - switch (cmd) { - case AOCONTROL_GET_VOLUME: - time(&now); - if (now == vol_cache_time) { - *(ao_control_vol_t *)arg = vol_cache; - return CONTROL_OK; - } - - dprintf("esd: get vol\n"); - if ((esd_i = esd_get_all_info(esd_fd)) == NULL) - return CONTROL_ERROR; - - for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) - if (strcmp(esd_pi->name, ESD_CLIENT_NAME) == 0) - break; - - if (esd_pi != NULL) { - ao_control_vol_t *vol = (ao_control_vol_t *)arg; - vol->left = esd_pi->left_vol_scale * 100 / ESD_VOLUME_BASE; - vol->right = esd_pi->right_vol_scale * 100 / ESD_VOLUME_BASE; - - vol_cache = *vol; - vol_cache_time = now; - } - esd_free_all_info(esd_i); - - return CONTROL_OK; - - case AOCONTROL_SET_VOLUME: - dprintf("esd: set vol\n"); - if ((esd_i = esd_get_all_info(esd_fd)) == NULL) - return CONTROL_ERROR; - - for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) - if (strcmp(esd_pi->name, ESD_CLIENT_NAME) == 0) - break; - - if (esd_pi != NULL) { - ao_control_vol_t *vol = (ao_control_vol_t *)arg; - esd_set_stream_pan(esd_fd, esd_pi->source_id, - vol->left * ESD_VOLUME_BASE / 100, - vol->right * ESD_VOLUME_BASE / 100); - - vol_cache = *vol; - time(&vol_cache_time); - } - esd_free_all_info(esd_i); - return CONTROL_OK; - - default: - return CONTROL_UNKNOWN; - } -} - - -/* - * open & setup audio device - * return: 1=success 0=fail - */ -static int init(int rate_hz, int channels, int format, int flags) -{ - esd_format_t esd_fmt; - int bytes_per_sample; - int fl; - char *server = ao_subdevice; /* NULL for localhost */ - float lag_seconds, lag_net = 0., lag_serv; - struct timeval proto_start, proto_end; - - global_ao->no_persistent_volume = true; - - if (esd_fd < 0) { - esd_fd = esd_open_sound(server); - if (esd_fd < 0) { - mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ESD] esd_open_sound failed: %s\n", - strerror(errno)); - return 0; - } - - /* get server info, and measure network latency */ - gettimeofday(&proto_start, NULL); - esd_svinfo = esd_get_server_info(esd_fd); - if(server) { - gettimeofday(&proto_end, NULL); - lag_net = (proto_end.tv_sec - proto_start.tv_sec) + - (proto_end.tv_usec - proto_start.tv_usec) / 1000000.0; - lag_net /= 2.0; /* round trip -> one way */ - } else - lag_net = 0.0; /* no network lag */ - - /* - if (esd_svinfo) { - mp_msg(MSGT_AO, MSGL_INFO, "AO: [esd] server info:\n"); - esd_print_server_info(esd_svinfo); - } - */ - } - - esd_fmt = ESD_STREAM | ESD_PLAY; - -#if ESD_RESAMPLES - /* let the esd daemon convert sample rate */ -#else - /* let mplayer's audio filter convert the sample rate */ - if (esd_svinfo != NULL) - rate_hz = esd_svinfo->rate; -#endif - ao_data.samplerate = rate_hz; - - /* EsounD can play mono or stereo */ - switch (channels) { - case 1: - esd_fmt |= ESD_MONO; - ao_data.channels = bytes_per_sample = 1; - break; - default: - esd_fmt |= ESD_STEREO; - ao_data.channels = bytes_per_sample = 2; - break; - } - - /* EsounD can play 8bit unsigned and 16bit signed native */ - switch (format) { - case AF_FORMAT_S8: - case AF_FORMAT_U8: - esd_fmt |= ESD_BITS8; - ao_data.format = AF_FORMAT_U8; - break; - default: - esd_fmt |= ESD_BITS16; - ao_data.format = AF_FORMAT_S16_NE; - bytes_per_sample *= 2; - break; - } - - /* modify audio_delay depending on esd_latency - * latency is number of samples @ 44.1khz stereo 16 bit - * adjust according to rate_hz & bytes_per_sample - */ -#ifdef CONFIG_ESD_LATENCY - esd_latency = esd_get_latency(esd_fd); -#else - esd_latency = ((channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * - (ESD_BUF_SIZE + 64 * (4.0f / bytes_per_sample)) - ) / rate_hz; - esd_latency += ESD_BUF_SIZE * 2; -#endif - if(esd_latency > 0) { - lag_serv = (esd_latency * 4.0f) / (bytes_per_sample * rate_hz); - lag_seconds = lag_net + lag_serv; - audio_delay += lag_seconds; - mp_tmsg(MSGT_AO, MSGL_INFO,"[AO ESD] latency: [server: %0.2fs, net: %0.2fs] (adjust %0.2fs)\n", - lag_serv, lag_net, lag_seconds); - } - - esd_play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, - server, ESD_CLIENT_NAME); - if (esd_play_fd < 0) { - mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ESD] failed to open ESD playback stream: %s\n", strerror(errno)); - return 0; - } - - /* enable non-blocking i/o on the socket connection to the esd server */ - if ((fl = fcntl(esd_play_fd, F_GETFL)) >= 0) - fcntl(esd_play_fd, F_SETFL, O_NDELAY|fl); - -#if ESD_DEBUG - { - int sbuf, rbuf, len; - len = sizeof(sbuf); - getsockopt(esd_play_fd, SOL_SOCKET, SO_SNDBUF, &sbuf, &len); - len = sizeof(rbuf); - getsockopt(esd_play_fd, SOL_SOCKET, SO_RCVBUF, &rbuf, &len); - dprintf("esd: send/receive socket buffer space %d/%d bytes\n", - sbuf, rbuf); - } -#endif - - ao_data.bps = bytes_per_sample * rate_hz; - ao_data.outburst = ao_data.bps > 100000 ? 4*ESD_BUF_SIZE : 2*ESD_BUF_SIZE; - - esd_play_start.tv_sec = 0; - esd_samples_written = 0; - esd_bytes_per_sample = bytes_per_sample; - - return 1; -} - - -/* - * close audio device - */ -static void uninit(int immed) -{ - if (esd_play_fd >= 0) { - esd_close(esd_play_fd); - esd_play_fd = -1; - } - - if (esd_svinfo) { - esd_free_server_info(esd_svinfo); - esd_svinfo = NULL; - } - - if (esd_fd >= 0) { - esd_close(esd_fd); - esd_fd = -1; - } -} - - -/* - * plays 'len' bytes of 'data' - * it should round it down to outburst*n - * return: number of bytes played - */ -static int play(void* data, int len, int flags) -{ - int offs; - int nwritten; - int nsamples; - int n; - - /* round down buffersize to a multiple of ESD_BUF_SIZE bytes */ - len = len / ESD_BUF_SIZE * ESD_BUF_SIZE; - if (len <= 0) - return 0; - -#define SINGLE_WRITE 0 -#if SINGLE_WRITE - nwritten = write(esd_play_fd, data, len); -#else - for (offs = 0, nwritten=0; offs + ESD_BUF_SIZE <= len; offs += ESD_BUF_SIZE) { |