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_filters aout_filters_t;
46 typedef struct aout_volume aout_volume_t;
47 typedef struct aout_dev aout_dev_t;
52 module_t *module; /**< Output plugin (or NULL if inactive) */
53 aout_filters_t *filters;
54 aout_volume_t *volume;
73 mtime_t end; /**< Last seen PTS */
74 unsigned resamp_start_drift; /**< Resampler drift absolute value */
75 int resamp_type; /**< Resampler mode (FIXME: redundant / resampling) */
79 audio_sample_format_t input_format;
80 audio_sample_format_t mixer_format;
82 aout_request_vout_t request_vout;
84 atomic_uint buffers_lost;
90 audio_output_t output;
94 static inline aout_owner_t *aout_owner (audio_output_t *aout)
96 return &((aout_instance_t *)aout)->owner;
99 /****************************************************************************
101 *****************************************************************************/
103 /* From filters.c : */
104 aout_filters_t *aout_FiltersNew(vlc_object_t *, const audio_sample_format_t *,
105 const audio_sample_format_t *,
106 const aout_request_vout_t *);
107 #define aout_FiltersNew(o,inf,outf,rv) \
108 aout_FiltersNew(VLC_OBJECT(o),inf,outf,rv)
109 void aout_FiltersDelete(vlc_object_t *, aout_filters_t *);
110 #define aout_FiltersDelete(o,f) \
111 aout_FiltersDelete(VLC_OBJECT(o),f)
112 bool aout_FiltersAdjustResampling(aout_filters_t *, int);
113 block_t *aout_FiltersPlay(aout_filters_t *, block_t *, int rate);
116 aout_volume_t *aout_volume_New(vlc_object_t *, const audio_replay_gain_t *);
117 #define aout_volume_New(o, g) aout_volume_New(VLC_OBJECT(o), g)
118 int aout_volume_SetFormat(aout_volume_t *, vlc_fourcc_t);
119 void aout_volume_SetVolume(aout_volume_t *, float);
120 int aout_volume_Amplify(aout_volume_t *, block_t *);
121 void aout_volume_Delete(aout_volume_t *);
124 /* From output.c : */
125 audio_output_t *aout_New (vlc_object_t *);
126 #define aout_New(a) aout_New(VLC_OBJECT(a))
127 void aout_Destroy (audio_output_t *);
129 int aout_OutputNew(audio_output_t *, audio_sample_format_t *);
130 int aout_OutputTimeGet(audio_output_t *, mtime_t *);
131 void aout_OutputPlay(audio_output_t *, block_t *);
132 void aout_OutputPause( audio_output_t * p_aout, bool, mtime_t );
133 void aout_OutputFlush( audio_output_t * p_aout, bool );
134 void aout_OutputDelete( audio_output_t * p_aout );
135 void aout_OutputLock(audio_output_t *);
136 void aout_OutputUnlock(audio_output_t *);
139 /* From common.c : */
140 void aout_FormatsPrint(vlc_object_t *, const char *,
141 const audio_sample_format_t *,
142 const audio_sample_format_t *);
143 #define aout_FormatsPrint(o, t, a, b) \
144 aout_FormatsPrint(VLC_OBJECT(o), t, a, b)
145 bool aout_ChangeFilterString( vlc_object_t *manager, vlc_object_t *aout,
146 const char *var, const char *name, bool b_add );
149 int aout_DecNew(audio_output_t *, const audio_sample_format_t *,
150 const audio_replay_gain_t *, const aout_request_vout_t *);
151 void aout_DecDelete(audio_output_t *);
152 block_t *aout_DecNewBuffer(audio_output_t *, size_t);
153 void aout_DecDeleteBuffer(audio_output_t *, block_t *);
154 int aout_DecPlay(audio_output_t *, block_t *, int i_input_rate);
155 int aout_DecGetResetLost(audio_output_t *);
156 void aout_DecChangePause(audio_output_t *, bool b_paused, mtime_t i_date);
157 void aout_DecFlush(audio_output_t *);
158 bool aout_DecIsEmpty(audio_output_t *);
159 void aout_RequestRestart (audio_output_t *, unsigned);
161 static inline void aout_InputRequestRestart(audio_output_t *aout)
163 aout_RequestRestart(aout, AOUT_RESTART_FILTERS);
166 #endif /* !LIBVLC_AOUT_INTERNAL_H */