File: ActiveAESound.h

package info (click to toggle)
kodi 2%3A21.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 143,076 kB
  • sloc: cpp: 694,471; xml: 52,618; ansic: 38,300; python: 7,161; sh: 4,289; javascript: 2,325; makefile: 1,791; perl: 969; java: 513; cs: 390; objc: 340
file content (71 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 *  Copyright (C) 2010-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h"
#include "cores/AudioEngine/Interfaces/AESound.h"

class DllAvUtil;

namespace XFILE
{
class CFile;
}

namespace ActiveAE
{

class CActiveAE;

class CActiveAESound : public IAESound
{
public:
  CActiveAESound (const std::string &filename, CActiveAE *ae);
  ~CActiveAESound() override;

  void Play() override;
  void Stop() override;
  bool IsPlaying() override;

  void SetChannel(AEChannel channel) override { m_channel = channel; }
  AEChannel GetChannel() override { return m_channel; }
  void SetVolume(float volume) override { m_volume = std::max(0.0f, std::min(1.0f, volume)); }
  float GetVolume() override { return m_volume; }

  uint8_t** InitSound(bool orig, SampleConfig config, int nb_samples);
  bool StoreSound(bool orig, uint8_t **buffer, int samples, int linesize);
  CSoundPacket *GetSound(bool orig);

  bool IsConverted() { return m_isConverted; }
  void SetConverted(bool state) { m_isConverted = state; }

  bool Prepare();
  void Finish();
  int GetChunkSize();
  int GetFileSize() { return m_fileSize; }
  bool IsSeekPossible() { return m_isSeekPossible; }

  static int Read(void *h, uint8_t* buf, int size);
  static int64_t Seek(void *h, int64_t pos, int whence);

protected:
  CActiveAE *m_activeAE;
  std::string m_filename;
  XFILE::CFile *m_pFile;
  bool m_isSeekPossible;
  int m_fileSize;
  float m_volume = 1.0f;
  AEChannel m_channel = AE_CH_NULL;

  CSoundPacket *m_orig_sound;
  CSoundPacket *m_dst_sound;

  bool m_isConverted;
};
}