1 /*****************************************************************************
2 * aout_internal.h : internal defines for audio output
3 *****************************************************************************
4 * Copyright (C) 2002 VLC authors and VideoLAN
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef LIBVLC_AOUT_INTERNAL_H
25 # define LIBVLC_AOUT_INTERNAL_H 1
27 # include <vlc_atomic.h>
29 /* Max input rate factor (1/4 -> 4) */
30 # define AOUT_MAX_INPUT_RATE (4)
33 AOUT_RESAMPLING_NONE=0,
40 struct vout_thread_t *(*pf_request_vout)( void *, struct vout_thread_t *,
41 video_format_t *, bool );
43 } aout_request_vout_t;
45 typedef struct aout_volume aout_volume_t;
47 /** an input stream for the audio output */
50 unsigned samplerate; /**< Input sample rate */
53 filter_t * pp_filters[AOUT_MAX_FILTERS];
56 filter_t * p_playback_rate_filter;
59 filter_t * pp_resamplers[AOUT_MAX_FILTERS];
61 int i_resampling_type;
62 mtime_t i_resamp_start_date;
63 int i_resamp_start_drift;
65 /* last rate from input */
66 int i_last_input_rate;
73 aout_request_vout_t request_vout;
79 module_t *module; /**< Output plugin (or NULL if inactive) */
81 aout_volume_t *volume;
88 audio_sample_format_t mixer_format;
89 audio_sample_format_t input_format;
91 /* Filters between mixer and output */
92 filter_t *filters[AOUT_MAX_FILTERS];
100 audio_output_t output;
104 static inline aout_owner_t *aout_owner (audio_output_t *aout)
106 return &((aout_instance_t *)aout)->owner;
109 /****************************************************************************
111 *****************************************************************************/
114 aout_input_t *aout_InputNew(audio_output_t *, const audio_sample_format_t *,
115 const audio_sample_format_t *,
116 const aout_request_vout_t *);
117 int aout_InputDelete( audio_output_t * p_aout, aout_input_t * p_input );
118 block_t *aout_InputPlay( audio_output_t *p_aout, aout_input_t *p_input,
119 block_t *p_buffer, int i_input_rate, date_t * );
121 /* From filters.c : */
122 int aout_FiltersCreatePipeline( vlc_object_t *, filter_t **, int *,
123 const audio_sample_format_t *, const audio_sample_format_t * );
124 #define aout_FiltersCreatePipeline(o, pv, pc, inf, outf) \
125 aout_FiltersCreatePipeline(VLC_OBJECT(o), pv, pc, inf, outf)
126 void aout_FiltersDestroyPipeline( filter_t *const *, unsigned );
127 void aout_FiltersPlay( filter_t *const *, unsigned, block_t ** );
130 aout_volume_t *aout_volume_New(vlc_object_t *, const audio_replay_gain_t *);
131 #define aout_volume_New(o, g) aout_volume_New(VLC_OBJECT(o), g)
132 int aout_volume_SetFormat(aout_volume_t *, vlc_fourcc_t);
133 void aout_volume_SetVolume(aout_volume_t *, float);
134 int aout_volume_Amplify(aout_volume_t *, block_t *);
135 void aout_volume_Delete(aout_volume_t *);
138 /* From output.c : */
139 int aout_OutputNew( audio_output_t * p_aout,
140 const audio_sample_format_t * p_format );
141 void aout_OutputPlay( audio_output_t * p_aout, block_t * p_buffer );
142 void aout_OutputPause( audio_output_t * p_aout, bool, mtime_t );
143 void aout_OutputFlush( audio_output_t * p_aout, bool );
144 void aout_OutputDelete( audio_output_t * p_aout );
147 /* From common.c : */
148 audio_output_t *aout_New (vlc_object_t *);
149 #define aout_New(a) aout_New(VLC_OBJECT(a))
150 void aout_Destroy (audio_output_t *);
152 void aout_FormatsPrint(vlc_object_t *, const char *,
153 const audio_sample_format_t *,
154 const audio_sample_format_t *);
155 #define aout_FormatsPrint(o, t, a, b) \
156 aout_FormatsPrint(VLC_OBJECT(o), t, a, b)
157 bool aout_ChangeFilterString( vlc_object_t *manager, vlc_object_t *aout,
158 const char *var, const char *name, bool b_add );
161 int aout_DecNew(audio_output_t *, const audio_sample_format_t *,
162 const audio_replay_gain_t *, const aout_request_vout_t *);
163 void aout_DecDelete(audio_output_t *);
164 block_t *aout_DecNewBuffer(audio_output_t *, size_t);
165 void aout_DecDeleteBuffer(audio_output_t *, block_t *);
166 int aout_DecPlay(audio_output_t *, block_t *, int i_input_rate);
167 int aout_DecGetResetLost(audio_output_t *);
168 void aout_DecChangePause(audio_output_t *, bool b_paused, mtime_t i_date);
169 void aout_DecFlush(audio_output_t *);
170 bool aout_DecIsEmpty(audio_output_t *);
172 void aout_InputRequestRestart(audio_output_t *);
173 void aout_RequestRestart(audio_output_t *);
175 /* Audio output locking */
176 static inline void aout_lock( audio_output_t *p_aout )
178 vlc_mutex_lock( &aout_owner(p_aout)->lock );
181 static inline void aout_unlock( audio_output_t *p_aout )
183 vlc_mutex_unlock( &aout_owner(p_aout)->lock );
186 #define aout_assert_locked( aout ) \
187 vlc_assert_locked( &aout_owner(aout)->lock )
189 #endif /* !LIBVLC_AOUT_INTERNAL_H */