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 #include <limits>
23 
24 #include <QtEndian>
25 #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
26 # define htobe16(x) qToBigEndian(x)
27 # define htole16(x) qToLittleEndian(x)
28 # define be16toh(x) qFromBigEndian(x)
29 # define le16toh(x) qFromLittleEndian(x)
30 # define htobe32(x) qToBigEndian(x)
31 # define htole32(x) qToLittleEndian(x)
32 # define be32toh(x) qFromBigEndian(x)
33 # define le32toh(x) qFromLittleEndian(x)
34 # define htobe64(x) qToBigEndian(x)
35 # define htole64(x) qtoLittleEndian(x)
36 # define be64toh(x) qFromBigEndian(x)
37 # define le64toh(x) qFromLittleEndian(x)
38 #elif !defined(__FreeBSD__)
39 # include <endian.h>
40 #elif defined(__FreeBSD__)
41 # include <sys/endian.h>
42 #endif
43 
44 struct AudioMetadata {
45  AudioMetadata ( ) {
46  ambisonic_order = 1;
47  ambisonic_type = "periphonic";
48  ambisonic_channel_ordering = "ACN";
49  ambisonic_normalization = "SN3D";
50  for ( uint32_t t=0; t<4; t++ )
51  channel_map[t] = t;
52  };
53  uint32_t ambisonic_order;
54  std::string ambisonic_type;
55  std::string ambisonic_channel_ordering;
56  std::string ambisonic_normalization;
57  uint32_t channel_map[4];
58 };
59 
60 // MPEG-4 constants
61 namespace constants
62 {
63 
64 static const char *TRAK_TYPE_VIDE = "vide";
65 
66 // Leaf types.
67 static const char *TAG_STCO = "stco";
68 static const char *TAG_CO64 = "co64";
69 static const char *TAG_FREE = "free";
70 static const char *TAG_MDAT = "mdat";
71 static const char *TAG_XML = "xml ";
72 static const char *TAG_HDLR = "hdlr";
73 static const char *TAG_FTYP = "ftyp";
74 static const char *TAG_ESDS = "esds";
75 static const char *TAG_SOUN = "soun";
76 static const char *TAG_SA3D = "SA3D";
77 
78 // Container types.
79 static const char *TAG_MOOV = "moov";
80 static const char *TAG_UDTA = "udta";
81 static const char *TAG_META = "meta";
82 static const char *TAG_TRAK = "trak";
83 static const char *TAG_MDIA = "mdia";
84 static const char *TAG_MINF = "minf";
85 static const char *TAG_STBL = "stbl";
86 static const char *TAG_STSD = "stsd";
87 static const char *TAG_UUID = "uuid";
88 static const char *TAG_WAVE = "wave";
89 
90 // Sound sample descriptions.
91 static const char *TAG_NONE = "NONE";
92 static const char *TAG_RAW_ = "raw ";
93 static const char *TAG_TWOS = "twos";
94 static const char *TAG_SOWT = "sowt";
95 static const char *TAG_FL32 = "fl32";
96 static const char *TAG_FL64 = "fl64";
97 static const char *TAG_IN24 = "in24";
98 static const char *TAG_IN32 = "in32";
99 static const char *TAG_ULAW = "ulaw";
100 static const char *TAG_ALAW = "alaw";
101 static const char *TAG_LPCM = "lpcm";
102 static const char *TAG_MP4A = "mp4a";
103 
104 static const char * SOUND_SAMPLE_DESCRIPTIONS[12] = {
105  TAG_NONE,
106  TAG_RAW_,
107  TAG_TWOS,
108  TAG_SOWT,
109  TAG_FL32,
110  TAG_FL64,
111  TAG_IN24,
112  TAG_IN32,
113  TAG_ULAW,
114  TAG_ALAW,
115  TAG_LPCM,
116  TAG_MP4A
117 };
118 
119 static const char * CONTAINERS_LIST[20] = {
120  TAG_MDIA,
121  TAG_MINF,
122  TAG_MOOV,
123  TAG_STBL,
124  TAG_STSD,
125  TAG_TRAK,
126  TAG_UDTA,
127  TAG_WAVE,
128 
129  TAG_NONE,
130  TAG_RAW_,
131  TAG_TWOS,
132  TAG_SOWT,
133  TAG_FL32,
134  TAG_FL64,
135  TAG_IN24,
136  TAG_IN32,
137  TAG_ULAW,
138  TAG_ALAW,
139  TAG_LPCM,
140  TAG_MP4A
141 };
142 
143  enum Type {
144  Box = 0,
145  Container,
146  ContainerLeaf,
147  None
148  };
149 
150 }; // End of namespace constants
151