Commit 123b3214 authored by Christophe Massiot's avatar Christophe Massiot

Audio output 3. Expect major breakages.

parent cd7a6631
...@@ -22,7 +22,7 @@ INTERFACE := interface intf_eject ...@@ -22,7 +22,7 @@ INTERFACE := interface intf_eject
PLAYLIST := playlist PLAYLIST := playlist
INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock input_info INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock input_info
VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif AUDIO_OUTPUT := audio_output filters input mixer output
MISC := mtime modules threads cpu configuration netutils iso_lang messages objects extras MISC := mtime modules threads cpu configuration netutils iso_lang messages objects extras
LIBVLC_OBJ := $(LIBVLC:%=src/%.o) \ LIBVLC_OBJ := $(LIBVLC:%=src/%.o) \
......
#! /bin/sh #! /bin/sh
## bootstrap.sh file for vlc, the VideoLAN Client ## bootstrap.sh file for vlc, the VideoLAN Client
## $Id: bootstrap.sh,v 1.9 2002/08/07 00:29:36 sam Exp $ ## $Id: bootstrap.sh,v 1.10 2002/08/07 21:36:55 massiot Exp $
## ##
## Authors: Samuel Hocevar <sam@zoy.org> ## Authors: Samuel Hocevar <sam@zoy.org>
...@@ -73,7 +73,7 @@ echo "$file." ...@@ -73,7 +73,7 @@ echo "$file."
echo -n " + fixing glade bugs: " echo -n " + fixing glade bugs: "
for file in gnome_interface.c gtk_interface.c for file in gnome_interface.c gtk_interface.c
do do
if grep -q "DO NOT EDIT THIS FILE" modules/gui/gtk/$file if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
then then
rm -f /tmp/$$.$file.bak rm -f /tmp/$$.$file.bak
cat > /tmp/$$.$file.bak << EOF cat > /tmp/$$.$file.bak << EOF
...@@ -97,7 +97,7 @@ echo -n "$file " ...@@ -97,7 +97,7 @@ echo -n "$file "
done done
file=gtk_support.h file=gtk_support.h
if grep -q "DO NOT EDIT THIS FILE" modules/gui/gtk/$file if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
then then
rm -f /tmp/$$.$file.bak rm -f /tmp/$$.$file.bak
sed 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap.sh/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < modules/gui/gtk/$file > /tmp/$$.$file.bak sed 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap.sh/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < modules/gui/gtk/$file > /tmp/$$.$file.bak
......
This diff is collapsed.
...@@ -437,9 +437,12 @@ BUILTINS="${BUILTINS}" ...@@ -437,9 +437,12 @@ BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null" PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http misc/network/ipv4 misc/memcpy/memcpy" PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file access/udp access/http misc/network/ipv4 misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts" PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/mpeg_video/mpeg_video codec/lpcm/lpcm codec/spdif/spdif codec/spudec/spudec" PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec"
#PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/mpeg_audio/mpeg_audio codec/a52old/a52old codec/lpcm/lpcm codec/spdif/spdif"
PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop" PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
PLUGINS="${PLUGINS} visualization/scope/scope" PLUGINS="${PLUGINS} audio_mixer/trivial"
PLUGINS="${PLUGINS} audio_output/file"
#PLUGINS="${PLUGINS} visualization/scope/scope"
PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga" PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga"
dnl dnl
...@@ -808,7 +811,7 @@ then ...@@ -808,7 +811,7 @@ then
fi fi
;; ;;
xno) xno)
dnl Compile without dvbpsi (dlopen version, works only under Linux) dnl Compile without dvbpsi
;; ;;
*) *)
AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi}) AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
...@@ -963,7 +966,7 @@ then ...@@ -963,7 +966,7 @@ then
mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs" mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs"
LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}" LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
AC_CHECK_LIB(mad, mad_bit_init, [ AC_CHECK_LIB(mad, mad_bit_init, [
BUILTINS="${BUILTINS} codec/mad/mad" #BUILTINS="${BUILTINS} codec/mad/mad"
mad_LDFLAGS="${mad_LDFLAGS} -lmad" mad_LDFLAGS="${mad_LDFLAGS} -lmad"
],[ AC_MSG_ERROR([the specified tree hasn't been compiled ]) ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
],[]) ],[])
...@@ -978,7 +981,7 @@ then ...@@ -978,7 +981,7 @@ then
AC_CHECK_HEADERS(mad.h, , AC_CHECK_HEADERS(mad.h, ,
[ AC_MSG_ERROR([Cannot find development headers for libmad...]) ]) [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
AC_CHECK_LIB(mad, mad_bit_init, [ AC_CHECK_LIB(mad, mad_bit_init, [
PLUGINS="${PLUGINS} codec/mad/mad" #PLUGINS="${PLUGINS} codec/mad/mad"
mad_LDFLAGS="${mad_LDFLAGS} -lmad" ], mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
[ AC_MSG_ERROR([Cannot find libmad library...]) ]) [ AC_MSG_ERROR([Cannot find libmad library...]) ])
CFLAGS="${save_CFLAGS}" CFLAGS="${save_CFLAGS}"
...@@ -1067,9 +1070,11 @@ dnl ...@@ -1067,9 +1070,11 @@ dnl
dnl a52 AC3 decoder plugin dnl a52 AC3 decoder plugin
dnl dnl
AC_ARG_ENABLE(a52, AC_ARG_ENABLE(a52,
[ --enable-a52 AC3 support with liba52 (default enabled)]) [ --enable-a52 A/52 support with liba52 (default enabled)])
if test "x${enable_a52}" != "xno" if test "x${enable_a52}" != "xno"
then then
AC_ARG_WITH(a52,
[ --with-a52=PATH a52 headers and libraries])
AC_ARG_WITH(a52-tree, AC_ARG_WITH(a52-tree,
[ --with-a52-tree=PATH a52dec tree for static linking ],[],[]) [ --with-a52-tree=PATH a52dec tree for static linking ],[],[])
if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x" if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
...@@ -1106,14 +1111,33 @@ then ...@@ -1106,14 +1111,33 @@ then
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_ERROR([the specified tree doesn't have a52.h]) AC_MSG_ERROR([the specified tree doesn't have a52.h])
fi fi
else dnl no with args else
if test "x${with_a52}" = "x"
then
test_LDFLAGS=""
test_CFLAGS=""
else
test_LDFLAGS="-L${with_a52}/lib"
test_CFLAGS="-I${with_a52}/include"
fi
save_CPPFLAGS="${CPPFLAGS}"
save_LDFLAGS="${LDFLAGS}"
CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
LDFLAGS="${save_LDFLAGS} ${test_LDFLAGS}"
AC_CHECK_HEADERS(a52dec/a52.h, [ AC_CHECK_HEADERS(a52dec/a52.h, [
AC_CHECK_LIB(a52, a52_free, [ AC_CHECK_LIB(a52, a52_free, [
BUILTINS="${BUILTINS} codec/a52/a52" BUILTINS="${BUILTINS} codec/a52/a52"
a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm" a52_LDFLAGS="${a52_LDFLAGS} ${test_LDFLAGS} -la52 -lm"
a52_CFLAGS="${a52_CFLAGS}" a52_CFLAGS="${a52_CFLAGS} ${test_CFLAGS}"
],[],[-lm]) ],[
if test "x${enable_dvbpsi}" != "x"
then
AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net])
fi
],[-lm])
]) ])
CPPFLAGS="${save_CPPFLAGS}"
LDFLAGS="${save_LDFLAGS}"
fi fi
fi fi
...@@ -1377,14 +1401,14 @@ AC_ARG_WITH(,[Audio plugins:]) ...@@ -1377,14 +1401,14 @@ AC_ARG_WITH(,[Audio plugins:])
dnl dnl
dnl OSS /dev/dsp module (enabled by default except on win32) dnl OSS /dev/dsp module (enabled by default except on win32)
dnl dnl
AC_ARG_ENABLE(dsp, AC_ARG_ENABLE(oss,
[ --enable-dsp Linux /dev/dsp support (enabled on Linux)]) [ --enable-oss Linux OSS /dev/dsp support (enabled on Linux)])
if test "x${enable_dsp}" != "xno" && if test "x${enable_oss}" != "xno" &&
(test "x${SYS}" != "xmingw32" || test "x${enable_dsp}" = "xyes") (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
then then
AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [ AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
PLUGINS="${PLUGINS} audio_output/dsp/dsp" #PLUGINS="${PLUGINS} audio_output/oss"
AC_CHECK_LIB(ossaudio,main,dsp_LDFLAGS="${dsp_LDFLAGS} -lossaudio") AC_CHECK_LIB(ossaudio,main,dsp_LDFLAGS="${dsp_LDFLAGS} -lossaudio")
]) ])
fi fi
...@@ -1399,7 +1423,7 @@ AC_ARG_ENABLE(esd, ...@@ -1399,7 +1423,7 @@ AC_ARG_ENABLE(esd,
AC_PATH_PROG(ESD_CONFIG, esd-config, no) AC_PATH_PROG(ESD_CONFIG, esd-config, no)
if test "x${ESD_CONFIG}" != "xno" if test "x${ESD_CONFIG}" != "xno"
then then
PLUGINS="${PLUGINS} audio_output/esd/esd" #PLUGINS="${PLUGINS} audio_output/esd"
esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`" esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`" esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
fi fi
...@@ -1415,7 +1439,7 @@ AC_ARG_ENABLE(arts, ...@@ -1415,7 +1439,7 @@ AC_ARG_ENABLE(arts,
AC_PATH_PROG(ARTS_CONFIG, artsc-config, no) AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
if test "x${ARTS_CONFIG}" != "xno" if test "x${ARTS_CONFIG}" != "xno"
then then
PLUGINS="${PLUGINS} audio_output/arts/arts" #PLUGINS="${PLUGINS} audio_output/arts"
arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`" arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `" arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
fi fi
...@@ -1431,7 +1455,7 @@ AC_ARG_ENABLE(alsa, ...@@ -1431,7 +1455,7 @@ AC_ARG_ENABLE(alsa,
AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
if test "x${have_alsa}" = "xtrue" if test "x${have_alsa}" = "xtrue"
then then
PLUGINS="${PLUGINS} audio_output/alsa/alsa" #PLUGINS="${PLUGINS} audio_output/alsa"
alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl" alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
fi fi
fi]) fi])
...@@ -1443,7 +1467,7 @@ AC_ARG_ENABLE(waveout, ...@@ -1443,7 +1467,7 @@ AC_ARG_ENABLE(waveout,
[ --enable-waveout Win32 waveOut module (default enabled on Win32)]) [ --enable-waveout Win32 waveOut module (default enabled on Win32)])
if test "x${enable_waveout}" != "xno" -a "x${SYS}" = "xmingw32" if test "x${enable_waveout}" != "xno" -a "x${SYS}" = "xmingw32"
then then
PLUGINS="${PLUGINS} audio_output/waveout/waveout" #PLUGINS="${PLUGINS} audio_output/waveout"
waveout_LDFLAGS="-lwinmm" waveout_LDFLAGS="-lwinmm"
fi fi
......
/*****************************************************************************
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.1 2002/08/07 21:36:55 massiot Exp $
*
* Authors: 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* aout_alloc_t : allocation of memory in the audio output
*****************************************************************************/
typedef struct aout_alloc_t
{
int i_alloc_type;
int i_bytes_per_sec; /* -1 if only the alloc_type is
* relevant. */
} aout_alloc_t;
#define AOUT_ALLOC_NONE 0
#define AOUT_ALLOC_STACK 1
#define AOUT_ALLOC_HEAP 2
#define aout_BufferAlloc( p_alloc, i_nb_usec, p_previous_buffer, p_new_buffer ) \
if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_NONE ) \
{ \
(p_new_buffer) = p_previous_buffer; \
} \
else \
{ \
if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK ) \
{ \
(p_new_buffer) = alloca( (u64)(p_alloc)->i_bytes_per_sec \
* i_nb_usec \
/ 1000000 + 1 + sizeof(aout_buffer_t) ); \
} \
else \
{ \
(p_new_buffer) = malloc( (u64)(p_alloc)->i_bytes_per_sec \
* i_nb_usec \
/ 1000000 + 1 + sizeof(aout_buffer_t) ); \
} \
(p_new_buffer)->i_alloc_type = (p_alloc)->i_alloc_type; \
(p_new_buffer)->i_size = (u64)(p_alloc)->i_bytes_per_sec \
* i_nb_usec / 1000000 + 1; \
(p_new_buffer)->p_buffer = (void *)(p_new_buffer) \
+ sizeof(aout_buffer_t); \
if ( (p_previous_buffer) != NULL ) \
{ \
(p_new_buffer)->start_date = \
((aout_buffer_t *)p_previous_buffer)->start_date; \
(p_new_buffer)->end_date = \
((aout_buffer_t *)p_previous_buffer)->end_date; \
} \
}
#define aout_BufferFree( p_buffer ) \
if ( (p_buffer)->i_alloc_type == AOUT_ALLOC_HEAP ) \
{ \
free( p_buffer ); \
}
/*****************************************************************************
* aout_fifo_t : audio output buffer FIFO
*****************************************************************************/
typedef struct aout_fifo_t
{
vlc_mutex_t lock;
struct aout_buffer_t * p_first;
struct aout_buffer_t ** pp_last;
} aout_fifo_t;
static inline void aout_FifoInit( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
vlc_mutex_init( (vlc_object_t *)p_aout, &p_fifo->lock );
p_fifo->p_first = NULL;
p_fifo->pp_last = &p_fifo->p_first;
}
static inline void aout_FifoPush( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo,
aout_buffer_t * p_buffer )
{
vlc_mutex_lock( &p_fifo->lock );
*p_fifo->pp_last = p_buffer;
p_fifo->pp_last = &p_buffer->p_next;
*p_fifo->pp_last = NULL;
vlc_mutex_unlock( &p_fifo->lock );
}
/* This function supposes there is one buffer in p_fifo. */
static inline aout_buffer_t * aout_FifoPop( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
aout_buffer_t * p_buffer;
vlc_mutex_lock( &p_fifo->lock );
p_buffer = p_fifo->p_first;
p_fifo->p_first = p_buffer->p_next;
if ( p_fifo->p_first == NULL )
{
p_fifo->pp_last = &p_fifo->p_first;
}
vlc_mutex_unlock( &p_fifo->lock );
return p_buffer;
}
static inline void aout_FifoDestroy( struct aout_instance_t * p_aout,
aout_fifo_t * p_fifo )
{
aout_buffer_t * p_buffer;
vlc_mutex_destroy( &p_fifo->lock );
p_buffer = p_fifo->p_first;
while ( p_buffer != NULL )
{
aout_buffer_t * p_next = p_buffer->p_next;
aout_BufferFree( p_buffer );
p_buffer = p_next;
}
}
/*****************************************************************************
* aout_filter_t : audio output filter
*****************************************************************************/
typedef struct aout_filter_t
{
VLC_COMMON_MEMBERS
audio_sample_format_t input;
audio_sample_format_t output;
aout_alloc_t output_alloc;
module_t * p_module;
struct aout_filter_sys_t * p_sys;
void (* pf_do_work)( struct aout_instance_t *,
struct aout_filter_t *,
struct aout_buffer_t *,
struct aout_buffer_t * );
vlc_bool_t b_in_place;
} aout_filter_t;
/*****************************************************************************
* aout_mixer_t : audio output mixer
*****************************************************************************/
typedef struct aout_mixer_t
{
audio_sample_format_t input;
audio_sample_format_t output;
aout_alloc_t output_alloc;
module_t * p_module;
struct aout_mixer_sys_t * p_sys;
void (* pf_do_work)( struct aout_instance_t *,
struct aout_buffer_t * );
} aout_mixer_t;
/*****************************************************************************
* aout_input_t : input stream for the audio output
*****************************************************************************/
struct aout_input_t
{
audio_sample_format_t input;
aout_alloc_t input_alloc;
/* pre-filters */
aout_filter_t * pp_filters[AOUT_MAX_FILTERS];
int i_nb_filters;
aout_fifo_t fifo;
char * p_first_byte_to_mix;
};
/*****************************************************************************
* aout_output_t : output stream for the audio output
*****************************************************************************/
typedef struct aout_output_t
{
audio_sample_format_t output;
/* post-filters */
aout_filter_t * pp_filters[AOUT_MAX_FILTERS];
int i_nb_filters;
aout_fifo_t fifo;
mtime_t last_date;
struct module_t * p_module;
struct aout_sys_t * p_sys;
int (* pf_setformat)( aout_instance_t * );
void (* pf_play)( aout_instance_t *, aout_buffer_t * );
int i_nb_samples;
} aout_output_t;
/*****************************************************************************
* aout_instance_t : audio output thread descriptor
*****************************************************************************/
struct aout_instance_t
{
VLC_COMMON_MEMBERS
/* Input streams & pre-filters */
vlc_mutex_t input_lock;
vlc_cond_t input_signal;
int i_inputs_active;
vlc_bool_t b_change_requested;
aout_input_t * pp_inputs[AOUT_MAX_INPUTS];
int i_nb_inputs;
/* Mixer */
vlc_mutex_t mixer_lock;
vlc_cond_t mixer_signal;
vlc_bool_t b_mixer_active;
aout_mixer_t mixer;
/* Output plug-in */
aout_output_t output;
};
/*****************************************************************************
* Prototypes
*****************************************************************************/
void aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer );
int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int * pi_nb_filters,
audio_sample_format_t * p_input_format,
audio_sample_format_t * p_output_format );
void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters );
void aout_FiltersHintBuffers( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_alloc_t * p_first_alloc );
void aout_FiltersPlay( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_buffer_t ** pp_input_buffer );
int aout_MixerNew( aout_instance_t * p_aout );
void aout_MixerDelete( aout_instance_t * p_aout );
void aout_MixerRun( aout_instance_t * p_aout );
int aout_OutputNew( aout_instance_t * p_aout,
audio_sample_format_t * p_format );
void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer );
void aout_OutputDelete( aout_instance_t * p_aout );
int aout_FormatToBytes( audio_sample_format_t * p_format );
/***************************************************************************** /*****************************************************************************
* audio_output.h : audio output thread interface * audio_output.h : audio output interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.51 2002/08/04 17:23:41 sam Exp $ * $Id: audio_output.h,v 1.52 2002/08/07 21:36:55 massiot Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -23,168 +22,74 @@ ...@@ -23,168 +22,74 @@
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* aout_increment_t * audio_sample_format_t
***************************************************************************** *****************************************************************************
* This structure is used to keep the progression of an index up-to-date, in * This structure defines a format for audio samples.
* order to avoid rounding problems and heavy computations, as the function
* that handles this structure only uses additions.
*****************************************************************************/ *****************************************************************************/
typedef struct aout_increment_t struct audio_sample_format_t
{ {
/* The remainder is used to keep track of the fractional part of the
* index. */
int i_r;
/*
* The increment structure is initialized with the result of an euclidean
* division :
*
* i_x i_b
* ----- = i_a + -----
* i_y i_c
*
*/
int i_a, i_b, i_c;
} aout_increment_t;
/*****************************************************************************
* aout_fifo_t
*****************************************************************************/
struct aout_fifo_t
{
/* See the fifo formats below */
int i_format; int i_format;
int i_channels;
int i_rate; int i_rate;
int i_frame_size;
vlc_bool_t b_die;
int i_fifo; /* Just to keep track of the fifo index */
vlc_mutex_t data_lock;
vlc_cond_t data_wait;
u8 * buffer;
mtime_t * date;
/* The start frame is the first frame in the buffer that contains decoded
* audio data. It it also the first frame in the current timestamped frame
* area, ie the first dated frame in the decoded part of the buffer. :-p */
int i_start_frame;
vlc_bool_t b_start_frame;
/* The next frame is the end frame of the current timestamped frame area,
* ie the first dated frame after the start frame. */
int i_next_frame;
vlc_bool_t b_next_frame;
/* The end frame is the first frame, after the start frame, that doesn't
* contain decoded audio data. That's why the end frame is the first frame
* where the audio decoder can store its decoded audio frames. */
int i_end_frame;
/* Current index in p_aout->buffer */
int i_unit;
/* Max index in p_aout->buffer */
int i_unit_limit;
/* Structure used to calculate i_unit with a Bresenham algorithm */
aout_increment_t unit_increment;
/* The following variable is used to store the number of remaining audio
* units in the current timestamped frame area. */
int i_units;
};
#define AOUT_FIFO_ISEMPTY( fifo ) \
( (fifo).i_end_frame == (fifo).i_start_frame )
#define AOUT_FIFO_ISFULL( fifo ) \
( ((((fifo).i_end_frame + 1) - (fifo).i_start_frame) & AOUT_FIFO_SIZE) == 0 )
#define AOUT_FIFO_INC( i_index ) \
( ((i_index) + 1) & AOUT_FIFO_SIZE )
/* List of known fifo formats */
#define AOUT_FIFO_NONE 0
#define AOUT_FIFO_PCM 1
#define AOUT_FIFO_SPDIF 2
/*****************************************************************************
* aout_thread_t : audio output thread descriptor
*****************************************************************************/
struct aout_thread_t
{
VLC_COMMON_MEMBERS
vlc_mutex_t fifos_lock;
aout_fifo_t fifo[ AOUT_MAX_FIFOS ];
/* Plugin used and shortcuts to access its capabilities */
module_t * p_module;
int ( *pf_setformat ) ( aout_thread_t * );
int ( *pf_getbufinfo ) ( aout_thread_t * , int );
void ( *pf_play ) ( aout_thread_t * , byte_t *, int );
void * buffer;
/* The s32 buffer is used to mix all the audio fifos together before
* converting them and storing them in the audio output buffer */
s32 * s32_buffer;
/* The size of the audio output buffer is kept in audio units, as this is
* the only unit that is common with every audio decoder and audio fifo */
int i_units;
/* date is the moment where the first audio unit of the output buffer
* will be played */
mtime_t date;
/* The current volume */
int i_volume;
int i_savedvolume;
/* Format of the audio output samples, number of channels, and
* rate and gain (in Hz) of the audio output sound */
int i_format;
int i_channels; int i_channels;
int i_rate;
/* Latency of the audio output plugin, in bytes */
int i_latency;
/* there might be some useful private structure, such as audio_buf_info
* for the OSS output */
aout_sys_t * p_sys;
}; };
/* Those are from <linux/soundcard.h> but are needed because of formats #define AOUT_FMT_MU_LAW 0x00000001
* on other platforms */ #define AOUT_FMT_A_LAW 0x00000002
#define AOUT_FMT_U8 0x00000008 #define AOUT_FMT_IMA_ADPCM 0x00000004
#define AOUT_FMT_S16_LE 0x00000010 /* Little endian signed 16 */ #define AOUT_FMT_U8 0x00000008
#define AOUT_FMT_S16_BE 0x00000020 /* Big endian signed 16 */ #define AOUT_FMT_S16_LE 0x00000010 /* Little endian signed 16 */
#define AOUT_FMT_S8 0x00000040 #define AOUT_FMT_S16_BE 0x00000020 /* Big endian signed 16 */
#define AOUT_FMT_U16_LE 0x00000080 /* Little endian U16 */ #define AOUT_FMT_S8 0x00000040
#define AOUT_FMT_U16_BE 0x00000100 /* Big endian U16 */ #define AOUT_FMT_U16_LE 0x00000080 /* Little endian U16 */
#define AOUT_FMT_A52 0x00000400 /* Dolby Digital A52 */ #define AOUT_FMT_U16_BE 0x00000100 /* Big endian U16 */
#define AOUT_FMT_A52 0x00000400 /* ATSC A/52 (for SP/DIF) */
#define AOUT_FMT_FLOAT32 0x00000800
#define AOUT_FMT_FIXED32 0x00001000
#define AOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
(p_first->i_format == p_second->i_format) \
&& (p_first->i_rate == p_second->i_rate) \
&& (p_first->i_channels == p_second->i_channels \
|| p_first->i_channels == -1 || p_second->i_channels == -1) )
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define AOUT_FMT_S16_NE AOUT_FMT_S16_BE # define AOUT_FMT_S16_NE AOUT_FMT_S16_BE
# define AOUT_FMT_U16_NE AOUT_FMT_U16_BE
#else #else
#define AOUT_FMT_S16_NE AOUT_FMT_S16_LE # define AOUT_FMT_S16_NE AOUT_FMT_S16_LE
# define AOUT_FMT_U16_NE AOUT_FMT_U16_LE
#endif #endif
/* Number of samples in an A52 frame */ /*****************************************************************************
#define A52_FRAME_SIZE 1536 * aout_buffer_t : audio output buffer
*****************************************************************************/
struct aout_buffer_t
{
char * p_buffer;
int i_alloc_type;
size_t i_size;
int i_nb_samples;
mtime_t start_date, end_date;
/* Size of a frame for spdif output */ struct aout_buffer_t * p_next;
#define SPDIF_FRAME_SIZE 6144 };
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
aout_thread_t * aout_CreateThread ( vlc_object_t *, int, int ); /* From audio_output.c : */