MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
vorbis.h
Go to the documentation of this file.
1 #pragma once
2 #include <cmath>
3 #include <sys/types.h>
4 #include <stdint.h>
5 #include <string>
6 #include <deque>
7 
8 namespace vorbis{
9  struct mode{
10  bool blockFlag;
11  unsigned short windowType;
12  unsigned short transformType;
13  char mapping;
14  };
15 
16  inline unsigned int ilog(unsigned int input){
17  return (std::log(input))/(std::log(2))+1;
18  }
19 
20  bool isHeader(const char * newData, unsigned int length);
21  class header{
22  public:
23  ~header();
24  header(char* newData, unsigned int length);
25  int getHeaderType();
26  long unsigned int getVorbisVersion();
27  char getAudioChannels();
28  long unsigned int getAudioSampleRate();
29  long unsigned int getBitrateMaximum();
30  long unsigned int getBitrateNominal();
31  long unsigned int getBitrateMinimum();
32  char getBlockSize0();
33  char getBlockSize1();
34  char getFramingFlag();
35  std::string toPrettyString(size_t indent = 0);
36  std::deque<mode> readModeDeque(char audioChannels);
37  bool isHeader();
38  unsigned int getDataSize(){
39  return datasize;
40  }
41  protected:
42  uint32_t getInt32(size_t index);
43  uint32_t getInt24(size_t index);
44  uint16_t getInt16(size_t index);
45  private:
46  std::deque<mode> modes;
47  char* data;
48  unsigned int datasize;
49  bool checkDataSize(unsigned int size);
50  bool validate();
51  };
52 }
unsigned short windowType
Definition: vorbis.h:11
Definition: vorbis.cpp:13
unsigned int getDataSize()
Definition: vorbis.h:38
function log()
Definition: minified.js:159
bool isHeader(const char *newData, unsigned int length)
Definition: vorbis.cpp:160
unsigned int ilog(unsigned int input)
Definition: vorbis.h:16
unsigned short transformType
Definition: vorbis.h:12
char mapping
Definition: vorbis.h:13
bool blockFlag
Definition: vorbis.h:10