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.
21 * Functions for dealing with all configured (enabled) audion outputs
37 * Global initialization: load audio outputs from the configuration
38 * file and initialize them.
41 audio_output_all_init(void);
44 * Global finalization: free memory occupied by audio outputs. All
47 audio_output_all_finish(void);
50 * Returns the total number of audio output devices, including those
51 * who are disabled right now.
53 unsigned int audio_output_count(void);
56 * Returns the "i"th audio output device.
59 audio_output_get(unsigned i
);
62 * Returns the audio output device with the specified name. Returns
63 * NULL if the name does not exist.
66 audio_output_find(const char *name
);
69 * Checks the "enabled" flag of all audio outputs, and if one has
70 * changed, commit the change.
73 audio_output_all_enable_disable(void);
76 * Opens all audio outputs which are not disabled.
78 * @param audio_format the preferred audio format, or NULL to reuse
80 * @param buffer the #music_buffer where consumed #music_chunk objects
82 * @return true on success, false on failure
85 audio_output_all_open(const struct audio_format
*audio_format
,
86 struct music_buffer
*buffer
);
89 * Closes all audio outputs.
92 audio_output_all_close(void);
95 * Closes all audio outputs. Outputs with the "always_on" flag are
96 * put into pause mode.
99 audio_output_all_release(void);
102 * Enqueue a #music_chunk object for playing, i.e. pushes it to a
105 * @param chunk the #music_chunk object to be played
106 * @return true on success, false if no audio output was able to play
110 audio_output_all_play(struct music_chunk
*chunk
);
113 * Checks if the output devices have drained their music pipe, and
114 * returns the consumed music chunks to the #music_buffer.
116 * @return the number of chunks to play left in the #music_pipe
119 audio_output_all_check(void);
122 * Checks if the size of the #music_pipe is below the #threshold. If
123 * not, it attempts to synchronize with all output threads, and waits
124 * until another #music_chunk is finished.
126 * @param threshold the maximum number of chunks in the pipe
127 * @return true if there are less than #threshold chunks in the pipe
130 audio_output_all_wait(unsigned threshold
);
133 * Puts all audio outputs into pause mode. Most implementations will
134 * simply close it then.
137 audio_output_all_pause(void);
140 * Drain all audio outputs.
143 audio_output_all_drain(void);
146 * Try to cancel data which may still be in the device's buffers.
149 audio_output_all_cancel(void);
152 * Indicate that a new song will begin now.
155 audio_output_all_song_border(void);
158 * Returns the "elapsed_time" stamp of the most recently finished
159 * chunk. A negative value is returned when no chunk has been
163 audio_output_all_get_elapsed_time(void);