xbmc
AEBitstreamPacker.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 "AEChannelInfo.h"
12 #include "AEPackIEC61937.h"
13 
14 #include <list>
15 #include <stdint.h>
16 #include <vector>
17 
18 class CAEStreamInfo;
19 
21 {
22 public:
25 
26  void Pack(CAEStreamInfo &info, uint8_t* data, int size);
27  bool PackPause(CAEStreamInfo &info, unsigned int millis, bool iecBursts);
28  void Reset();
29  uint8_t* GetBuffer();
30  unsigned int GetSize() const;
31  static unsigned int GetOutputRate(const CAEStreamInfo& info);
32  static CAEChannelInfo GetOutputChannelMap(const CAEStreamInfo& info);
33 
34 private:
35  void PackTrueHD(CAEStreamInfo &info, uint8_t* data, int size);
36  void PackDTSHD(CAEStreamInfo &info, uint8_t* data, int size);
37  void PackEAC3(CAEStreamInfo &info, uint8_t* data, int size);
38 
39  /* we keep the trueHD and dtsHD buffers separate so that we can handle a fast stream switch */
40  std::vector<uint8_t> m_trueHD[2];
41 
42  struct TrueHD
43  {
44  int prevFrameSize;
45  int samplesPerFrame;
46  int bufferFilled;
47  int bufferIndex;
48  uint16_t prevFrameTime;
49  uint8_t* outputBuffer;
50  };
51 
52  TrueHD m_thd{};
53 
54  std::vector<uint8_t> m_dtsHD;
55  unsigned int m_dtsHDSize = 0;
56 
57  std::vector<uint8_t> m_eac3;
58  unsigned int m_eac3Size = 0;
59  unsigned int m_eac3FramesCount = 0;
60  unsigned int m_eac3FramesPerBurst = 0;
61 
62  unsigned int m_dataSize = 0;
63  uint8_t m_packedBuffer[MAX_IEC61937_PACKET];
64  unsigned int m_pauseDuration = 0;
65 };
66 
Definition: AEStreamInfo.h:22
Definition: AEBitstreamPacker.h:20
Definition: AEChannelInfo.h:19