VLC 4.0.0-dev
Loading...
Searching...
No Matches
aout_internal.h
Go to the documentation of this file.
1/*****************************************************************************
2 * aout_internal.h : internal defines for audio output
3 *****************************************************************************
4 * Copyright (C) 2002 VLC authors and VideoLAN
5 *
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22
23#ifndef LIBVLC_AOUT_INTERNAL_H
24# define LIBVLC_AOUT_INTERNAL_H 1
25
26# include <stdatomic.h>
27
28# include <vlc_atomic.h>
29# include <vlc_filter.h>
30# include <vlc_list.h>
31# include <vlc_viewpoint.h>
32# include "../clock/clock.h"
33
34/* Max input rate factor (1/4 -> 4) */
35# define AOUT_MAX_INPUT_RATE (4)
36
37enum {
41};
42
45
46typedef struct
47{
49 module_t *module; /**< Output plugin (or NULL if inactive) */
51
53
54 struct
55 {
57 struct vlc_list list;
58 unsigned count;
59 } dev;
60
61 struct
62 {
63 atomic_bool update;
66 } vp;
67
68 int requested_stereo_mode; /**< Requested stereo mode set by the user */
69 int requested_mix_mode; /**< Requested mix mode set by the user */
70
71 struct vlc_audio_meter meter;
72
75
81
83{
84 return container_of(aout, aout_instance_t, output);
85}
86
88{
89 aout_instance_t *instance = aout_instance(aout);
90 return &instance->owner;
91}
92
93/****************************************************************************
94 * Prototypes
95 *****************************************************************************/
96
97/* From mixer.c : */
99#define aout_volume_New(o, g) aout_volume_New(VLC_OBJECT(o), g)
104
105
106/* From output.c : */
108#define aout_New(a) aout_New(VLC_OBJECT(a))
109
110/**
111 * Starts an audio output stream.
112 *
113 * \param aout the audio output instance to initialize from
114 * \param stream the audio output stream to initialize from
115 * \param fmt the format to request to the output
116 * \param input_profile the audio profile to request from the audio output
117 * \param filter_fmt the format requested from the filters
118 * \param filters_cfg the configuration to load the audio filters from
119 *
120 * \warning The caller must NOT hold the audio output lock.
121 */
123 audio_sample_format_t *fmt, int input_profile,
124 audio_sample_format_t *filter_fmt,
125 aout_filters_cfg_t *filters_cfg);
126/**
127 * Stops the audio output stream (undoes aout_OutputNew()).
128 * \note This can only be called after a successful aout_OutputNew().
129 * \warning The caller must NOT hold the audio output lock.
130 */
131void aout_OutputDelete( audio_output_t * p_aout );
132
134aout_AddMeterPlugin(audio_output_t *aout, const char *chain,
135 const struct vlc_audio_meter_plugin_owner *owner);
136
137void
139
140/* From common.c : */
141void aout_FormatsPrint(vlc_object_t *, const char *,
142 const audio_sample_format_t *,
143 const audio_sample_format_t *);
144#define aout_FormatsPrint(o, t, a, b) \
145 aout_FormatsPrint(VLC_OBJECT(o), t, a, b)
146
147/* From dec.c */
148#define AOUT_DEC_SUCCESS 0
149#define AOUT_DEC_CHANGED 1
150#define AOUT_DEC_FAILED VLC_EGENERIC
151
160
162 const struct vlc_aout_stream_cfg *cfg);
164int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block);
165void vlc_aout_stream_GetResetStats(vlc_aout_stream *stream, unsigned *, unsigned *);
166void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool b_paused, vlc_tick_t i_date);
167void vlc_aout_stream_ChangeRate(vlc_aout_stream *stream, float rate);
171/* Contrary to other vlc_aout_stream_*() functions, this function can be called from
172 * any threads */
174/* Called from output.c */
176 vlc_tick_t audio_ts);
178void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain);
179
180void vlc_aout_stream_RequestRestart(vlc_aout_stream *stream, unsigned);
182 vlc_tick_t audio_ts);
183
185
187{
188 static const uint32_t wave_channels[] = {
192
193 fmt->i_physical_channels = 0;
194 for (int i = 0; i < fmt->i_channels && i < AOUT_CHAN_MAX; ++i)
195 fmt->i_physical_channels |= wave_channels[i];
197}
198
199/* From filters.c */
200
201/* Extended version of aout_FiltersNew
202 *
203 * The clock, that is not mandatory, will be used to create a new slave clock
204 * for the filter visualization plugins.
205 */
207 const audio_sample_format_t *,
208 const audio_sample_format_t *,
209 const aout_filters_cfg_t *cfg) VLC_USED;
214 const char *type, const char *name,
215 const audio_sample_format_t *infmt,
216 const audio_sample_format_t *outfmt,
217 config_chain_t *cfg, bool const_fmt);
218
219#endif /* !LIBVLC_AOUT_INTERNAL_H */
aout_filters_t * aout_FiltersNewWithClock(vlc_object_t *, const vlc_clock_t *, const audio_sample_format_t *, const audio_sample_format_t *, const aout_filters_cfg_t *cfg)
static void aout_SetWavePhysicalChannels(audio_sample_format_t *fmt)
Definition aout_internal.h:186
void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain)
Definition dec.c:896
int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block)
Definition dec.c:711
void aout_volume_SetVolume(aout_volume_t *, float)
Definition volume.c:117
void vlc_aout_stream_Flush(vlc_aout_stream *stream)
Definition dec.c:883
void aout_FiltersSetClockDelay(aout_filters_t *filters, vlc_tick_t delay)
Definition filters.c:724
void aout_RemoveMeterPlugin(audio_output_t *aout, vlc_audio_meter_plugin *plugin)
Definition output.c:954
void vlc_aout_stream_RequestRetiming(vlc_aout_stream *stream, vlc_tick_t system_ts, vlc_tick_t audio_ts)
#define aout_volume_New(o, g)
Definition aout_internal.h:99
void vlc_aout_stream_ChangeDelay(vlc_aout_stream *stream, vlc_tick_t delay)
Definition dec.c:878
void vlc_aout_stream_Drain(vlc_aout_stream *stream)
Definition dec.c:922
void aout_FiltersResetClock(aout_filters_t *filters)
Definition filters.c:707
void aout_OutputDelete(audio_output_t *p_aout)
Stops the audio output stream (undoes aout_OutputNew()).
Definition output.c:805
int aout_volume_SetFormat(aout_volume_t *, vlc_fourcc_t)
Selects the current sample format for software amplification.
Definition volume.c:82
#define aout_New(a)
Definition aout_internal.h:108
void vlc_aout_stream_RequestRestart(vlc_aout_stream *stream, unsigned)
Marks the audio output for restart, to update any parameter of the output plug-in (e....
Definition dec.c:421
bool vlc_aout_stream_IsDrained(vlc_aout_stream *stream)
Definition dec.c:907
void aout_volume_Delete(aout_volume_t *)
Destroys a software amplifier.
Definition volume.c:106
int aout_volume_Amplify(aout_volume_t *, block_t *)
Applies replay gain and software volume to an audio buffer.
Definition volume.c:125
vlc_aout_stream * vlc_aout_stream_New(audio_output_t *p_aout, const struct vlc_aout_stream_cfg *cfg)
Creates an audio output.
Definition dec.c:219
void aout_InputRequestRestart(audio_output_t *aout)
Definition output.c:165
void vlc_aout_stream_GetResetStats(vlc_aout_stream *stream, unsigned *, unsigned *)
static aout_owner_t * aout_owner(audio_output_t *aout)
Definition aout_internal.h:87
@ AOUT_RESAMPLING_NONE
Definition aout_internal.h:38
@ AOUT_RESAMPLING_UP
Definition aout_internal.h:39
@ AOUT_RESAMPLING_DOWN
Definition aout_internal.h:40
#define aout_FormatsPrint(o, t, a, b)
Definition aout_internal.h:144
vlc_audio_meter_plugin * aout_AddMeterPlugin(audio_output_t *aout, const char *chain, const struct vlc_audio_meter_plugin_owner *owner)
Definition output.c:945
void vlc_aout_stream_Delete(vlc_aout_stream *)
Stops all plugins involved in the audio output.
Definition dec.c:325
void vlc_aout_stream_NotifyDrained(vlc_aout_stream *stream)
Definition dec.c:902
bool aout_FiltersCanResample(aout_filters_t *filters)
Definition filters.c:762
void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool b_paused, vlc_tick_t i_date)
Definition dec.c:827
void vlc_aout_stream_NotifyTiming(vlc_aout_stream *stream, vlc_tick_t system_ts, vlc_tick_t audio_ts)
Definition dec.c:667
void vlc_aout_stream_ChangeRate(vlc_aout_stream *stream, float rate)
Definition dec.c:873
static aout_instance_t * aout_instance(audio_output_t *aout)
Definition aout_internal.h:82
int aout_OutputNew(audio_output_t *aout, vlc_aout_stream *stream, audio_sample_format_t *fmt, int input_profile, audio_sample_format_t *filter_fmt, aout_filters_cfg_t *filters_cfg)
Starts an audio output stream.
Definition output.c:679
filter_t * aout_filter_Create(vlc_object_t *obj, const filter_owner_t *restrict owner, const char *type, const char *name, const audio_sample_format_t *infmt, const audio_sample_format_t *outfmt, config_chain_t *cfg, bool const_fmt)
Definition filters.c:58
struct vlc_param ** list
Definition core.c:402
#define VLC_USED
Definition fourcc_gen.c:32
uint32_t vlc_fourcc_t
Definition fourcc_gen.c:33
void aout_FormatPrepare(audio_sample_format_t *p_format)
Definition common.c:87
const char name[16]
Definition httpd.c:1298
vlc_mutex_t lock
Definition rand.c:33
Definition vlc_aout.h:616
Definition filters.c:368
Definition aout_internal.h:77
audio_output_t output
Definition aout_internal.h:78
aout_owner_t owner
Definition aout_internal.h:79
Definition aout_internal.h:47
int requested_mix_mode
Requested mix mode set by the user.
Definition aout_internal.h:69
module_t *bool bitexact
< Output plugin (or NULL if inactive)
Definition aout_internal.h:50
vlc_mutex_t lock
Definition aout_internal.h:48
atomic_bool update
Definition aout_internal.h:63
vlc_viewpoint_t value
Definition aout_internal.h:65
vlc_aout_stream * main_stream
Definition aout_internal.h:52
vlc_atomic_rc_t rc
Definition aout_internal.h:73
int requested_stereo_mode
Requested stereo mode set by the user.
Definition aout_internal.h:68
unsigned count
Definition aout_internal.h:58
Definition volume.c:38
audio format description
Definition vlc_es.h:83
uint8_t i_channels
Definition vlc_es.h:114
uint16_t i_physical_channels
Definition vlc_es.h:89
Audio output object.
Definition vlc_aout.h:155
Definition vlc_es.h:57
Definition vlc_configuration.h:320
Definition vlc_filter.h:66
Structure describing a filter.
Definition vlc_filter.h:219
Internal module descriptor.
Definition modules.h:76
Definition aout_internal.h:153
struct vlc_clock_t * clock
Definition aout_internal.h:156
const audio_replay_gain_t * replay_gain
Definition aout_internal.h:158
const audio_sample_format_t * fmt
Definition aout_internal.h:154
const char * str_id
Definition aout_internal.h:157
int profile
Definition aout_internal.h:155
Definition dec.c:43
Definition vlc_atomic.h:48
Audio meter plugin owner structure.
Definition vlc_aout.h:718
Definition meter.c:34
Audio meter structure.
Definition vlc_aout.h:731
const audio_sample_format_t * fmt
Definition vlc_aout.h:734
Definition clock.c:88
vlc_clock_main_t * owner
Definition clock.c:90
vlc_tick_t delay
Definition clock.c:91
Definition vlc_frame.h:123
Doubly-linked list node.
Definition vlc_list.h:44
Mutex.
Definition vlc_threads.h:143
VLC object common members.
Definition vlc_objects.h:53
Viewpoints.
Definition vlc_viewpoint.h:41
Atomic operations do not require locking, but they are not very powerful.
#define container_of(ptr, type, member)
Definition vlc_common.h:1067
#define AOUT_CHAN_LFE
Definition vlc_es.h:126
#define AOUT_CHAN_REARCENTER
Definition vlc_es.h:121
#define AOUT_CHAN_REARLEFT
Definition vlc_es.h:122
#define AOUT_CHAN_MIDDLELEFT
Definition vlc_es.h:124
#define AOUT_CHAN_MIDDLERIGHT
Definition vlc_es.h:125
#define AOUT_CHAN_REARRIGHT
Definition vlc_es.h:123
#define AOUT_CHAN_MAX
Definition vlc_es.h:154
#define AOUT_CHAN_RIGHT
Definition vlc_es.h:120
#define AOUT_CHAN_CENTER
Definition vlc_es.h:118
#define AOUT_CHAN_LEFT
Definition vlc_es.h:119
Filter modules interface.
This provides convenience helpers for linked lists.
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:47
Video and audio viewpoint struct and helpers.