1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<chapter> <title> The audio output layer </title>
<sect1> <title> Audio output overview </title>
<para>
This chapter documents the audio output layer known under the "audio output 3" codename. It has first been released with VLC version 0.5.0. Previous versions use an antic API, which is no longer documented nor supported. You definitely should write new code only for aout3 and later.
</para>
<para>
The audio output's main purpose is to take sound samples from one or several decoders (called "input streams" in this chapter), to mix them and write them to an output device (called "output stream"). During this process, transformations may be needed or asked by the user, and they will be performed by audio filters.
</para>
<para>
(insert here a schematic of the data flow in aout3)
</para>
<sect2> <title> Typical runcourse </title>
<para>
The input spawns a new decoder audio decoder, say for instance an A/52 decoder. The A/52 decoder parses the sync info for format information, and creates a new aout "input stream" whith aout_InputNew().
</para>
</sect2>
</sect1>
<sect1> <title> API for the decoders </title>
</sect1>
<sect1> <title> API for the output module </title>
</sect1>
<sect1> <title> Writing an audio filter </title>
</sect1>
<sect1> <title> Writing an audio mixer </title>
</sect1>
<sect1> <title> Data exchanges between a decoder and the audio output
</title>
<para>
The audio output basically takes audio samples from one or several
FIFOs, mixes and resamples them, and plays them through the audio
chip. Data exchanges are simple and described in <filename>
src/audio_output/audio_output.c.</filename> A decoder needs to open
a channel FIFO with <function> aout_CreateFifo </function>, and
then write the data to the buffer. The buffer is in <parameter>
p_aout_fifo->buffer + p_aout_fifo->l_end_frame </parameter>
* <constant> ADEC_FRAME_SIZE</constant>.
</para>
</sect1>
<sect1> <title> How to write an audio output plugin </title>
<para>
[This API is subject to change in the very near future.] Have a look at
<filename> plugins/dsp/aout_dsp.c</filename>. You need to write six
functions :
</para>
<itemizedlist>
<listitem> <para> <type> int </type> <function> aout_Probe </function>
<parameter> ( probedata_t *p_data ) </parameter> :
Returns a score between 0 and 999 to tell whether the plugin
can be used. <parameter> p_data </parameter> is currently
unused.
</para> </listitem>
<listitem> <para> <type> int </type> <function> aout_Open </function>
<parameter> ( aout_thread_t *p_aout ) </parameter> :
Opens the audio device.
</para> </listitem>
<listitem> <para> <type> int </type> <function> aout_SetFormat
</function> <parameter> ( aout_thread_t *p_aout ) </parameter> :
Sets the output format, the number of channels, and the output
rate.
</para> </listitem>
<listitem> <para> <type> long </type> <function> aout_GetBufInfo
</function> <parameter> ( aout_thread_t *p_aout,
long l_buffer_limit ) </parameter> :
Gets the status of the audio buffer.
</para> </listitem>
<listitem> <para> <function> aout_Play </function> <parameter>
( aout_thread_t *p_aout, byte_t *buffer, int i_size )
</parameter> :
Writes the audio output buffer to the audio device.
</para> </listitem>
<listitem> <para> <function> aout_Close </function> <parameter>
( aout_thread_t *p_aout ) </parameter> :
Closes the audio device.
</para> </listitem>
</itemizedlist>
</sect1>
</chapter>