kodi
AESinkOSS.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/AESink.h"
12 #include "cores/AudioEngine/Utils/AEDeviceInfo.h"
13 #include "threads/CriticalSection.h"
14 
15 #include <stdint.h>
16 
17 class CAESinkOSS : public IAESink
18 {
19 public:
20  const char *GetName() override { return "OSS"; }
21 
22  CAESinkOSS();
23  ~CAESinkOSS() override;
24 
25  static void Register();
26  static std::unique_ptr<IAESink> Create(std::string& device, AEAudioFormat& desiredFormat);
27  static void EnumerateDevicesEx(AEDeviceInfoList &list, bool force = false);
28 
29  bool Initialize(AEAudioFormat &format, std::string &device) override;
30  void Deinitialize() override;
31 
32  virtual void Stop();
33  void GetDelay(AEDelayStatus& status) override;
34  double GetCacheTotal() override { return 0.0; } /* FIXME */
35  unsigned int AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) override;
36  void Drain() override;
37 private:
38  int m_fd;
39  std::string m_device;
40  AEAudioFormat m_initFormat;
41  AEAudioFormat m_format;
42 
43  CAEChannelInfo GetChannelLayout(const AEAudioFormat& format);
44  std::string GetDeviceUse(const AEAudioFormat& format, const std::string &device);
45 };
46 
unsigned int AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) override
Adds packets to be sent out, this routine MUST block or sleep.
Definition: AESinkOSS.cpp:417
Definition: AESink.h:18
The audio format structure that fully defines a stream&#39;s audio information.
Definition: AEAudioFormat.h:19
void GetDelay(AEDelayStatus &status) override
Return a timestamped status structure with delay and sink info.
Definition: AESinkOSS.cpp:399
Definition: AEUtil.h:27
Definition: AESinkOSS.h:17
Definition: AEChannelInfo.h:19