CuteLogger
Fast and simple logging solution for Qt based applications
sa3d.h
1#pragma once
2/*****************************************************************************
3 *
4 * Copyright 2016 Varol Okan. All rights reserved.
5 * Copyright (c) 2024 Meltytech, LLC
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ****************************************************************************/
20
21/* MPEG SA3D Box processing class
22 * This class enables the injection of SA2D MPEG-4. The SA3D box
23 * specification as outlned in
24 * https://github.com/google/spatial-media/docs/spatial-audio-rfc.md
25 */
26
27#include <stdint.h>
28
29#include <fstream>
30#include <vector>
31#include <map>
32
33#include "box.h"
34
35class SA3DBox : public Box
36{
37 public:
38 enum ePosition { None };
39
40 SA3DBox ();
41 virtual ~SA3DBox ( );
42
43 // Loads the SA3D box located at position pos in a mp4 file.
44 static Box *load ( std::fstream &fs, uint32_t iPos, uint32_t iEnd );
45
46 static Box *create ( int32_t iNumChannels );
47
48 virtual void save ( std::fstream &fsIn, std::fstream &fsOut, int32_t );
49 const char *ambisonic_type_name ( );
50 const char *ambisonic_channel_ordering_name ( );
51 const char *ambisonic_normalization_name ( );
52 void print_box ( );
53
54 std::string get_metadata_string ( );
55
56 private:
57 std::string mapToString ( );
58
59 public:
60 std::map<std::string, int32_t> m_AmbisonicTypes;
61 std::map<std::string, int32_t> m_AmbisonicOrderings;
62 std::map<std::string, int32_t> m_AmbisonicNormalizations;
63
64// int32_t m_iPosition;
65 uint8_t m_iVersion;
66 uint8_t m_iAmbisonicType;
67 uint32_t m_iAmbisonicOrder;
68 uint8_t m_iAmbisonicChannelOrdering;
69 uint8_t m_iAmbisonicNormalization;
70 uint32_t m_iNumChannels;
71 std::vector<uint32_t> m_ChannelMap;
72};
73