MPD 0.17~git
|
00001 /* 00002 * Copyright (C) 2003-2011 The Music Player Daemon Project 00003 * http://www.musicpd.org 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #ifndef MPD_OUTPUT_INTERNAL_H 00021 #define MPD_OUTPUT_INTERNAL_H 00022 00023 #include "audio_format.h" 00024 #include "pcm_buffer.h" 00025 00026 #include <glib.h> 00027 00028 #include <time.h> 00029 00030 struct config_param; 00031 00032 enum audio_output_command { 00033 AO_COMMAND_NONE = 0, 00034 AO_COMMAND_ENABLE, 00035 AO_COMMAND_DISABLE, 00036 AO_COMMAND_OPEN, 00037 00042 AO_COMMAND_REOPEN, 00043 00044 AO_COMMAND_CLOSE, 00045 AO_COMMAND_PAUSE, 00046 00051 AO_COMMAND_DRAIN, 00052 00053 AO_COMMAND_CANCEL, 00054 AO_COMMAND_KILL 00055 }; 00056 00057 struct audio_output { 00061 const char *name; 00062 00066 const struct audio_output_plugin *plugin; 00067 00073 struct mixer *mixer; 00074 00079 bool always_on; 00080 00084 bool enabled; 00085 00090 bool really_enabled; 00091 00100 bool open; 00101 00106 bool pause; 00107 00115 bool allow_play; 00116 00122 GTimer *fail_timer; 00123 00127 struct audio_format config_audio_format; 00128 00133 struct audio_format in_audio_format; 00134 00141 struct audio_format out_audio_format; 00142 00146 struct pcm_buffer cross_fade_buffer; 00147 00152 struct filter *filter; 00153 00158 struct filter *replay_gain_filter; 00159 00164 unsigned replay_gain_serial; 00165 00171 struct filter *other_replay_gain_filter; 00172 00177 unsigned other_replay_gain_serial; 00178 00185 struct filter *convert_filter; 00186 00191 GThread *thread; 00192 00196 enum audio_output_command command; 00197 00201 const struct music_pipe *pipe; 00202 00207 GMutex *mutex; 00208 00213 GCond *cond; 00214 00219 struct player_control *player_control; 00220 00227 const struct music_chunk *chunk; 00228 00232 bool chunk_finished; 00233 }; 00234 00239 extern struct notify audio_output_client_notify; 00240 00241 static inline bool 00242 audio_output_is_open(const struct audio_output *ao) 00243 { 00244 return ao->open; 00245 } 00246 00247 static inline bool 00248 audio_output_command_is_finished(const struct audio_output *ao) 00249 { 00250 return ao->command == AO_COMMAND_NONE; 00251 } 00252 00253 struct audio_output * 00254 audio_output_new(const struct config_param *param, 00255 struct player_control *pc, 00256 GError **error_r); 00257 00258 bool 00259 ao_base_init(struct audio_output *ao, 00260 const struct audio_output_plugin *plugin, 00261 const struct config_param *param, GError **error_r); 00262 00263 void 00264 ao_base_finish(struct audio_output *ao); 00265 00266 void 00267 audio_output_free(struct audio_output *ao); 00268 00269 #endif