2 * Copyright (C) 2003-2010 The Music Player Daemon Project
3 * http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MPD_OUTPUT_INTERNAL_H
21 #define MPD_OUTPUT_INTERNAL_H
23 #include "audio_format.h"
29 enum audio_output_command
{
36 * This command is invoked when the input audio format
45 * Drains the internal (hardware) buffers of the device. This
46 * operation may take a while to complete.
56 * The device's configured display name.
61 * The plugin which implements this output device.
63 const struct audio_output_plugin
*plugin
;
66 * The plugin's internal data. It is passed to every plugin
72 * The #mixer object associated with this audio output device.
73 * May be NULL if none is available, or if software volume is
79 * Shall this output always play something (i.e. silence),
80 * even when playback is stopped?
85 * Has the user enabled this device?
90 * Is this device actually enabled, i.e. the "enable" method
96 * Is the device (already) open and functional?
98 * This attribute may only be modified by the output thread.
99 * It is protected with #mutex: write accesses inside the
100 * output thread and read accesses outside of it may only be
101 * performed while the lock is held.
106 * Is the device paused? i.e. the output thread is in the
112 * If not NULL, the device has failed, and this timer is used
113 * to estimate how long it should stay disabled (unless
114 * explicitly reopened with "play").
119 * The configured audio format.
121 struct audio_format config_audio_format
;
124 * The audio_format in which audio data is received from the
125 * player thread (which in turn receives it from the decoder).
127 struct audio_format in_audio_format
;
130 * The audio_format which is really sent to the device. This
131 * is basically config_audio_format (if configured) or
132 * in_audio_format, but may have been modified by
135 struct audio_format out_audio_format
;
138 * The filter object of this audio output. This is an
139 * instance of chain_filter_plugin.
141 struct filter
*filter
;
144 * The replay_gain_filter_plugin instance of this audio
147 struct filter
*replay_gain_filter
;
150 * The serial number of the last replay gain info. 0 means no
151 * replay gain info was available.
153 unsigned replay_gain_serial
;
156 * The convert_filter_plugin instance of this audio output.
157 * It is the last item in the filter chain, and is responsible
158 * for converting the input data into the appropriate format
159 * for this audio output.
161 struct filter
*convert_filter
;
164 * The thread handle, or NULL if the output thread isn't
170 * The next command to be performed by the output thread.
172 enum audio_output_command command
;
175 * The music pipe which provides music chunks to be played.
177 const struct music_pipe
*pipe
;
180 * This mutex protects #open, #chunk and #chunk_finished.
185 * This condition object wakes up the output thread after
186 * #command has been set.
191 * The #music_chunk which is currently being played. All
192 * chunks before this one may be returned to the
193 * #music_buffer, because they are not going to be used by
194 * this output anymore.
196 const struct music_chunk
*chunk
;
199 * Has the output finished playing #chunk?
205 * Notify object used by the thread's client, i.e. we will send a
206 * notify signal to this object, expecting the caller to wait on it.
208 extern struct notify audio_output_client_notify
;
211 audio_output_is_open(const struct audio_output
*ao
)
217 audio_output_command_is_finished(const struct audio_output
*ao
)
219 return ao
->command
== AO_COMMAND_NONE
;