xbmc
AESink.h
1 /*
2  * Copyright (C) 2010-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "cores/AudioEngine/Interfaces/AE.h" // for typedef's used in derived classes
12 #include "cores/AudioEngine/Utils/AEAudioFormat.h"
13 #include "cores/AudioEngine/Utils/AEUtil.h"
14 
15 #include <stdint.h>
16 #include <string>
17 
18 class IAESink
19 {
20 public:
21  /* return the name of this sync for logging */
22  virtual const char *GetName() = 0;
23 
24  IAESink() = default;
25  virtual ~IAESink() = default;
26 
27  /*
28  The sink does NOT have to honour anything in the format struct or the device
29  if however it does not honour what is requested, it MUST update device/format
30  with what it does support.
31  */
32  virtual bool Initialize (AEAudioFormat &format, std::string &device) = 0;
33 
34  /*
35  Deinitialize the sink for destruction
36  */
37  virtual void Deinitialize() = 0;
38 
39  /*
40  This method returns the total time in seconds of the cache.
41  */
42  virtual double GetCacheTotal() = 0;
43 
44  /*
45  This method returns latency of hardware.
46  */
47  virtual double GetLatency() { return 0.0; }
48 
56  virtual unsigned int AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) = 0;
57 
62  virtual void AddPause(unsigned int millis) {}
63 
68  virtual void GetDelay(AEDelayStatus& status) = 0;
69 
70  /*
71  Drain the sink
72  */
73  virtual void Drain() {}
74 
75  /*
76  Indicates if sink can handle volume control.
77  */
78  virtual bool HasVolume() { return false; }
79 
80  /*
81  This method sets the volume control, volume ranges from 0.0 to 1.0.
82  */
83  virtual void SetVolume(float volume) {}
84 };
85 
virtual void GetDelay(AEDelayStatus &status)=0
Return a timestamped status structure with delay and sink info.
Definition: AESink.h:18
virtual unsigned int AddPackets(uint8_t **data, unsigned int frames, unsigned int offset)=0
Adds packets to be sent out, this routine MUST block or sleep.
The audio format structure that fully defines a stream&#39;s audio information.
Definition: AEAudioFormat.h:19
Definition: AEUtil.h:27
virtual void AddPause(unsigned int millis)
instruct the sink to add a pause
Definition: AESink.h:62