[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / cores / AudioEngine / Utils / PackerMAT.h
blob476f049487d3c71bc5f242327a9cb2b468c773dd
1 /*
2 * Copyright (C) 2024 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <deque>
12 #include <stdint.h>
13 #include <vector>
15 enum class Type
17 PADDING,
18 DATA,
21 class CPackerMAT
23 public:
24 CPackerMAT();
25 ~CPackerMAT() = default;
27 bool PackTrueHD(const uint8_t* data, int size);
28 std::vector<uint8_t> GetOutputFrame();
30 private:
31 struct MATState
33 bool init; // differentiates the first header
35 // audio_sampling_frequency:
36 // 0 -> 48 kHz
37 // 1 -> 96 kHz
38 // 2 -> 192 kHz
39 // 8 -> 44.1 kHz
40 // 9 -> 88.2 kHz
41 // 10 -> 176.4 kHz
42 int ratebits;
44 // input timing of previous audio unit used to calculate padding bytes
45 uint16_t prevFrametime;
46 bool prevFrametimeValid;
48 uint32_t matFramesize; // size in bytes of current MAT frame
49 uint32_t prevMatFramesize; // size in bytes of previous MAT frame
51 uint32_t padding; // padding bytes pending to write
54 void WriteHeader();
55 void WritePadding();
56 void AppendData(const uint8_t* data, int size, Type type);
57 uint32_t GetCount() const { return m_bufferCount; }
58 int FillDataBuffer(const uint8_t* data, int size, Type type);
59 void FlushPacket();
61 MATState m_state{};
63 uint32_t m_bufferCount{0};
64 std::vector<uint8_t> m_buffer;
65 std::deque<std::vector<uint8_t>> m_outputQueue;