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 source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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
......
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
* 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_IMA_ADPCM 0x00000004
#define AOUT_FMT_U8 0x00000008 #define AOUT_FMT_U8 0x00000008
#define AOUT_FMT_S16_LE 0x00000010 /* Little endian signed 16 */ #define AOUT_FMT_S16_LE 0x00000010 /* Little endian signed 16 */
#define AOUT_FMT_S16_BE 0x00000020 /* Big endian signed 16 */ #define AOUT_FMT_S16_BE 0x00000020 /* Big endian signed 16 */
#define AOUT_FMT_S8 0x00000040 #define AOUT_FMT_S8 0x00000040
#define AOUT_FMT_U16_LE 0x00000080 /* Little endian U16 */ #define AOUT_FMT_U16_LE 0x00000080 /* Little endian U16 */
#define AOUT_FMT_U16_BE 0x00000100 /* Big endian U16 */ #define AOUT_FMT_U16_BE 0x00000100 /* Big endian U16 */
#define AOUT_FMT_A52 0x00000400 /* Dolby Digital A52 */ #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 : */
void aout_DestroyThread ( aout_thread_t * ); #define aout_NewInstance(a) __aout_NewInstance(VLC_OBJECT(a))
VLC_EXPORT( aout_instance_t *, __aout_NewInstance, ( vlc_object_t * ) );
#define aout_CreateFifo(a,b,c,d,e,f) __aout_CreateFifo(VLC_OBJECT(a),b,c,d,e,f) VLC_EXPORT( void, aout_DeleteInstance, ( aout_instance_t * ) );
VLC_EXPORT( aout_fifo_t *, __aout_CreateFifo, ( vlc_object_t *, int, int, int, int, void * ) ); VLC_EXPORT( aout_buffer_t *, aout_BufferNew, ( aout_instance_t *, aout_input_t *, size_t ) );
VLC_EXPORT( void, aout_DestroyFifo, ( aout_fifo_t *p_fifo ) ); VLC_EXPORT( void, aout_BufferDelete, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
void aout_FreeFifo ( aout_fifo_t *p_fifo ); VLC_EXPORT( void, aout_BufferPlay, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
/* From input.c : */
#define aout_InputNew(a,b,c) __aout_InputNew(VLC_OBJECT(a),b,c)
VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) );
VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) );
/* From output.c : */
VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t ) );
...@@ -129,22 +129,11 @@ ...@@ -129,22 +129,11 @@
#define VOLUME_MAX 1024 #define VOLUME_MAX 1024
#define VOLUME_MIN 0 #define VOLUME_MIN 0
/* Number of audio output frames contained in an audio output fifo. /* Max number of pre-filters per input, and max-number of post-filters */
* (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the #define AOUT_MAX_FILTERS 10
* %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE.
* With 255 we have at least 255*384/2/48000=1 second of sound */ /* Max number of inputs */
#define AOUT_FIFO_SIZE 255 #define AOUT_MAX_INPUTS 5
/* Maximum number of audio fifos. The value of AOUT_MAX_FIFOS should be a power
* of two, in order to optimize the '/AOUT_MAX_FIFOS' and '*AOUT_MAX_FIFOS'
* operations with '>>' and '<<' (gcc changes this at compilation-time) */
#define AOUT_MAX_FIFOS 2
/* Duration (in microseconds) of an audio output buffer should be :
* - short, in order to be able to play a new song very quickly (especially a
* song from the interface)
* - long, in order to perform the buffer calculations as few as possible */
#define AOUT_BUFFER_DURATION 90000
/***************************************************************************** /*****************************************************************************
* Video configuration * Video configuration
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.14 2002/08/07 00:29:36 sam Exp $ * $Id: vlc_common.h,v 1.15 2002/08/07 21:36:55 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -173,9 +173,10 @@ VLC_DECLARE_STRUCT(stream_descriptor_t) ...@@ -173,9 +173,10 @@ VLC_DECLARE_STRUCT(stream_descriptor_t)
VLC_DECLARE_STRUCT(stream_sys_t) VLC_DECLARE_STRUCT(stream_sys_t)
/* Audio */ /* Audio */
VLC_DECLARE_STRUCT(aout_thread_t) VLC_DECLARE_STRUCT(aout_instance_t)
VLC_DECLARE_STRUCT(aout_sys_t) VLC_DECLARE_STRUCT(aout_input_t)
VLC_DECLARE_STRUCT(aout_fifo_t) VLC_DECLARE_STRUCT(aout_buffer_t)
VLC_DECLARE_STRUCT(audio_sample_format_t)
/* Video */ /* Video */
VLC_DECLARE_STRUCT(vout_thread_t) VLC_DECLARE_STRUCT(vout_thread_t)
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
struct module_symbols_t struct module_symbols_t
{ {
aout_fifo_t * (* __aout_CreateFifo_inner) ( vlc_object_t *, int, int, int, int, void * ) ; aout_buffer_t * (* aout_BufferNew_inner) ( aout_instance_t *, aout_input_t *, size_t ) ;
aout_buffer_t * (* aout_OutputNextBuffer_inner) ( aout_instance_t *, mtime_t ) ;
aout_input_t * (* __aout_InputNew_inner) ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) ;
aout_instance_t * (* __aout_NewInstance_inner) ( vlc_object_t * ) ;
char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ; char * (* __config_GetPsz_inner) (vlc_object_t *, const char *) ;
char * (* config_GetHomeDir_inner) ( void ) ; char * (* config_GetHomeDir_inner) ( void ) ;
char * (* input_OffsetToTime_inner) ( input_thread_t *, char *, off_t ) ; char * (* input_OffsetToTime_inner) ( input_thread_t *, char *, off_t ) ;
...@@ -95,7 +98,10 @@ struct module_symbols_t ...@@ -95,7 +98,10 @@ struct module_symbols_t
void (* __vlc_object_yield_inner) ( vlc_object_t * ) ; void (* __vlc_object_yield_inner) ( vlc_object_t * ) ;
void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ; void (* __vlc_thread_join_inner) ( vlc_object_t *, char *, int ) ;
void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ; void (* __vlc_thread_ready_inner) ( vlc_object_t * ) ;
void (* aout_DestroyFifo_inner) ( aout_fifo_t *p_fifo ) ; void (* aout_BufferDelete_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
void (* aout_BufferPlay_inner) ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) ;
void (* aout_DeleteInstance_inner) ( aout_instance_t * ) ;
void (* aout_InputDelete_inner) ( aout_instance_t *, aout_input_t * ) ;
void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ; void (* config_Duplicate_inner) ( module_t *, module_config_t * ) ;
void (* config_SetCallbacks_inner) ( module_config_t *, module_config_t * ) ; void (* config_SetCallbacks_inner) ( module_config_t *, module_config_t * ) ;
void (* config_UnsetCallbacks_inner) ( module_config_t * ) ; void (* config_UnsetCallbacks_inner) ( module_config_t * ) ;
...@@ -146,7 +152,8 @@ struct module_symbols_t ...@@ -146,7 +152,8 @@ struct module_symbols_t
# define UnalignedGetBits p_symbols->UnalignedGetBits_inner # define UnalignedGetBits p_symbols->UnalignedGetBits_inner
# define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner # define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner
# define UnalignedShowBits p_symbols->UnalignedShowBits_inner # define UnalignedShowBits p_symbols->UnalignedShowBits_inner
# define __aout_CreateFifo p_symbols->__aout_CreateFifo_inner # define __aout_InputNew p_symbols->__aout_InputNew_inner
# define __aout_NewInstance p_symbols->__aout_NewInstance_inner
# define __config_GetFloat p_symbols->__config_GetFloat_inner # define __config_GetFloat p_symbols->__config_GetFloat_inner
# define __config_GetInt p_symbols->__config_GetInt_inner # define __config_GetInt p_symbols->__config_GetInt_inner
# define __config_GetPsz p_symbols->__config_GetPsz_inner # define __config_GetPsz p_symbols->__config_GetPsz_inner
...@@ -193,7 +200,12 @@ struct module_symbols_t ...@@ -193,7 +200,12 @@ struct module_symbols_t
# define __vlc_threads_end p_symbols->__vlc_threads_end_inner # define __vlc_threads_end p_symbols->__vlc_threads_end_inner
# define __vlc_threads_init p_symbols->__vlc_threads_init_inner # define __vlc_threads_init p_symbols->__vlc_threads_init_inner
# define __vout_CreateThread p_symbols->__vout_CreateThread_inner # define __vout_CreateThread p_symbols->__vout_CreateThread_inner
# define aout_DestroyFifo p_symbols->aout_DestroyFifo_inner # define aout_BufferDelete p_symbols->aout_BufferDelete_inner
# define aout_BufferNew p_symbols->aout_BufferNew_inner
# define aout_BufferPlay p_symbols->aout_BufferPlay_inner
# define aout_DeleteInstance p_symbols->aout_DeleteInstance_inner
# define aout_InputDelete p_symbols->aout_InputDelete_inner
# define aout_OutputNextBuffer p_symbols->aout_OutputNextBuffer_inner
# define config_Duplicate p_symbols->config_Duplicate_inner # define config_Duplicate p_symbols->config_Duplicate_inner
# define config_FindConfig p_symbols->config_FindConfig_inner # define config_FindConfig p_symbols->config_FindConfig_inner
# define config_GetHomeDir p_symbols->config_GetHomeDir_inner # define config_GetHomeDir p_symbols->config_GetHomeDir_inner
......
float32tos16_SOURCES = float32tos16.c
/*****************************************************************************
* float32tos16.c : trivial mixer plug-in (1 input, no downmixing)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: float32tos16.c,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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include "audio_output.h"
#include "aout_internal.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Create ( vlc_object_t * );
static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
aout_buffer_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("aout filter for float32->s16 conversion") );
set_capability( "audio filter", 1 );
set_callbacks( Create, NULL );
vlc_module_end();
/*****************************************************************************
* Create: allocate trivial mixer
*****************************************************************************
* This function allocates and initializes a Crop vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_format != AOUT_FMT_FLOAT32
&& p_filter->output.i_format != AOUT_FMT_S16_NE )
{
return -1;
}
if ( p_filter->input.i_rate != p_filter->output.i_rate
|| p_filter->input.i_channels != p_filter->output.i_channels )
{
return -1;
}
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = 1;
return 0;
}
/*****************************************************************************
* DoWork: convert a buffer
*****************************************************************************/
static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
int i;
float * p_in = (float *)p_in_buf->p_buffer;
s16 * p_out = (s16 *)p_out_buf->p_buffer;
for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ )
{
if ( *p_in >= 1.0 ) *p_out = 32767;
else if ( *p_in < -1.0 ) *p_out = -32768;
else *p_out = *p_in * 32768.0;
p_in++; p_out++;
}
}
trivial_SOURCES = trivial.c
/*****************************************************************************
* trivial.c : trivial mixer plug-in (1 input, no downmixing)
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: trivial.c,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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include "audio_output.h"
#include "aout_internal.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Create ( vlc_object_t * );
static void DoWork ( aout_instance_t *, aout_buffer_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("trivial aout mixer module") );
set_capability( "audio mixer", 1 );
add_shortcut( "trivial" );
set_callbacks( Create, NULL );
vlc_module_end();
/*****************************************************************************
* Create: allocate trivial mixer
*****************************************************************************
* This function allocates and initializes a Crop vout method.
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
aout_instance_t * p_aout = (aout_instance_t *)p_this;
if ( p_aout->mixer.output.i_format != AOUT_FMT_FLOAT32
&& p_aout->mixer.output.i_format != AOUT_FMT_FIXED32 )
{
return -1;
}
p_aout->mixer.pf_do_work = DoWork;
return 0;
}
/*****************************************************************************
* SparseCopy: trivially downmix or upmix a buffer
*****************************************************************************/
static void SparseCopy( u32 * p_dest, const u32 * p_src, size_t i_len,
int i_output_stride, int i_input_stride )
{
int i;
for ( i = 0; i < i_len; i++ )
{
int j;
for ( j = 0; j < i_output_stride; j++ )
{
p_dest[j] = p_src[j];
}
p_src += i_input_stride;
p_dest += i_output_stride;
}
}
/*****************************************************************************
* DoWork: mix a new output buffer
*****************************************************************************/
static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
{
aout_input_t * p_input = p_aout->pp_inputs[0];
if ( p_input->input.i_channels == p_aout->mixer.output.i_channels )
{
int i_nb_bytes = p_buffer->i_nb_samples * sizeof(u32)
* p_input->input.i_channels;
char * p_in = (p_input->p_first_byte_to_mix == NULL) ?
p_input->fifo.p_first->p_buffer :
p_input->p_first_byte_to_mix;
char * p_out = p_buffer->p_buffer;
for ( ; ; )
{
ptrdiff_t i_available_bytes = (p_input->fifo.p_first->p_buffer
- p_in)
+ p_input->fifo.p_first->i_nb_samples
* sizeof(u32)
* p_input->input.i_channels;
if ( i_available_bytes < i_nb_bytes )
{
aout_buffer_t * p_old_buffer;
if ( i_available_bytes > 0 )
p_aout->p_vlc->pf_memcpy( p_out, p_in, i_available_bytes );
i_nb_bytes -= i_available_bytes;
p_out += i_available_bytes;
/* Next buffer */
p_old_buffer = aout_FifoPop( p_aout, &p_input->fifo );
aout_BufferFree( p_old_buffer );
if ( p_input->fifo.p_first == NULL )
{
msg_Err( p_aout, "internal amix error" );
return;
}
p_in = p_input->fifo.p_first->p_buffer;
}
else
{
p_aout->p_vlc->pf_memcpy( p_out, p_in, i_nb_bytes );
p_input->p_first_byte_to_mix = p_in + i_nb_bytes;
break;
}
}
}
else
{
/* Downmixing or upmixing. */
int i_nb_samples = p_buffer->i_nb_samples;
u32 * p_in = (p_input->p_first_byte_to_mix == NULL) ?
(u32 *)p_input->fifo.p_first->p_buffer :
(u32 *)p_input->p_first_byte_to_mix;
u32 * p_out = (u32 *)p_buffer->p_buffer;
if ( p_input->input.i_channels < p_aout->mixer.output.i_channels )
{
/* Zero out the destination buffer, to avoid static on unavailable
* channels. */
memset( p_buffer->p_buffer, 0,
p_buffer->i_nb_samples * sizeof(u32)
* p_aout->mixer.output.i_channels );
}
for ( ; ; )
{
ptrdiff_t i_available_bytes = (p_input->fifo.p_first->p_buffer
- (char *)p_in)
+ p_input->fifo.p_first->i_nb_samples
* sizeof(u32)
* p_input->input.i_channels;
int i_available_samples = i_available_bytes
/ p_input->input.i_channels
/ sizeof(u32);
if ( i_available_samples < i_nb_samples )
{
aout_buffer_t * p_old_buffer;
if ( i_available_samples > 0 )
SparseCopy( p_out, p_in, i_available_samples,
p_aout->mixer.output.i_channels,
p_input->input.i_channels );
i_nb_samples -= i_available_samples;
p_out += i_available_samples * p_aout->mixer.output.i_channels;
/* Next buffer */
p_old_buffer = aout_FifoPop( p_aout, &p_input->fifo );
aout_BufferFree( p_old_buffer );
if ( p_input->fifo.p_first == NULL )
{
msg_Err( p_aout, "internal amix error" );
return;
}
p_in = (u32 *)p_input->fifo.p_first->p_buffer;
}
else
{
SparseCopy( p_out, p_in, i_nb_samples,
p_aout->mixer.output.i_channels,
p_input->input.i_channels );
p_input->p_first_byte_to_mix = (char *)p_in
+ i_nb_samples * p_input->input.i_channels
* sizeof(u32);
break;
}
}
}
}
alsa_SOURCES = alsa.c
arts_SOURCES = arts.c
esd_SOURCES = esd.c
file_SOURCES = file.c
oss_SOURCES = oss.c
waveout_SOURCES = waveout.c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc * alsa.c : alsa plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: alsa.c,v 1.1 2002/08/04 17:23:42 sam Exp $ * $Id: alsa.c,v 1.1 2002/08/07 21:36:55 massiot Exp $
* *
* Authors: Henri Fallon <henri@videolan.org> - Original Author * Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API * Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* esd.c : EsounD module * esd.c : EsounD module
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: esd.c,v 1.1 2002/08/04 17:23:42 sam Exp $ * $Id: esd.c,v 1.1 2002/08/07 21:36:55 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
......
/*****************************************************************************
* file.c : audio output which writes the samples to a file
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: file.c,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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <string.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include "aout_internal.h"
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int SetFormat ( aout_instance_t * );
static void Play ( aout_instance_t *, aout_buffer_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define FORMAT_TEXT N_("Output format")
#define FORMAT_LONGTEXT N_("one of \"u8\", \"s8\", \"u16\", \"s16\"," \
" \"u16_le\", \"s16_le\", \"u16_be\"," \
" \"s16_be\", \"fixed32\", \"float32\" or \"spdif\"")
static char *format_list[] = { "u8", "s8", "u16", "s16", "u16_le", "s16_le",
"u16_be", "s16_be", "fixed32", "float32",
"spdif", NULL };
static int format_int[] = { AOUT_FMT_U8, AOUT_FMT_S8, AOUT_FMT_U16_NE,
AOUT_FMT_S16_NE, AOUT_FMT_U16_LE, AOUT_FMT_S16_LE,
AOUT_FMT_U16_BE, AOUT_FMT_S16_BE, AOUT_FMT_FIXED32,
AOUT_FMT_FLOAT32, AOUT_FMT_A52 };
#define PATH_TEXT N_("Path of the output file")
#define PATH_LONGTEXT N_("By default samples.raw")
vlc_module_begin();
add_category_hint( N_("Audio"), NULL );
add_string_from_list( "format", "s16", format_list, NULL,
FORMAT_TEXT, FORMAT_LONGTEXT );
add_string( "path", "samples.raw", NULL, PATH_TEXT, PATH_LONGTEXT );
set_description( _("file output module") );
set_capability( "audio output", 0 );
add_shortcut( "file" );
set_callbacks( Open, Close );
vlc_module_end();
/*****************************************************************************
* Open: open a dummy audio device
*****************************************************************************/
static int Open( vlc_object_t * p_this )
{
aout_instance_t * p_aout = (aout_instance_t *)p_this;
FILE * p_file;
char * psz_name = config_GetPsz( p_this, "path" );
(FILE *)p_aout->output.p_sys = p_file = fopen( psz_name, "wb" );
free( psz_name );
if ( p_file == NULL ) return -1;
p_aout->output.pf_setformat = SetFormat;
p_aout->output.pf_play = Play;
return VLC_SUCCESS;
}
/*****************************************************************************
* Close: close our file
*****************************************************************************/
static void Close( vlc_object_t * p_this )
{
aout_instance_t * p_aout = (aout_instance_t *)p_this;
fclose( (FILE *)p_aout->output.p_sys );
}
/*****************************************************************************
* SetFormat: pretend to set the dsp output format
*****************************************************************************/
static int SetFormat( aout_instance_t * p_aout )
{
char * psz_format = config_GetPsz( p_aout, "format" );
char ** ppsz_compare = format_list;
int i = 0;
while ( *ppsz_compare != NULL )
{
if ( !strncmp( *ppsz_compare, psz_format, strlen(*ppsz_compare) ) )
{
break;
}
ppsz_compare++; i++;
}
if ( *ppsz_compare == NULL )
{
msg_Err( p_aout, "Cannot understand the format string (%s)",
psz_format );
return -1;
}
p_aout->output.output.i_format = format_int[i];
p_aout->output.i_nb_samples = 2048;
return 0;
}
/*****************************************************************************
* Play: pretend to play a sound
*****************************************************************************/
static void Play( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
{
if( fwrite( p_buffer->p_buffer,
p_buffer->i_nb_samples
* aout_FormatToBytes( &p_aout->output.output ), 1,
(FILE *)p_aout->output.p_sys ) != 1 )
{
msg_Err( p_aout, "write error (%s)", strerror(errno) );
}
aout_BufferFree( p_buffer );
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* waveout.c : Windows waveOut plugin for vlc * waveout.c : Windows waveOut plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: waveout.c,v 1.1 2002/08/04 17:23:42 sam Exp $ * $Id: waveout.c,v 1.1 2002/08/07 21:36:55 massiot Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (http://liba52.sf.net/). * (http://liba52.sf.net/).
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: a52.h,v 1.1 2002/08/04 17:23:42 sam Exp $ * $Id: a52.h,v 1.2 2002/08/07 21:36:56 massiot Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -24,18 +24,14 @@ ...@@ -24,18 +24,14 @@
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
* a52_adec_thread_t : a52 decoder thread descriptor * a52_thread_t : a52 decoder thread descriptor
*****************************************************************************/ *****************************************************************************/
typedef struct a52_adec_thread_s typedef struct a52_thread_s
{ {
/* /*
* liba52 properties * liba52 properties
*/ */
a52_state_t *p_a52_state; a52_state_t * p_a52_state;
int frame_size;
int flags;
int sample_rate;
int bit_rate;
vlc_bool_t b_dynrng; vlc_bool_t b_dynrng;
/* The bit stream structure handles the PES stream at the bit level */ /* The bit stream structure handles the PES stream at the bit level */
...@@ -44,16 +40,14 @@ typedef struct a52_adec_thread_s ...@@ -44,16 +40,14 @@ typedef struct a52_adec_thread_s
/* /*
* Input properties * Input properties
*/ */
decoder_fifo_t *p_fifo; /* stores the PES stream data */ decoder_fifo_t * p_fifo; /* stores the PES stream data */
data_packet_t *p_data; data_packet_t * p_data;
/* /*
* Output properties * Output properties
*/ */
aout_fifo_t *p_aout_fifo; /* stores the decompressed audio frames */ aout_instance_t * p_aout; /* opaque */
int i_channels; aout_input_t * p_aout_input; /* opaque */
audio_sample_format_t output_format;
/* temporary buffer to store the raw frame to be decoded */ mtime_t last_date;
u8 p_frame_buffer[3840]; } a52_thread_t;
} a52_adec_thread_t;
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.m: MacOS X video output plugin * vout.m: MacOS X video output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: vout.m,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: vout.m,v 1.2 2002/08/07 21:36:56 massiot Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -58,7 +58,6 @@ struct picture_sys_t ...@@ -58,7 +58,6 @@ struct picture_sys_t
static int vout_Init ( vout_thread_t * ); static int vout_Init ( vout_thread_t * );
static void vout_End ( vout_thread_t * ); static void vout_End ( vout_thread_t * );
static int vout_Manage ( vout_thread_t * ); static int vout_Manage ( vout_thread_t * );
static void vout_Render ( vout_thread_t *, picture_t * );
static void vout_Display ( vout_thread_t *, picture_t * ); static void vout_Display ( vout_thread_t *, picture_t * );
static int CoSendRequest ( vout_thread_t *, long ); static int CoSendRequest ( vout_thread_t *, long );
...@@ -719,6 +718,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -719,6 +718,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
switch( key ) switch( key )
{ {
#if 0
case (unichar)0xf700: /* up-arrow */ case (unichar)0xf700: /* up-arrow */
{ {
aout_thread_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT, aout_thread_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
...@@ -750,6 +750,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -750,6 +750,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
} }
} }
break; break;
#endif
case 'f': case 'F': case 'f': case 'F':
[self toggleFullscreen]; [self toggleFullscreen];
......
/***************************************************************************** /*****************************************************************************
* aout_dummy.c : dummy audio output plugin * aout_dummy.c : dummy audio output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: aout.c,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: aout.c,v 1.2 2002/08/07 21:36:56 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Christophe Massiot <massiot@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
...@@ -25,52 +25,46 @@ ...@@ -25,52 +25,46 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/aout.h> #include <vlc/aout.h>
#include "aout_internal.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
static int SetFormat ( aout_thread_t * ); static int SetFormat ( aout_instance_t * );
static int GetBufInfo ( aout_thread_t *, int ); static void Play ( aout_instance_t *, aout_buffer_t * );
static void Play ( aout_thread_t *, byte_t *, int );
/***************************************************************************** /*****************************************************************************
* OpenAudio: opens a dummy audio device * OpenAudio: open a dummy audio device
*****************************************************************************/ *****************************************************************************/
int E_(OpenAudio) ( vlc_object_t *p_this ) int E_(OpenAudio) ( vlc_object_t * p_this )
{ {
aout_thread_t * p_aout = (aout_thread_t *)p_this; aout_instance_t * p_aout = (aout_instance_t *)p_this;
p_aout->pf_setformat = SetFormat; p_aout->output.pf_setformat = SetFormat;
p_aout->pf_getbufinfo = GetBufInfo; p_aout->output.pf_play = Play;
p_aout->pf_play = Play;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
* SetFormat: pretends to set the dsp output format * SetFormat: pretend to set the dsp output format
*****************************************************************************/
static int SetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* GetBufInfo: returns available bytes in buffer
*****************************************************************************/ *****************************************************************************/
static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) static int SetFormat( aout_instance_t * p_aout )
{ {
return( sizeof(s16) * i_buffer_limit + 1 ); /* value big enough to sleep */ p_aout->output.i_nb_samples = 2048;
return 0;
} }
/***************************************************************************** /*****************************************************************************
* Play: pretends to play a sound * Play: pretend to play a sound
*****************************************************************************/ *****************************************************************************/
static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) static void Play( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
{ {
; aout_BufferFree( p_buffer );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dummy.c : dummy plugin for vlc * dummy.c : dummy plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: dummy.c,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: dummy.c,v 1.2 2002/08/07 21:36:56 massiot Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -56,10 +56,10 @@ vlc_module_begin(); ...@@ -56,10 +56,10 @@ vlc_module_begin();
set_capability( "decoder", 0 ); set_capability( "decoder", 0 );
set_callbacks( E_(OpenDecoder), NULL ); set_callbacks( E_(OpenDecoder), NULL );
add_submodule(); add_submodule();
set_capability( "audio output", 0 ); set_capability( "audio output", 1 );
set_callbacks( E_(OpenAudio), NULL ); set_callbacks( E_(OpenAudio), NULL );
add_submodule(); add_submodule();
set_capability( "video output", 0 ); set_capability( "video output", 1 );
set_callbacks( E_(OpenVideo), NULL ); set_callbacks( E_(OpenVideo), NULL );
add_category_hint( N_("Video"), NULL ); add_category_hint( N_("Video"), NULL );
add_string( "dummy-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT ); add_string( "dummy-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT );
......
This diff is collapsed.
/*****************************************************************************
* aout_ext-dec.c : exported fifo management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: aout_ext-dec.c,v 1.18 2002/06/02 09:03:54 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
#include "audio_output.h"
/*****************************************************************************
* aout_CreateFifo
*****************************************************************************/
aout_fifo_t * __aout_CreateFifo( vlc_object_t *p_this, int i_format,
int i_channels, int i_rate, int i_frame_size,
void *p_buffer )
{
aout_thread_t *p_aout;
aout_fifo_t *p_fifo = NULL;
int i_index;
/* Spawn an audio output if there is none */
p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout )
{
if( p_aout->fifo[0].i_format != i_format )
{
msg_Dbg( p_this, "changing aout type" );
vlc_object_detach_all( p_aout );
vlc_object_release( p_aout );
aout_DestroyThread( p_aout );
p_aout = NULL;
}
}
if( p_aout == NULL )
{
msg_Dbg( p_this, "no aout present, spawning one" );
p_aout = aout_CreateThread( p_this, i_channels, i_rate );
/* Everything failed */
if( p_aout == NULL )
{
return NULL;
}
}
/* temporary hack to switch output type (mainly for spdif)
* FIXME: to be adapted when several output are available */
/* Take the fifos lock */
vlc_mutex_lock( &p_aout->fifos_lock );
/* Look for a free fifo structure */
for( i_index = 0; i_index < AOUT_MAX_FIFOS; i_index++ )
{
if( p_aout->fifo[i_index].i_format == AOUT_FIFO_NONE )
{
p_fifo = &p_aout->fifo[i_index];
p_fifo->i_fifo = i_index;
break;
}
}
if( p_fifo == NULL )
{
msg_Err( p_aout, "no fifo available" );
vlc_mutex_unlock( &p_aout->fifos_lock );
return NULL;
}
/* Initialize the new fifo structure */
switch ( p_fifo->i_format = i_format )
{
case AOUT_FIFO_PCM:
case AOUT_FIFO_SPDIF:
p_fifo->b_die = 0;
p_fifo->i_channels = i_channels;
p_fifo->i_rate = i_rate;
p_fifo->i_frame_size = i_frame_size;
p_fifo->i_unit_limit = (AOUT_FIFO_SIZE + 1)
* (i_frame_size / i_channels);
/* Allocate the memory needed to store the audio frames and their
* dates. As the fifo is a rotative fifo, we must be able to find
* out whether the fifo is full or empty, that's why we must in
* fact allocate memory for (AOUT_FIFO_SIZE+1) audio frames. */
p_fifo->date = malloc( ( sizeof(s16) * i_frame_size
+ sizeof(mtime_t) )
* ( AOUT_FIFO_SIZE + 1 ) );
if ( p_fifo->date == NULL )
{
msg_Err( p_aout, "out of memory" );
p_fifo->i_format = AOUT_FIFO_NONE;
vlc_mutex_unlock( &p_aout->fifos_lock );
return NULL;
}
p_fifo->buffer = (u8 *)p_fifo->date + sizeof(mtime_t)
* ( AOUT_FIFO_SIZE + 1 );
/* Set the fifo's buffer as empty (the first frame that is to be
* played is also the first frame that is not to be played) */
p_fifo->i_start_frame = 0;
/* p_fifo->i_next_frame = 0; */
p_fifo->i_end_frame = 0;
/* Waiting for the audio decoder to compute enough frames to work
* out the fifo's current rate (as soon as the decoder has decoded
* enough frames, the members of the fifo structure that are not
* initialized now will be calculated) */
p_fifo->b_start_frame = 0;
p_fifo->b_next_frame = 0;
break;
default:
msg_Err( p_aout, "unknown fifo type 0x%x", p_fifo->i_format );
p_fifo->i_format = AOUT_FIFO_NONE;
vlc_mutex_unlock( &p_aout->fifos_lock );
return NULL;
}
/* Release the fifos lock */
vlc_mutex_unlock( &p_aout->fifos_lock );
msg_Dbg( p_aout, "fifo #%i allocated, %i channels, rate %li, "
"frame size %i", p_fifo->i_fifo, p_fifo->i_channels,
p_fifo->i_rate, p_fifo->i_frame_size );
/* Return the pointer to the fifo structure */
return p_fifo;
}
/*****************************************************************************
* aout_DestroyFifo
*****************************************************************************/
void aout_DestroyFifo( aout_fifo_t * p_fifo )
{
//X intf_Warn( p_fifo, 2, "fifo #%i destroyed", p_fifo->i_fifo );
vlc_mutex_lock( &p_fifo->data_lock );
p_fifo->b_die = 1;
vlc_mutex_unlock( &p_fifo->data_lock );
}
/*****************************************************************************
* aout_FreeFifo
*****************************************************************************/
void aout_FreeFifo( aout_fifo_t * p_fifo )
{
switch ( p_fifo->i_format )
{
case AOUT_FIFO_NONE:
break;
case AOUT_FIFO_PCM:
case AOUT_FIFO_SPDIF:
free( p_fifo->date );
p_fifo->i_format = AOUT_FIFO_NONE;
break;
default:
break;
}
}
This diff is collapsed.
/*****************************************************************************
* aout_pcm.h: PCM audio output functions
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: aout_pcm.h,v 1.1 2002/02/24 22:06:50 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Cyril Deguet <asmax@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.
*****************************************************************************/
void aout_PCMThread( aout_thread_t * p_aout );
/*****************************************************************************
* aout_spdif.c: A52 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.30 2002/08/04 17:23:44 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <string.h> /* memset() */
#include <vlc/vlc.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "audio_output.h"
#include "aout_spdif.h"
/****************************************************************************
* iec958_build_burst: builds an iec958/spdif frame
****************************************************************************/
void iec958_build_burst( u8 * p_buf, aout_fifo_t * p_fifo )
{
const u8 p_sync[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 };
int i_length = p_fifo->i_frame_size;
#ifndef HAVE_SWAB
/* Skip the first byte if i_length is odd */
u16 * p_in = (u16 *)( p_fifo->buffer + ( i_length & 0x1 ) );
u16 * p_out = (u16 *)p_buf;
#endif
/* Add the spdif headers */
memcpy( p_buf, p_sync, 6 );
p_buf[6] = ( i_length * 8 ) & 0xFF;
p_buf[7] = ( ( i_length * 8 ) >> 8 ) & 0xFF;
#ifdef HAVE_SWAB
swab( p_fifo->buffer + p_fifo->i_start_frame * i_length,
p_buf + 8, i_length );
#else
/* i_length should be even */
i_length &= ~0x1;
while( i_length )
{
*p_out = ( (*p_in & 0x00ff) << 16 ) | ( (*p_in & 0xff00) >> 16 );
p_in++;
p_out++;
i_length -= 2;
}
#endif
/* Add zeroes to complete the spdif frame,
* they will be ignored by the decoder */
memset( p_buf + 8 + i_length, 0, SPDIF_FRAME_SIZE - 8 - i_length );
}
/*****************************************************************************
* aout_SpdifThread: audio output thread that sends raw spdif data
* to an external decoder
*****************************************************************************
* This output thread is quite specific as it can only handle one fifo now.
*
* Note: spdif can demux up to 8 A52 streams, and can even take
* care of time stamps (cf A52 spec) but I'm not sure all decoders
* implement it.
*****************************************************************************/
void aout_SpdifThread( aout_thread_t * p_aout )
{
int i_fifo;
mtime_t m_frame_time = 0;
mtime_t m_play;
mtime_t m_old;
while( !p_aout->b_die )
{
i_fifo = 0;
/* Find spdif fifo */
while( ( p_aout->fifo[i_fifo].i_format != AOUT_FIFO_SPDIF ) &&
( i_fifo < AOUT_MAX_FIFOS ) && !p_aout->b_die )
{
i_fifo++;
}
m_old = 0;
while( !p_aout->b_die &&
!p_aout->fifo[i_fifo].b_die )
{
vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
if( !AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) )
{
/* Copy data from fifo to buffer to release the
* lock earlier */
iec958_build_burst( p_aout->buffer,
&p_aout->fifo[i_fifo] );
m_play = p_aout->fifo[i_fifo].date[p_aout->fifo[i_fifo].
i_start_frame];
p_aout->fifo[i_fifo].i_start_frame =
(p_aout->fifo[i_fifo].i_start_frame + 1 )
& AOUT_FIFO_SIZE;
/* Compute the theorical duration of an A52 frame */
m_frame_time = 1000000 * A52_FRAME_SIZE
/ p_aout->fifo[i_fifo].i_rate;
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
/* Play spdif frame to the external decoder
* the kernel driver will sleep until the
* dsp buffer is empty enough to accept the data */
if( m_play > ( mdate() - m_frame_time ) )
{
/* check continuity */
if( (m_play - m_old) != m_frame_time )
{
mwait( m_play - m_frame_time );
}
else
{
mwait( m_play - 2 * m_frame_time );
}
m_old = m_play;
p_aout->pf_getbufinfo( p_aout, 0 );
p_aout->pf_play( p_aout, (byte_t *)p_aout->buffer,
SPDIF_FRAME_SIZE );
}
}
else
{
msg_Warn( p_aout, "empty spdif fifo" );
while( AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) &&
!p_aout->b_die &&
!p_aout->fifo[i_fifo].b_die )
{
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
msleep( m_frame_time );
vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
}
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
}
}
vlc_mutex_lock( &p_aout->fifos_lock );
aout_FreeFifo( &p_aout->fifo[i_fifo] );
vlc_mutex_unlock( &p_aout->fifos_lock );
}
return;
}
/*****************************************************************************
* aout_spdif.h: A52 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.h,v 1.2 2002/08/04 17:23:44 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stéphane Borel <stef@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.
*****************************************************************************/
void aout_SpdifThread ( aout_thread_t * p_aout );
This diff is collapsed.
/*****************************************************************************
* filters.c : audio output filters management
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: filters.c,v 1.1 2002/08/07 21:36:56 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <string.h>
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include <vlc/vlc.h>
#include "audio_output.h"
#include "aout_internal.h"
/*****************************************************************************
* aout_FiltersCreatePipeline: create a filters pipeline to transform a sample
* format to another
*****************************************************************************
* TODO : allow the user to add/remove specific filters
*****************************************************************************/
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 )
{
if ( AOUT_FMTS_IDENTICAL( p_input_format, p_output_format ) )
{
msg_Dbg( p_aout, "no need for any filter" );
*pi_nb_filters = 0;
return 0;
}
pp_filters[0] = vlc_object_create( p_aout, sizeof(aout_filter_t) );
if ( pp_filters[0] == NULL )
{
return -1;
}
vlc_object_attach( pp_filters[0], p_aout );
/* Try to find a filter to do the whole conversion. */
memcpy( &pp_filters[0]->input, p_input_format,
sizeof(audio_sample_format_t) );
memcpy( &pp_filters[0]->output, p_output_format,
sizeof(audio_sample_format_t) );
pp_filters[0]->p_module = module_Need( pp_filters[0], "audio filter",
NULL );
if ( pp_filters[0]->p_module != NULL )
{
msg_Dbg( p_aout, "found a filter for the whole conversion" );
*pi_nb_filters = 1;
return 0;
}
/* Split the conversion : format | rate, or rate | format. */
pp_filters[0]->output.i_format = pp_filters[0]->input.i_format;
pp_filters[0]->p_module = module_Need( pp_filters[0], "audio filter",
NULL );
if ( pp_filters[0]->p_module == NULL )
{
/* Then, start with the format conversion. */
memcpy( &pp_filters[0]->output, p_output_format,
sizeof(audio_sample_format_t) );
pp_filters[0]->output.i_rate = pp_filters[0]->input.i_rate;
pp_filters[0]->p_module = module_Need( pp_filters[0], "audio filter",
NULL );
if ( pp_filters[0]->p_module == NULL )
{
msg_Err( p_aout, "couldn't find a filter for any conversion" );
vlc_object_detach_all( pp_filters[0] );
vlc_object_destroy( pp_filters[0] );
return -1;
}
}
/* Find a filter for the rest. */
pp_filters[1] = vlc_object_create( p_aout, sizeof(aout_filter_t) );
if ( pp_filters[1] == NULL )
{
vlc_object_detach_all( pp_filters[0] );
vlc_object_destroy( pp_filters[0] );
return -1;
}
vlc_object_attach( pp_filters[1], p_aout );
memcpy( &pp_filters[1]->input, &pp_filters[0]->output,
sizeof(audio_sample_format_t) );
memcpy( &pp_filters[1]->output, p_output_format,
sizeof(audio_sample_format_t) );
pp_filters[1]->p_module = module_Need( pp_filters[1], "audio filter",
NULL );
if ( pp_filters[1]->p_module == NULL )
{
msg_Err( p_aout,
"couldn't find a filter for the 2nd part of the conversion" );
vlc_object_detach_all( pp_filters[0] );
vlc_object_destroy( pp_filters[0] );
vlc_object_detach_all( pp_filters[1] );
vlc_object_destroy( pp_filters[1] );
return -1;
}
msg_Dbg( p_aout, "filter pipeline made of two filters" );
*pi_nb_filters = 2;
return 0;
}
/*****************************************************************************
* aout_FiltersDestroyPipeline: deallocate a filters pipeline
*****************************************************************************/
void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters )
{
int i;
for ( i = 0; i < i_nb_filters; i++ )
{
module_Unneed( pp_filters[i], pp_filters[i]->p_module );
vlc_object_detach_all( pp_filters[i] );
vlc_object_destroy( pp_filters[i] );
}
}
/*****************************************************************************
* aout_FiltersHintBuffers: fill in aout_alloc_t structures to optimize
* buffer allocations
*****************************************************************************/
void aout_FiltersHintBuffers( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_alloc_t * p_first_alloc )
{
int i;
for ( i = i_nb_filters - 1; i >= 0; i-- )
{
aout_filter_t * p_filter = pp_filters[i];
int i_output_size = aout_FormatToBytes( &p_filter->output )
* p_filter->output.i_rate;
int i_input_size = aout_FormatToBytes( &p_filter->input )
* p_filter->input.i_rate;
p_first_alloc->i_bytes_per_sec = __MAX( p_first_alloc->i_bytes_per_sec,
i_output_size );
if ( p_filter->b_in_place )
{
p_first_alloc->i_bytes_per_sec = __MAX(
p_first_alloc->i_bytes_per_sec,
i_input_size );
}
else
{
/* We're gonna need a buffer allocation. */
memcpy( &p_filter->output_alloc, p_first_alloc,
sizeof(aout_alloc_t) );
p_first_alloc->i_alloc_type = AOUT_ALLOC_STACK;
p_first_alloc->i_bytes_per_sec = i_input_size;
}
}
}
/*****************************************************************************
* aout_FiltersPlay: play a buffer
*****************************************************************************/
void aout_FiltersPlay( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_buffer_t ** pp_input_buffer )
{
int i;
for ( i = 0; i < i_nb_filters; i++ )
{
aout_filter_t * p_filter = pp_filters[i];
aout_buffer_t * p_output_buffer;
aout_BufferAlloc( &p_filter->output_alloc,
(u64)((*pp_input_buffer)->i_nb_samples * 1000000)
/ p_filter->output.i_rate, *pp_input_buffer,
p_output_buffer );
if ( p_output_buffer == NULL )
{
msg_Err( p_aout, "out of memory" );
return;
}
/* Please note that p_output_buffer->i_nb_samples shall be set by
* the filter plug-in. */
p_filter->pf_do_work( p_aout, p_filter, *pp_input_buffer,
p_output_buffer );
if ( !p_filter->b_in_place )
{
aout_BufferFree( *pp_input_buffer );
*pp_input_buffer = p_output_buffer;
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.20 2002/08/04 20:04:11 sam Exp $ * $Id: libvlc.c,v 1.21 2002/08/07 21:36:56 massiot Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -608,7 +608,7 @@ vlc_error_t vlc_stop_r( vlc_t *p_vlc ) ...@@ -608,7 +608,7 @@ vlc_error_t vlc_stop_r( vlc_t *p_vlc )
intf_thread_t *p_intf; intf_thread_t *p_intf;
playlist_t *p_playlist; playlist_t *p_playlist;
vout_thread_t *p_vout; vout_thread_t *p_vout;
aout_thread_t *p_aout; aout_instance_t *p_aout;
/* Check that the handle is valid */ /* Check that the handle is valid */
if( !p_vlc || p_vlc->i_status != VLC_STATUS_RUNNING ) if( !p_vlc || p_vlc->i_status != VLC_STATUS_RUNNING )
...@@ -658,9 +658,9 @@ vlc_error_t vlc_stop_r( vlc_t *p_vlc ) ...@@ -658,9 +658,9 @@ vlc_error_t vlc_stop_r( vlc_t *p_vlc )
msg_Dbg( p_vlc, "removing all audio outputs" ); msg_Dbg( p_vlc, "removing all audio outputs" );
while( (p_aout = vlc_object_find( p_vlc, VLC_OBJECT_AOUT, FIND_CHILD )) ) while( (p_aout = vlc_object_find( p_vlc, VLC_OBJECT_AOUT, FIND_CHILD )) )
{ {
vlc_object_detach_all( p_aout ); vlc_object_detach_all( (vlc_object_t *)p_aout );
vlc_object_release( p_aout ); vlc_object_release( (vlc_object_t *)p_aout );
aout_DestroyThread( p_aout ); aout_DeleteInstance( p_aout );
} }
/* Update the handle status */ /* Update the handle status */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header * libvlc.h: main libvlc header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.10 2002/08/04 17:23:44 sam Exp $ * $Id: libvlc.h,v 1.11 2002/08/07 21:36:56 massiot Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -92,11 +92,16 @@ ...@@ -92,11 +92,16 @@
"7 -> MPEG2 audio (unsupported)\n" \ "7 -> MPEG2 audio (unsupported)\n" \
"8 -> A52 pass-through") "8 -> A52 pass-through")
#define RATE_TEXT N_("audio output frequency (Hz)") #define AOUT_RATE_TEXT N_("audio output frequency (Hz)")
#define RATE_LONGTEXT N_( \ #define AOUT_RATE_LONGTEXT N_( \
"You can force the audio output frequency here. Common values are " \ "You can force the audio output frequency here. Common values are " \
"48000, 44100, 32000, 22050, 16000, 11025, 8000.") "48000, 44100, 32000, 22050, 16000, 11025, 8000.")
#define AOUT_CHANNELS_TEXT N_("number of channels of audio output")
#define AOUT_CHANNELS_LONGTEXT N_( \
"Mono is 1, stereo is 2. Higher value (used for 5.1) may not be " \
"supported by your audio output module.")
#define DESYNC_TEXT N_("compensate desynchronization of audio (in ms)") #define DESYNC_TEXT N_("compensate desynchronization of audio (in ms)")
#define DESYNC_LONGTEXT N_( \ #define DESYNC_LONGTEXT N_( \
"This option allows you to delay the audio output. This can be handy if " \ "This option allows you to delay the audio output. This can be handy if " \
...@@ -346,9 +351,10 @@ vlc_module_begin(); ...@@ -346,9 +351,10 @@ vlc_module_begin();
add_module_with_short( "aout", 'A', "audio output", NULL, NULL, add_module_with_short( "aout", 'A', "audio output", NULL, NULL,
AOUT_TEXT, AOUT_LONGTEXT ); AOUT_TEXT, AOUT_LONGTEXT );
add_bool( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT ); add_bool( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT );
add_bool( "mono", 0, NULL, MONO_TEXT, MONO_LONGTEXT );
add_integer( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT ); add_integer( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT );
add_integer( "rate", 44100, NULL, RATE_TEXT, RATE_LONGTEXT ); add_integer( "aout-rate", -1, NULL, AOUT_RATE_TEXT, AOUT_RATE_LONGTEXT );
add_integer( "aout-channels", -1, NULL,
AOUT_CHANNELS_TEXT, AOUT_CHANNELS_LONGTEXT );
add_integer( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT ); add_integer( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT );
add_integer( "audio-format", 0, NULL, FORMAT_TEXT, FORMAT_LONGTEXT ); add_integer( "audio-format", 0, NULL, FORMAT_TEXT, FORMAT_LONGTEXT );
......
...@@ -180,8 +180,14 @@ static inline const char * module_error( char *psz_buffer ) ...@@ -180,8 +180,14 @@ static inline const char * module_error( char *psz_buffer )
* STORE_SYMBOLS: store known symbols into p_symbols for plugin access. * STORE_SYMBOLS: store known symbols into p_symbols for plugin access.
*****************************************************************************/ *****************************************************************************/
#define STORE_SYMBOLS( p_symbols ) \ #define STORE_SYMBOLS( p_symbols ) \
(p_symbols)->__aout_CreateFifo_inner = __aout_CreateFifo; \ (p_symbols)->__aout_NewInstance_inner = __aout_NewInstance; \
(p_symbols)->aout_DestroyFifo_inner = aout_DestroyFifo; \ (p_symbols)->aout_DeleteInstance_inner = aout_DeleteInstance; \
(p_symbols)->aout_BufferNew_inner = aout_BufferNew; \
(p_symbols)->aout_BufferDelete_inner = aout_BufferDelete; \
(p_symbols)->aout_BufferPlay_inner = aout_BufferPlay; \
(p_symbols)->__aout_InputNew_inner = __aout_InputNew; \
(p_symbols)->aout_InputDelete_inner = aout_InputDelete; \
(p_symbols)->aout_OutputNextBuffer_inner = aout_OutputNextBuffer; \
(p_symbols)->__config_GetInt_inner = __config_GetInt; \ (p_symbols)->__config_GetInt_inner = __config_GetInt; \
(p_symbols)->__config_PutInt_inner = __config_PutInt; \ (p_symbols)->__config_PutInt_inner = __config_PutInt; \
(p_symbols)->__config_GetFloat_inner = __config_GetFloat; \ (p_symbols)->__config_GetFloat_inner = __config_GetFloat; \
......
This diff is collapsed.
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