VLC 4.0.0-dev
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
76typedef struct
77{
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
111 audio_sample_format_t *fmt, int input_profile,
112 audio_sample_format_t *filter_fmt,
113 aout_filters_cfg_t *filters_cfg);
114void aout_OutputDelete( audio_output_t * p_aout );
115
117aout_AddMeterPlugin(audio_output_t *aout, const char *chain,
118 const struct vlc_audio_meter_plugin_owner *owner);
119
120void
122
123/* From common.c : */
124void aout_FormatsPrint(vlc_object_t *, const char *,
125 const audio_sample_format_t *,
126 const audio_sample_format_t *);
127#define aout_FormatsPrint(o, t, a, b) \
128 aout_FormatsPrint(VLC_OBJECT(o), t, a, b)
129
130/* From dec.c */
131#define AOUT_DEC_SUCCESS 0
132#define AOUT_DEC_CHANGED 1
133#define AOUT_DEC_FAILED VLC_EGENERIC
134
136{
140 const char *str_id;
142};
143
145 const struct vlc_aout_stream_cfg *cfg);
147int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block);
148void vlc_aout_stream_GetResetStats(vlc_aout_stream *stream, unsigned *, unsigned *);
149void vlc_aout_stream_ChangePause(vlc_aout_stream *stream, bool b_paused, vlc_tick_t i_date);
150void vlc_aout_stream_ChangeRate(vlc_aout_stream *stream, float rate);
154/* Contrary to other vlc_aout_stream_*() functions, this function can be called from
155 * any threads */
157/* Called from output.c */
159 vlc_tick_t audio_ts);
161void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain);
162
163void vlc_aout_stream_RequestRestart(vlc_aout_stream *stream, unsigned);
165 vlc_tick_t audio_ts);
166
168
170{
171 static const uint32_t wave_channels[] = {
175
176 fmt->i_physical_channels = 0;
177 for (int i = 0; i < fmt->i_channels && i < AOUT_CHAN_MAX; ++i)
178 fmt->i_physical_channels |= wave_channels[i];
180}
181
182/* From filters.c */
183
184/* Extended version of aout_FiltersNew
185 *
186 * The clock, that is not mandatory, will be used to create a new slave clock
187 * for the filter visualization plugins.
188 */
190 const audio_sample_format_t *,
191 const audio_sample_format_t *,
192 const aout_filters_cfg_t *cfg) VLC_USED;
197 const char *type, const char *name,
198 const audio_sample_format_t *infmt,
199 const audio_sample_format_t *outfmt,
200 config_chain_t *cfg, bool const_fmt);
201
202#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:169
void vlc_aout_stream_NotifyGain(vlc_aout_stream *stream, float gain)
Definition: dec.c:878
int vlc_aout_stream_Play(vlc_aout_stream *stream, block_t *block)
Definition: dec.c:703
void aout_volume_SetVolume(aout_volume_t *, float)
Definition: volume.c:117
void vlc_aout_stream_Flush(vlc_aout_stream *stream)
Definition: dec.c:865
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:1007
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:860
void vlc_aout_stream_Drain(vlc_aout_stream *stream)
Definition: dec.c:904
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:814
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:417
bool vlc_aout_stream_IsDrained(vlc_aout_stream *stream)
Definition: dec.c:889
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:215
void aout_InputRequestRestart(audio_output_t *aout)
Definition: output.c:163
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:127
vlc_audio_meter_plugin * aout_AddMeterPlugin(audio_output_t *aout, const char *chain, const struct vlc_audio_meter_plugin_owner *owner)
Definition: output.c:998
void vlc_aout_stream_Delete(vlc_aout_stream *)
Stops all plugins involved in the audio output.
Definition: dec.c:321
void vlc_aout_stream_NotifyDrained(vlc_aout_stream *stream)
Definition: dec.c:884
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:826
void vlc_aout_stream_NotifyTiming(vlc_aout_stream *stream, vlc_tick_t system_ts, vlc_tick_t audio_ts)
Definition: dec.c:669
void vlc_aout_stream_ChangeRate(vlc_aout_stream *stream, float rate)
Definition: dec.c:855
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:683
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:1281
vlc_mutex_t lock
Definition: rand.c:33
Definition: vlc_aout.h:562
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 * module
Output plugin (or NULL if inactive)
Definition: aout_internal.h:49
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
bool bitexact
Definition: aout_internal.h:50
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:82
uint8_t i_channels
Definition: vlc_es.h:113
uint16_t i_physical_channels
Definition: vlc_es.h:88
Audio output object.
Definition: vlc_aout.h:155
Definition: vlc_es.h:56
Definition: vlc_configuration.h:319
Definition: vlc_filter.h:66
Structure describing a filter.
Definition: vlc_filter.h:216
Internal module descriptor.
Definition: modules.h:76
Definition: aout_internal.h:136
struct vlc_clock_t * clock
Definition: aout_internal.h:139
const audio_replay_gain_t * replay_gain
Definition: aout_internal.h:141
const audio_sample_format_t * fmt
Definition: aout_internal.h:137
const char * str_id
Definition: aout_internal.h:140
int profile
Definition: aout_internal.h:138
Definition: dec.c:43
Definition: vlc_atomic.h:46
Audio meter plugin owner structure.
Definition: vlc_aout.h:664
Definition: meter.c:34
Audio meter structure.
Definition: vlc_aout.h:677
const audio_sample_format_t * fmt
Definition: vlc_aout.h:680
Definition: clock.c:67
vlc_clock_main_t * owner
Definition: clock.c:76
vlc_tick_t delay
Definition: clock.c:77
Definition: vlc_frame.h:123
Doubly-linked list node.
Definition: vlc_list.h:44
Mutex.
Definition: vlc_threads.h:195
VLC object common members.
Definition: vlc_objects.h:45
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:1153
#define AOUT_CHAN_LFE
Definition: vlc_es.h:125
#define AOUT_CHAN_REARCENTER
Definition: vlc_es.h:120
#define AOUT_CHAN_REARLEFT
Definition: vlc_es.h:121
#define AOUT_CHAN_MIDDLELEFT
Definition: vlc_es.h:123
#define AOUT_CHAN_MIDDLERIGHT
Definition: vlc_es.h:124
#define AOUT_CHAN_REARRIGHT
Definition: vlc_es.h:122
#define AOUT_CHAN_MAX
Definition: vlc_es.h:153
#define AOUT_CHAN_RIGHT
Definition: vlc_es.h:119
#define AOUT_CHAN_CENTER
Definition: vlc_es.h:117
#define AOUT_CHAN_LEFT
Definition: vlc_es.h:118
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:45
Video and audio viewpoint struct and helpers.