configure.ac: Move the encoders before the audio outputs.
[mpd-mk.git] / src / output_all.h
bloba579bf5f1f52d0e97c46d46ca010279ca743b1f0
1 /*
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
22 * at once.
26 #ifndef OUTPUT_ALL_H
27 #define OUTPUT_ALL_H
29 #include <stdbool.h>
30 #include <stddef.h>
32 struct audio_format;
33 struct music_buffer;
34 struct music_chunk;
36 /**
37 * Global initialization: load audio outputs from the configuration
38 * file and initialize them.
40 void
41 audio_output_all_init(void);
43 /**
44 * Global finalization: free memory occupied by audio outputs. All
46 void
47 audio_output_all_finish(void);
49 /**
50 * Returns the total number of audio output devices, including those
51 * who are disabled right now.
53 unsigned int audio_output_count(void);
55 /**
56 * Returns the "i"th audio output device.
58 struct audio_output *
59 audio_output_get(unsigned i);
61 /**
62 * Returns the audio output device with the specified name. Returns
63 * NULL if the name does not exist.
65 struct audio_output *
66 audio_output_find(const char *name);
68 /**
69 * Checks the "enabled" flag of all audio outputs, and if one has
70 * changed, commit the change.
72 void
73 audio_output_all_enable_disable(void);
75 /**
76 * Opens all audio outputs which are not disabled.
78 * @param audio_format the preferred audio format, or NULL to reuse
79 * the previous format
80 * @param buffer the #music_buffer where consumed #music_chunk objects
81 * should be returned
82 * @return true on success, false on failure
84 bool
85 audio_output_all_open(const struct audio_format *audio_format,
86 struct music_buffer *buffer);
88 /**
89 * Closes all audio outputs.
91 void
92 audio_output_all_close(void);
94 /**
95 * Closes all audio outputs. Outputs with the "always_on" flag are
96 * put into pause mode.
98 void
99 audio_output_all_release(void);
102 * Enqueue a #music_chunk object for playing, i.e. pushes it to a
103 * #music_pipe.
105 * @param chunk the #music_chunk object to be played
106 * @return true on success, false if no audio output was able to play
107 * (all closed then)
109 bool
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
118 unsigned
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
129 bool
130 audio_output_all_wait(unsigned threshold);
133 * Puts all audio outputs into pause mode. Most implementations will
134 * simply close it then.
136 void
137 audio_output_all_pause(void);
140 * Drain all audio outputs.
142 void
143 audio_output_all_drain(void);
146 * Try to cancel data which may still be in the device's buffers.
148 void
149 audio_output_all_cancel(void);
152 * Indicate that a new song will begin now.
154 void
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
160 * finished yet.
162 float
163 audio_output_all_get_elapsed_time(void);
165 #endif