Commit cc488ad1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove SDL audio output

parent e071592a
...@@ -347,7 +347,7 @@ case "${host_os}" in ...@@ -347,7 +347,7 @@ case "${host_os}" in
VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm]) VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm])
VLC_ADD_LDFLAGS([vlc],[-mwindows]) VLC_ADD_LDFLAGS([vlc],[-mwindows])
VLC_ADD_LIBS([win32text],[-lgdi32]) VLC_ADD_LIBS([win32text],[-lgdi32])
VLC_ADD_LIBS([cdda vcdx sdl_image aout_sdl vout_sdl],[-lwinmm]) VLC_ADD_LIBS([cdda vcdx sdl_image vout_sdl],[-lwinmm])
VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap stream_out_standard stream_out_select stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[-lws2_32]) VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap stream_out_standard stream_out_select stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[-lws2_32])
VLC_ADD_LIBS([filesystem], [-lshlwapi]) VLC_ADD_LIBS([filesystem], [-lshlwapi])
dnl dnl
...@@ -3221,13 +3221,13 @@ then ...@@ -3221,13 +3221,13 @@ then
PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [ PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
# SDL on Darwin is heavily patched and can only run SDL_image # SDL on Darwin is heavily patched and can only run SDL_image
if test "${SYS}" != "darwin"; then if test "${SYS}" != "darwin"; then
VLC_ADD_PLUGIN([vout_sdl aout_sdl]) VLC_ADD_PLUGIN([vout_sdl])
fi fi
if test "${SYS}" != "mingw32"; then if test "${SYS}" != "mingw32"; then
VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11]) VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11])
fi fi
VLC_ADD_CFLAGS([vout_sdl aout_sdl],[${SDL_CFLAGS}]) VLC_ADD_CFLAGS([vout_sdl],[${SDL_CFLAGS}])
VLC_ADD_LIBS([vout_sdl aout_sdl],[${SDL_LIBS}]) VLC_ADD_LIBS([vout_sdl],[${SDL_LIBS}])
# SDL_image # SDL_image
AS_IF([ test "${enable_sdl_image}" != "no"],[ AS_IF([ test "${enable_sdl_image}" != "no"],[
......
...@@ -46,7 +46,6 @@ $Id$ ...@@ -46,7 +46,6 @@ $Id$
* antiflicker: anti-flicker video filter * antiflicker: anti-flicker video filter
* aout_directx: audio output module using the DirectX API * aout_directx: audio output module using the DirectX API
* aout_file: Audio output to write to a file * aout_file: Audio output to write to a file
* aout_sdl: audio output module using the SDL library
* araw: Pseudo audio decoder for raw PCM * araw: Pseudo audio decoder for raw PCM
* asf: ASF demuxer * asf: ASF demuxer
* atmo: Ambilight-like video-output * atmo: Ambilight-like video-output
......
SOURCES_aout_directx = directx.c windows_audio_common.h SOURCES_aout_directx = directx.c windows_audio_common.h
SOURCES_aout_file = file.c SOURCES_aout_file = file.c
SOURCES_aout_sdl = sdl.c
SOURCES_waveout = waveout.c windows_audio_common.h SOURCES_waveout = waveout.c windows_audio_common.h
SOURCES_portaudio = portaudio.c SOURCES_portaudio = portaudio.c
SOURCES_auhal = auhal.c SOURCES_auhal = auhal.c
......
/*****************************************************************************
* sdl.c : SDL audio output plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2002 the VideoLAN team
* $Id$
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Sam Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
* Christophe Massiot <massiot@via.ecp.fr>
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <unistd.h> /* write(), close() */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <SDL.h>
#define FRAME_SIZE 2048
/*****************************************************************************
* aout_sys_t: SDL audio output method descriptor
*****************************************************************************
* This structure is part of the audio output thread descriptor.
* It describes the specific properties of an audio device.
*****************************************************************************/
struct aout_sys_t
{
mtime_t next_date;
mtime_t buffer_time;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Play ( audio_output_t *, block_t * );
static void SDLCallback ( void *, uint8_t *, int );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin ()
set_shortname( "SDL" )
set_description( N_("Simple DirectMedia Layer audio output") )
set_capability( "audio output", 40 )
set_category( CAT_AUDIO )
set_subcategory( SUBCAT_AUDIO_AOUT )
add_shortcut( "sdl" )
set_callbacks( Open, Close )
vlc_module_end ()
/*****************************************************************************
* Open: open the audio device
*****************************************************************************/
static int Open ( vlc_object_t *p_this )
{
audio_output_t *p_aout = (audio_output_t *)p_this;
SDL_AudioSpec desired, obtained;
int i_nb_channels;
vlc_value_t val, text;
/* Check that no one uses the DSP. */
uint32_t i_flags = SDL_INIT_AUDIO;
if( SDL_WasInit( i_flags ) )
{
return VLC_EGENERIC;
}
i_flags |= SDL_INIT_EVENTTHREAD;
#ifndef NDEBUG
/* In debug mode you may want vlc to dump a core instead of staying
* stuck */
i_flags |= SDL_INIT_NOPARACHUTE;
#endif
/* Initialize library */
if( SDL_Init( i_flags ) < 0 )
{
msg_Err( p_aout, "cannot initialize SDL (%s)", SDL_GetError() );
return VLC_EGENERIC;
}
if( var_Get( p_aout, "audio-device", &val ) != VLC_ENOVAR )
{
/* The user has selected an audio device. */
if ( val.i_int == AOUT_VAR_STEREO )
{
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
else if ( val.i_int == AOUT_VAR_MONO )
{
p_aout->format.i_physical_channels = AOUT_CHAN_CENTER;
}
}
i_nb_channels = aout_FormatNbChannels( &p_aout->format );
if ( i_nb_channels > 2 )
{
/* SDL doesn't support more than two channels. */
i_nb_channels = 2;
p_aout->format.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
desired.freq = p_aout->format.i_rate;
desired.format = AUDIO_S16SYS;
desired.channels = i_nb_channels;
desired.callback = SDLCallback;
desired.userdata = p_aout;
desired.samples = FRAME_SIZE;
/* Open the sound device. */
if( SDL_OpenAudio( &desired, &obtained ) < 0 )
{
return VLC_EGENERIC;
}
SDL_PauseAudio( 0 );
/* Now have a look at what we got. */
switch ( obtained.format )
{
case AUDIO_S16LSB:
p_aout->format.i_format = VLC_CODEC_S16L; break;
case AUDIO_S16MSB:
p_aout->format.i_format = VLC_CODEC_S16B; break;
case AUDIO_U16LSB:
p_aout->format.i_format = VLC_CODEC_U16L; break;
case AUDIO_U16MSB:
p_aout->format.i_format = VLC_CODEC_U16B; break;
case AUDIO_S8:
p_aout->format.i_format = VLC_CODEC_S8; break;
case AUDIO_U8:
p_aout->format.i_format = VLC_CODEC_U8; break;
}
/* Volume is entirely done in software. */
aout_VolumeSoftInit( p_aout );
if ( obtained.channels != i_nb_channels )
{
p_aout->format.i_physical_channels = (obtained.channels == 2 ?
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT :
AOUT_CHAN_CENTER);
if ( var_Type( p_aout, "audio-device" ) == 0 )
{
var_Create( p_aout, "audio-device",
VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
text.psz_string = _("Audio Device");
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL );
val.i_int = (obtained.channels == 2) ? AOUT_VAR_STEREO :
AOUT_VAR_MONO;
text.psz_string = (obtained.channels == 2) ? _("Stereo") :
_("Mono");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart,
NULL );
}
}
else if ( var_Type( p_aout, "audio-device" ) == 0 )
{
/* First launch. */
var_Create( p_aout, "audio-device",
VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
text.psz_string = _("Audio Device");
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL );
val.i_int = AOUT_VAR_STEREO;
text.psz_string = _("Stereo");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
val.i_int = AOUT_VAR_MONO;
text.psz_string = _("Mono");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
if ( i_nb_channels == 2 )
{
val.i_int = AOUT_VAR_STEREO;
}
else
{
val.i_int = AOUT_VAR_MONO;
}
var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL );
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
}
var_TriggerCallback( p_aout, "intf-change" );
p_aout->format.i_rate = obtained.freq;
p_aout->i_nb_samples = obtained.samples;
p_aout->pf_play = Play;
p_aout->pf_pause = NULL;
p_aout->pf_flush = NULL;
return VLC_SUCCESS;
}
/*****************************************************************************
* Play: play a sound samples buffer
*****************************************************************************/
static void Play( audio_output_t * p_aout, block_t *block )
{
aout_FifoPush( &p_aout->fifo, block );
}
/*****************************************************************************
* Close: close the audio device
*****************************************************************************/
static void Close ( vlc_object_t *p_this )
{
VLC_UNUSED(p_this);
SDL_PauseAudio( 1 );
SDL_CloseAudio();
SDL_QuitSubSystem( SDL_INIT_AUDIO );
}
/*****************************************************************************
* SDLCallback: what to do once SDL has played sound samples
*****************************************************************************/
static void SDLCallback( void * _p_aout, uint8_t * p_stream, int i_len )
{
audio_output_t * p_aout = (audio_output_t *)_p_aout;
aout_buffer_t * p_buffer;
/* SDL is unable to call us at regular times, or tell us its current
* hardware latency, or the buffer state. So we just pop data and throw
* it at SDL's face. Nah. */
vlc_mutex_lock( &p_aout->lock );
p_buffer = aout_FifoPop( &p_aout->fifo );
vlc_mutex_unlock( &p_aout->lock );
if ( p_buffer != NULL )
{
vlc_memcpy( p_stream, p_buffer->p_buffer, i_len );
aout_BufferFree( p_buffer );
}
else
{
vlc_memset( p_stream, 0, i_len );
}
}
...@@ -324,7 +324,6 @@ modules/audio_output/jack.c ...@@ -324,7 +324,6 @@ modules/audio_output/jack.c
modules/audio_output/oss.c modules/audio_output/oss.c
modules/audio_output/portaudio.c modules/audio_output/portaudio.c
modules/audio_output/pulse.c modules/audio_output/pulse.c
modules/audio_output/sdl.c
modules/audio_output/waveout.c modules/audio_output/waveout.c
modules/audio_output/windows_audio_common.h modules/audio_output/windows_audio_common.h
modules/codec/a52.c modules/codec/a52.c
......
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