1 /*****************************************************************************
2 * aout_internal.h : internal defines for audio output
3 *****************************************************************************
4 * Copyright (C) 2002 the VideoLAN team
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #if defined( __APPLE__ ) || defined( SYS_BSD )
29 # define ALLOCA_TEST( p_alloc, p_new_buffer ) \
30 if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK ) \
32 (p_new_buffer) = alloca( i_alloc_size + sizeof(aout_buffer_t) );\
33 i_alloc_type = AOUT_ALLOC_STACK; \
37 # define ALLOCA_TEST( p_alloc, p_new_buffer )
40 #define aout_BufferAlloc( p_alloc, i_nb_usec, p_previous_buffer, \
42 if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_NONE ) \
44 (p_new_buffer) = p_previous_buffer; \
48 int i_alloc_size, i_alloc_type; \
49 i_alloc_size = (int)( (uint64_t)(p_alloc)->i_bytes_per_sec \
50 * (i_nb_usec) / 1000000 + 1 ); \
51 ALLOCA_TEST( p_alloc, p_new_buffer ) \
53 (p_new_buffer) = malloc( i_alloc_size + sizeof(aout_buffer_t) );\
54 i_alloc_type = AOUT_ALLOC_HEAP; \
56 if ( p_new_buffer != NULL ) \
58 (p_new_buffer)->i_alloc_type = i_alloc_type; \
59 (p_new_buffer)->i_size = i_alloc_size; \
60 (p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer) \
61 + sizeof(aout_buffer_t); \
62 (p_new_buffer)->b_discontinuity = VLC_FALSE; \
63 if ( (p_previous_buffer) != NULL ) \
65 (p_new_buffer)->start_date = \
66 ((aout_buffer_t *)p_previous_buffer)->start_date;\
67 (p_new_buffer)->end_date = \
68 ((aout_buffer_t *)p_previous_buffer)->end_date; \
71 /* we'll keep that for a while --Meuuh */ \
72 /* else printf("%s:%d\n", __FILE__, __LINE__); */ \
75 /****************************************************************************
77 *****************************************************************************/
79 int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input );
80 int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input );
81 int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
82 aout_buffer_t * p_buffer );
84 /* From filters.c : */
85 int aout_FiltersCreatePipeline ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format );
86 void aout_FiltersDestroyPipeline ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters );
87 void aout_FiltersPlay ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer );
88 void aout_FiltersHintBuffers( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_alloc_t * p_first_alloc );
91 int aout_MixerNew( aout_instance_t * p_aout );
92 void aout_MixerDelete( aout_instance_t * p_aout );
93 void aout_MixerRun( aout_instance_t * p_aout );
94 int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier );
95 int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier );
98 int aout_OutputNew( aout_instance_t * p_aout,
99 audio_sample_format_t * p_format );
100 void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer );
101 void aout_OutputDelete( aout_instance_t * p_aout );
104 /* From common.c : */
105 #define aout_New(a) __aout_New(VLC_OBJECT(a))
106 aout_instance_t * __aout_New ( vlc_object_t * );
107 void aout_Delete ( aout_instance_t * );
109 void aout_FifoInit( aout_instance_t *, aout_fifo_t *, uint32_t );
110 mtime_t aout_FifoNextStart( aout_instance_t *, aout_fifo_t * );
111 void aout_FifoPush( aout_instance_t *, aout_fifo_t *, aout_buffer_t * );
112 void aout_FifoSet( aout_instance_t *, aout_fifo_t *, mtime_t );
113 void aout_FifoMoveDates( aout_instance_t *, aout_fifo_t *, mtime_t );
114 void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo );
115 void aout_FormatsPrint( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format1, const audio_sample_format_t * p_format2 );
119 int aout_VolumeSoftGet( aout_instance_t *, audio_volume_t * );
120 int aout_VolumeSoftSet( aout_instance_t *, audio_volume_t );
121 int aout_VolumeSoftInfos( aout_instance_t *, audio_volume_t * );
122 int aout_VolumeNoneGet( aout_instance_t *, audio_volume_t * );
123 int aout_VolumeNoneSet( aout_instance_t *, audio_volume_t );
124 int aout_VolumeNoneInfos( aout_instance_t *, audio_volume_t * );
127 #define aout_DecNew(a, b, c) __aout_DecNew(VLC_OBJECT(a), b, c)
128 aout_input_t * __aout_DecNew( vlc_object_t *, aout_instance_t **, audio_sample_format_t * );
129 int aout_DecDelete ( aout_instance_t *, aout_input_t * );
130 aout_buffer_t * aout_DecNewBuffer( aout_instance_t *, aout_input_t *, size_t );
131 void aout_DecDeleteBuffer( aout_instance_t *, aout_input_t *, aout_buffer_t * );
132 int aout_DecPlay( aout_instance_t *, aout_input_t *, aout_buffer_t * );