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
37#define AOUT_RESTART_FILTERS 0x1
38#define AOUT_RESTART_OUTPUT (AOUT_RESTART_FILTERS|0x2)
39#define AOUT_RESTART_OUTPUT_DEC (AOUT_RESTART_OUTPUT|0x4)
40
41enum {
45};
46
49
50typedef struct
51{
53 module_t *module; /**< Output plugin (or NULL if inactive) */
55
57
58 struct
59 {
61 struct vlc_list list;
62 unsigned count;
63 } dev;
64
65 struct
66 {
67 atomic_bool update;
70 } vp;
71
72 int requested_stereo_mode; /**< Requested stereo mode set by the user */
73 int requested_mix_mode; /**< Requested mix mode set by the user */
74
75 struct vlc_audio_meter meter;
76
79
85
87{
88 return container_of(aout, aout_instance_t, output);
89}
90
92{
93 aout_instance_t *instance = aout_instance(aout);
94 return &instance->owner;
95}
96
97/****************************************************************************
98 * Prototypes
99 *****************************************************************************/
100
101/* From mixer.c : */
103#define aout_volume_New(o, g) aout_volume_New(VLC_OBJECT(o), g)
108
109
110/* From output.c : */
112#define aout_New(a) aout_New(VLC_OBJECT(a))
113
114/**
115 * Starts an audio output stream.
116 *
117 * \param aout the audio output instance to initialize from
118 * \param stream the audio output stream to initialize from
119 * \param fmt the format to request to the output
120 * \param input_profile the audio profile to request from the audio output
121 * \param filter_fmt the format requested from the filters
122 * \param filters_cfg the configuration to load the audio filters from
123 *
124 * \warning The caller must NOT hold the audio output lock.
125 */
127 audio_sample_format_t *fmt, int input_profile,
128 audio_sample_format_t *filter_fmt,
129 aout_filters_cfg_t *filters_cfg);
130/**
131 * Stops the audio output stream (undoes aout_OutputNew()).
132 * \note This can only be called after a successful aout_OutputNew().
133 * \warning The caller must NOT hold the audio output lock.
134 */
135void aout_OutputDelete( audio_output_t * p_aout );
136
138aout_AddMeterPlugin(audio_output_t *aout, const char *chain,
139 const struct vlc_audio_meter_plugin_owner *owner);
140
141void
143
144/* From common.c : */
145void aout_FormatsPrint(vlc_object_t *, const char *,
146 const audio_sample_format_t *,
147 const audio_sample_format_t *);
148#define aout_FormatsPrint(o, t, a, b) \
149 aout_FormatsPrint(VLC_OBJECT(o), t, a, b)
150
151/* From dec.c */
152#define AOUT_DEC_SUCCESS 0
153#define AOUT_DEC_CHANGED 1
154#define AOUT_DEC_FAILED VLC_EGENERIC
155
164
166 const struct vlc_aout_stream_cfg *cfg);
168int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block);
169void vlc_aout_stream_GetResetStats(vlc_aout_stream *stream, unsigned *, unsigned *);
170void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool b_paused, vlc_tick_t i_date);
171void vlc_aout_stream_ChangeRate(vlc_aout_stream *stream, float rate);
175/* Contrary to other vlc_aout_stream_*() functions, this function can be called from
176 * any threads */
178/* Called from output.c */
180 vlc_tick_t audio_ts);
182void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain);
183
184void vlc_aout_stream_RequestRestart(vlc_aout_stream *stream, unsigned);
186 vlc_tick_t audio_ts);
187
189
191{
192 static const uint32_t wave_channels[] = {
196
197 fmt->i_physical_channels = 0;
198 for (int i = 0; i < fmt->i_channels && i < AOUT_CHAN_MAX; ++i)
199 fmt->i_physical_channels |= wave_channels[i];
201}
202
203/* From filters.c */
204
205/* Extended version of aout_FiltersNew
206 *
207 * The clock, that is not mandatory, will be used to create a new slave clock
208 * for the filter visualization plugins.
209 */
211 const audio_sample_format_t *,
212 const audio_sample_format_t *,
213 const aout_filters_cfg_t *cfg) VLC_USED;
218 const char *type, const char *name,
219 const audio_sample_format_t *infmt,
220 const audio_sample_format_t *outfmt,
221 config_chain_t *cfg, bool const_fmt);
222
223#endif /* !LIBVLC_AOUT_INTERNAL_H */
static void aout_SetWavePhysicalChannels(audio_sample_format_t *fmt)
Definition aout_internal.h:190
void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain)
Definition dec.c:1048
int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block)
Definition dec.c:870
void aout_volume_SetVolume(aout_volume_t *, float)
Definition volume.c:117
void vlc_aout_stream_Flush(vlc_aout_stream *stream)
Definition dec.c:1035
void aout_FiltersSetClockDelay(aout_filters_t *filters, vlc_tick_t delay)
Definition filters.c:732
void aout_RemoveMeterPlugin(audio_output_t *aout, vlc_audio_meter_plugin *plugin)
Definition output.c:968
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:103
void vlc_aout_stream_ChangeDelay(vlc_aout_stream *stream, vlc_tick_t delay)
Definition dec.c:1030
void vlc_aout_stream_Drain(vlc_aout_stream *stream)
Definition dec.c:1068
aout_filters_t * aout_FiltersNewWithClock(vlc_object_t *, vlc_clock_t *, const audio_sample_format_t *, const audio_sample_format_t *, const aout_filters_cfg_t *cfg)
void aout_FiltersResetClock(aout_filters_t *filters)
Definition filters.c:711
void aout_OutputDelete(audio_output_t *p_aout)
Stops the audio output stream (undoes aout_OutputNew()).
Definition output.c:822
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:112
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:556
bool vlc_aout_stream_IsDrained(vlc_aout_stream *stream)
Definition dec.c:1059
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:342
void aout_InputRequestRestart(audio_output_t *aout)
Definition output.c:178
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:91
@ AOUT_RESAMPLING_NONE
Definition aout_internal.h:42
@ AOUT_RESAMPLING_UP
Definition aout_internal.h:43
@ AOUT_RESAMPLING_DOWN
Definition aout_internal.h:44
#define aout_FormatsPrint(o, t, a, b)
Definition aout_internal.h:148
vlc_audio_meter_plugin * aout_AddMeterPlugin(audio_output_t *aout, const char *chain, const struct vlc_audio_meter_plugin_owner *owner)
Definition output.c:959
void vlc_aout_stream_Delete(vlc_aout_stream *)
Stops all plugins involved in the audio output.
Definition dec.c:451
void vlc_aout_stream_NotifyDrained(vlc_aout_stream *stream)
Definition dec.c:1054
bool aout_FiltersCanResample(aout_filters_t *filters)
Definition filters.c:770
void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool b_paused, vlc_tick_t i_date)
Definition dec.c:977
void vlc_aout_stream_NotifyTiming(vlc_aout_stream *stream, vlc_tick_t system_ts, vlc_tick_t audio_ts)
Definition dec.c:816
void vlc_aout_stream_ChangeRate(vlc_aout_stream *stream, float rate)
Definition dec.c:1025
static aout_instance_t * aout_instance(audio_output_t *aout)
Definition aout_internal.h:86
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:697
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:610
Definition filters.c:366
Definition aout_internal.h:81
audio_output_t output
Definition aout_internal.h:82
aout_owner_t owner
Definition aout_internal.h:83
Definition aout_internal.h:51
int requested_mix_mode
Requested mix mode set by the user.
Definition aout_internal.h:73
module_t *bool bitexact
< Output plugin (or NULL if inactive)
Definition aout_internal.h:54
vlc_mutex_t lock
Definition aout_internal.h:52
atomic_bool update
Definition aout_internal.h:67
vlc_viewpoint_t value
Definition aout_internal.h:69
vlc_aout_stream * main_stream
Definition aout_internal.h:56
vlc_atomic_rc_t rc
Definition aout_internal.h:77
int requested_stereo_mode
Requested stereo mode set by the user.
Definition aout_internal.h:72
unsigned count
Definition aout_internal.h:62
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:213
Internal module descriptor.
Definition modules.h:76
Definition aout_internal.h:157
struct vlc_clock_t * clock
Definition aout_internal.h:160
const audio_replay_gain_t * replay_gain
Definition aout_internal.h:162
const audio_sample_format_t * fmt
Definition aout_internal.h:158
const char * str_id
Definition aout_internal.h:161
int profile
Definition aout_internal.h:159
Definition dec.c:45
Definition vlc_atomic.h:48
Audio meter plugin owner structure.
Definition vlc_aout.h:712
Definition meter.c:33
Audio meter structure.
Definition vlc_aout.h:725
const audio_sample_format_t * fmt
Definition vlc_aout.h:728
Definition clock.c:105
vlc_clock_main_t * owner
Definition clock.c:107
vlc_tick_t delay
Definition clock.c:108
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:48
Video and audio viewpoint struct and helpers.