3 * Copyright (C) 2010-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
22 #include "threads/Thread.h"
24 #include "AEAudioFormat.h"
25 #include "utils/StdString.h"
31 /* return the name of this sync for logging */
32 virtual const char *GetName() = 0;
35 virtual ~IAESink() {};
38 The sink does NOT have to honour anything in the format struct or the device
39 if however it does not honour what is requested, it MUST update device/format
40 with what it does support.
42 virtual bool Initialize (AEAudioFormat &format, std::string &device) = 0;
45 Deinitialize the sink for destruction
47 virtual void Deinitialize() = 0;
50 Return true if the supplied format and device are compatible with the current open sink
52 virtual bool IsCompatible(const AEAudioFormat &format, const std::string &device) = 0;
55 This method returns the time in seconds that it will take
56 for the next added packet to be heard from the speakers.
58 virtual double GetDelay() = 0;
61 This method returns the time in seconds that it will take
62 to underrun the cache if no sample is added.
64 virtual double GetCacheTime() = 0;
67 This method returns the total time in seconds of the cache.
69 virtual double GetCacheTotal() = 0;
72 Adds packets to be sent out, this routine MUST block or sleep.
74 virtual unsigned int AddPackets(uint8_t *data, unsigned int frames, bool hasAudio, bool blocking = false) = 0;
79 virtual void Drain() {};
82 Indicates if sink can handle volume control.
84 virtual bool HasVolume() {return false;};
87 This method sets the volume control, volume ranges from 0.0 to 1.0.
89 virtual void SetVolume(float volume) {};
92 Requests sink to prepare itself for a suspend state
93 @return false if sink cannot be suspended
95 virtual bool SoftSuspend() {return false;};
98 Notify sink to prepare to resume processing after suspend state
99 @return false if sink must be reinitialized
101 virtual bool SoftResume() {return false;};