CuteLogger
Fast and simple logging solution for Qt based applications
constants.h
1 #pragma once
2 /*****************************************************************************
3  *
4  * Copyright 2016 Varol Okan. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  ****************************************************************************/
19 
20 #include <stdint.h>
21 #include <string>
22 
23 #include <QtEndian>
24 #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
25 # define htobe16(x) qToBigEndian(x)
26 # define htole16(x) qToLittleEndian(x)
27 # define be16toh(x) qFromBigEndian(x)
28 # define le16toh(x) qFromLittleEndian(x)
29 # define htobe32(x) qToBigEndian(x)
30 # define htole32(x) qToLittleEndian(x)
31 # define be32toh(x) qFromBigEndian(x)
32 # define le32toh(x) qFromLittleEndian(x)
33 # define htobe64(x) qToBigEndian(x)
34 # define htole64(x) qtoLittleEndian(x)
35 # define be64toh(x) qFromBigEndian(x)
36 # define le64toh(x) qFromLittleEndian(x)
37 #else
38 # include <endian.h>
39 #endif
40 
41 struct AudioMetadata {
42  AudioMetadata ( ) {
43  ambisonic_order = 1;
44  ambisonic_type = "periphonic";
45  ambisonic_channel_ordering = "ACN";
46  ambisonic_normalization = "SN3D";
47  for ( uint32_t t=0; t<4; t++ )
48  channel_map[t] = t;
49  };
50  uint32_t ambisonic_order;
51  std::string ambisonic_type;
52  std::string ambisonic_channel_ordering;
53  std::string ambisonic_normalization;
54  uint32_t channel_map[4];
55 };
56 
57 // MPEG-4 constants
58 namespace constants
59 {
60 
61 static const char *TRAK_TYPE_VIDE = "vide";
62 
63 // Leaf types.
64 static const char *TAG_STCO = "stco";
65 static const char *TAG_CO64 = "co64";
66 static const char *TAG_FREE = "free";
67 static const char *TAG_MDAT = "mdat";
68 static const char *TAG_XML = "xml ";
69 static const char *TAG_HDLR = "hdlr";
70 static const char *TAG_FTYP = "ftyp";
71 static const char *TAG_ESDS = "esds";
72 static const char *TAG_SOUN = "soun";
73 static const char *TAG_SA3D = "SA3D";
74 
75 // Container types.
76 static const char *TAG_MOOV = "moov";
77 static const char *TAG_UDTA = "udta";
78 static const char *TAG_META = "meta";
79 static const char *TAG_TRAK = "trak";
80 static const char *TAG_MDIA = "mdia";
81 static const char *TAG_MINF = "minf";
82 static const char *TAG_STBL = "stbl";
83 static const char *TAG_STSD = "stsd";
84 static const char *TAG_UUID = "uuid";
85 static const char *TAG_WAVE = "wave";
86 
87 // Sound sample descriptions.
88 static const char *TAG_NONE = "NONE";
89 static const char *TAG_RAW_ = "raw ";
90 static const char *TAG_TWOS = "twos";
91 static const char *TAG_SOWT = "sowt";
92 static const char *TAG_FL32 = "fl32";
93 static const char *TAG_FL64 = "fl64";
94 static const char *TAG_IN24 = "in24";
95 static const char *TAG_IN32 = "in32";
96 static const char *TAG_ULAW = "ulaw";
97 static const char *TAG_ALAW = "alaw";
98 static const char *TAG_LPCM = "lpcm";
99 static const char *TAG_MP4A = "mp4a";
100 
101 static const char * SOUND_SAMPLE_DESCRIPTIONS[12] = {
102  TAG_NONE,
103  TAG_RAW_,
104  TAG_TWOS,
105  TAG_SOWT,
106  TAG_FL32,
107  TAG_FL64,
108  TAG_IN24,
109  TAG_IN32,
110  TAG_ULAW,
111  TAG_ALAW,
112  TAG_LPCM,
113  TAG_MP4A
114 };
115 
116 static const char * CONTAINERS_LIST[20] = {
117  TAG_MDIA,
118  TAG_MINF,
119  TAG_MOOV,
120  TAG_STBL,
121  TAG_STSD,
122  TAG_TRAK,
123  TAG_UDTA,
124  TAG_WAVE,
125 
126  TAG_NONE,
127  TAG_RAW_,
128  TAG_TWOS,
129  TAG_SOWT,
130  TAG_FL32,
131  TAG_FL64,
132  TAG_IN24,
133  TAG_IN32,
134  TAG_ULAW,
135  TAG_ALAW,
136  TAG_LPCM,
137  TAG_MP4A
138 };
139 
140  enum Type {
141  Box = 0,
142  Container,
143  ContainerLeaf,
144  None
145  };
146 
147 }; // End of namespace constants
148