00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef VLC_AOUT_H
00025 #define VLC_AOUT_H 1
00026
00027
00028
00029
00030
00031
00032 # ifdef __cplusplus
00033 extern "C" {
00034 # endif
00035
00036 #include "vlc_es.h"
00037
00038 #define AOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
00039 ((p_first)->i_format == (p_second)->i_format) \
00040 && AOUT_FMTS_SIMILAR(p_first, p_second) )
00041
00042
00043 #define AOUT_FMTS_SIMILAR( p_first, p_second ) ( \
00044 ((p_first)->i_rate == (p_second)->i_rate) \
00045 && ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
00046 && ((p_first)->i_original_channels == (p_second)->i_original_channels) )
00047
00048 #define VLC_CODEC_SPDIFL VLC_FOURCC('s','p','d','i')
00049 #define VLC_CODEC_SPDIFB VLC_FOURCC('s','p','d','b')
00050
00051 #define AOUT_FMT_NON_LINEAR( p_format ) \
00052 ( ((p_format)->i_format == VLC_CODEC_SPDIFL) \
00053 || ((p_format)->i_format == VLC_CODEC_SPDIFB) \
00054 || ((p_format)->i_format == VLC_CODEC_A52) \
00055 || ((p_format)->i_format == VLC_CODEC_DTS) )
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 typedef int32_t vlc_fixed_t;
00078 #define FIXED32_FRACBITS 28
00079 #define FIXED32_MIN ((vlc_fixed_t) -0x80000000L)
00080 #define FIXED32_MAX ((vlc_fixed_t) +0x7fffffffL)
00081 #define FIXED32_ONE ((vlc_fixed_t) 0x10000000)
00082
00083
00084
00085
00086
00087
00088 #define AOUT_CHAN_CENTER 0x1
00089 #define AOUT_CHAN_LEFT 0x2
00090 #define AOUT_CHAN_RIGHT 0x4
00091 #define AOUT_CHAN_REARCENTER 0x10
00092 #define AOUT_CHAN_REARLEFT 0x20
00093 #define AOUT_CHAN_REARRIGHT 0x40
00094 #define AOUT_CHAN_MIDDLELEFT 0x100
00095 #define AOUT_CHAN_MIDDLERIGHT 0x200
00096 #define AOUT_CHAN_LFE 0x1000
00097
00098
00099 #define AOUT_CHAN_DOLBYSTEREO 0x10000
00100 #define AOUT_CHAN_DUALMONO 0x20000
00101 #define AOUT_CHAN_REVERSESTEREO 0x40000
00102
00103 #define AOUT_CHAN_PHYSMASK 0xFFFF
00104 #define AOUT_CHAN_MAX 9
00105
00106
00107 #define AOUT_VAR_MONO 1
00108 #define AOUT_VAR_STEREO 2
00109 #define AOUT_VAR_2F2R 4
00110 #define AOUT_VAR_3F2R 5
00111 #define AOUT_VAR_5_1 6
00112 #define AOUT_VAR_6_1 7
00113 #define AOUT_VAR_7_1 8
00114 #define AOUT_VAR_SPDIF 10
00115
00116 #define AOUT_VAR_CHAN_STEREO 1
00117 #define AOUT_VAR_CHAN_RSTEREO 2
00118 #define AOUT_VAR_CHAN_LEFT 3
00119 #define AOUT_VAR_CHAN_RIGHT 4
00120 #define AOUT_VAR_CHAN_DOLBYS 5
00121
00122
00123
00124
00125
00126 #define aout_BufferFree( buffer ) block_Release( buffer )
00127
00128
00129 #define AOUT_SPDIF_SIZE 6144
00130
00131
00132 #define A52_FRAME_NB 1536
00133
00134
00135 #define AOUT_MAX_INPUT_RATE (4)
00136
00137
00138 typedef struct aout_alloc_t
00139 {
00140 bool b_alloc;
00141 int i_bytes_per_sec;
00142 } aout_alloc_t;
00143
00144
00145 struct aout_fifo_t
00146 {
00147 aout_buffer_t * p_first;
00148 aout_buffer_t ** pp_last;
00149 date_t end_date;
00150 };
00151
00152
00153 #include <vlc_aout_mixer.h>
00154 #include <vlc_block.h>
00155
00156
00157 typedef struct aout_filter_owner_sys_t aout_filter_owner_sys_t;
00158 typedef struct aout_filter_sys_t aout_filter_sys_t;
00159 struct aout_filter_t
00160 {
00161 VLC_COMMON_MEMBERS
00162
00163 module_t * p_module;
00164 aout_filter_sys_t *p_sys;
00165
00166 es_format_t fmt_in;
00167 es_format_t fmt_out;
00168
00169 aout_alloc_t output_alloc;
00170
00171 bool b_in_place;
00172
00173 void (*pf_do_work)( aout_instance_t *, aout_filter_t *,
00174 aout_buffer_t *, aout_buffer_t * );
00175
00176
00177 aout_filter_owner_sys_t *p_owner;
00178 };
00179
00180 #define AOUT_RESAMPLING_NONE 0
00181 #define AOUT_RESAMPLING_UP 1
00182 #define AOUT_RESAMPLING_DOWN 2
00183
00184
00185 typedef struct aout_output_t
00186 {
00187 audio_sample_format_t output;
00188
00189
00190 bool b_starving;
00191
00192
00193 filter_t * pp_filters[AOUT_MAX_FILTERS];
00194 int i_nb_filters;
00195
00196 aout_fifo_t fifo;
00197
00198 struct module_t * p_module;
00199 struct aout_sys_t * p_sys;
00200 void (* pf_play)( aout_instance_t * );
00201 int (* pf_volume_get )( aout_instance_t *, audio_volume_t * );
00202 int (* pf_volume_set )( aout_instance_t *, audio_volume_t );
00203 int i_nb_samples;
00204
00205
00206
00207 audio_volume_t i_volume;
00208
00209
00210 bool b_error;
00211 } aout_output_t;
00212
00213
00214 struct aout_instance_t
00215 {
00216 VLC_COMMON_MEMBERS
00217
00218
00219
00220
00221
00222
00223
00224 vlc_mutex_t input_fifos_lock;
00225
00226
00227
00228 vlc_mutex_t mixer_lock;
00229
00230
00231 vlc_mutex_t output_fifo_lock;
00232
00233 vlc_mutex_t volume_vars_lock;
00234
00235
00236 aout_input_t * pp_inputs[AOUT_MAX_INPUTS];
00237 int i_nb_inputs;
00238
00239
00240 audio_sample_format_t mixer_format;
00241 aout_alloc_t mixer_allocation;
00242 float mixer_multiplier;
00243 aout_mixer_t *p_mixer;
00244
00245
00246 aout_output_t output;
00247 };
00248
00249
00250
00251
00252 static const uint32_t pi_vlc_chan_order_wg4[] =
00253 {
00254 AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
00255 AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
00256 AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
00257 AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0
00258 };
00259
00260
00261
00262
00263
00264 VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t, bool ) LIBVLC_USED );
00265
00266
00267
00268
00269
00270
00271
00272 VLC_EXPORT( int, aout_CheckChannelReorder, ( const uint32_t *pi_chan_order_in, const uint32_t *pi_chan_order_out, uint32_t i_channel_mask, int i_channels, int *pi_chan_table ) );
00273 VLC_EXPORT( void, aout_ChannelReorder, ( uint8_t *, int, int, const int *, int ) );
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291 VLC_EXPORT( bool, aout_CheckChannelExtraction, ( int *pi_selection, uint32_t *pi_layout, int *pi_channels, const uint32_t pi_order_dst[AOUT_CHAN_MAX], const uint32_t *pi_order_src, int i_channels ) );
00292
00293
00294
00295
00296
00297
00298
00299
00300 VLC_EXPORT( void, aout_ChannelExtract, ( void *p_dst, int i_dst_channels, const void *p_src, int i_src_channels, int i_sample_count, const int *pi_selection, int i_bits_per_sample ) );
00301
00302
00303 VLC_EXPORT( unsigned int, aout_FormatNbChannels, ( const audio_sample_format_t * p_format ) LIBVLC_USED );
00304 VLC_EXPORT( unsigned int, aout_BitsPerSample, ( vlc_fourcc_t i_format ) LIBVLC_USED );
00305 VLC_EXPORT( void, aout_FormatPrepare, ( audio_sample_format_t * p_format ) );
00306 VLC_EXPORT( void, aout_FormatPrint, ( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format ) );
00307 VLC_EXPORT( const char *, aout_FormatPrintChannels, ( const audio_sample_format_t * ) LIBVLC_USED );
00308
00309 VLC_EXPORT( mtime_t, aout_FifoFirstDate, ( aout_instance_t *, aout_fifo_t * ) LIBVLC_USED );
00310 VLC_EXPORT( aout_buffer_t *, aout_FifoPop, ( aout_instance_t * p_aout, aout_fifo_t * p_fifo ) LIBVLC_USED );
00311
00312
00313 VLC_EXPORT( void, aout_VolumeSoftInit, ( aout_instance_t * ) );
00314 VLC_EXPORT( void, aout_VolumeNoneInit, ( aout_instance_t * ) );
00315 VLC_EXPORT( int, aout_VolumeGet, ( vlc_object_t *, audio_volume_t * ) );
00316 #define aout_VolumeGet(a, b) aout_VolumeGet(VLC_OBJECT(a), b)
00317 VLC_EXPORT( int, aout_VolumeSet, ( vlc_object_t *, audio_volume_t ) );
00318 #define aout_VolumeSet(a, b) aout_VolumeSet(VLC_OBJECT(a), b)
00319 VLC_EXPORT( int, aout_VolumeUp, ( vlc_object_t *, int, audio_volume_t * ) );
00320 #define aout_VolumeUp(a, b, c) aout_VolumeUp(VLC_OBJECT(a), b, c)
00321 VLC_EXPORT( int, aout_VolumeDown, ( vlc_object_t *, int, audio_volume_t * ) );
00322 #define aout_VolumeDown(a, b, c) aout_VolumeDown(VLC_OBJECT(a), b, c)
00323 VLC_EXPORT( int, aout_ToggleMute, ( vlc_object_t *, audio_volume_t * ) );
00324 #define aout_ToggleMute(a, b) aout_ToggleMute(VLC_OBJECT(a), b)
00325 VLC_EXPORT( int, aout_SetMute, ( vlc_object_t *, audio_volume_t *, bool ) );
00326 VLC_EXPORT( bool, aout_IsMuted, ( vlc_object_t * ) );
00327 VLC_EXPORT( int, aout_FindAndRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
00328 VLC_EXPORT( int, aout_ChannelsRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
00329
00330 VLC_EXPORT( void, aout_EnableFilter, (vlc_object_t *, const char *, bool ));
00331 #define aout_EnableFilter( o, n, b ) \
00332 aout_EnableFilter( VLC_OBJECT(o), n, b )
00333
00334
00335 VLC_EXPORT( vout_thread_t *, aout_filter_RequestVout, ( filter_t *, vout_thread_t *p_vout, video_format_t *p_fmt ) LIBVLC_USED );
00336
00337 # ifdef __cplusplus
00338 }
00339 # endif
00340
00341 #endif