MPD

src/output_internal.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2010 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 enum audio_output_command {
00031         AO_COMMAND_NONE = 0,
00032         AO_COMMAND_ENABLE,
00033         AO_COMMAND_DISABLE,
00034         AO_COMMAND_OPEN,
00035 
00040         AO_COMMAND_REOPEN,
00041 
00042         AO_COMMAND_CLOSE,
00043         AO_COMMAND_PAUSE,
00044 
00049         AO_COMMAND_DRAIN,
00050 
00051         AO_COMMAND_CANCEL,
00052         AO_COMMAND_KILL
00053 };
00054 
00055 struct audio_output {
00059         const char *name;
00060 
00064         const struct audio_output_plugin *plugin;
00065 
00070         void *data;
00071 
00077         struct mixer *mixer;
00078 
00083         bool always_on;
00084 
00088         bool enabled;
00089 
00094         bool really_enabled;
00095 
00104         bool open;
00105 
00110         bool pause;
00111 
00117         GTimer *fail_timer;
00118 
00122         struct audio_format config_audio_format;
00123 
00128         struct audio_format in_audio_format;
00129 
00136         struct audio_format out_audio_format;
00137 
00141         struct pcm_buffer cross_fade_buffer;
00142 
00147         struct filter *filter;
00148 
00153         struct filter *replay_gain_filter;
00154 
00159         unsigned replay_gain_serial;
00160 
00166         struct filter *other_replay_gain_filter;
00167 
00172         unsigned other_replay_gain_serial;
00173 
00180         struct filter *convert_filter;
00181 
00186         GThread *thread;
00187 
00191         enum audio_output_command command;
00192 
00196         const struct music_pipe *pipe;
00197 
00202         GMutex *mutex;
00203 
00208         GCond *cond;
00209 
00216         const struct music_chunk *chunk;
00217 
00221         bool chunk_finished;
00222 };
00223 
00228 extern struct notify audio_output_client_notify;
00229 
00230 static inline bool
00231 audio_output_is_open(const struct audio_output *ao)
00232 {
00233         return ao->open;
00234 }
00235 
00236 static inline bool
00237 audio_output_command_is_finished(const struct audio_output *ao)
00238 {
00239         return ao->command == AO_COMMAND_NONE;
00240 }
00241 
00242 #endif