summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/splay/mpegAudioHeader.h
blob: ff5b885a0e06925e978b42dcf81cb5a7a92cea84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
  stores information after we found a header.
  Copyright (C) 2000  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */



#ifndef __MPEGHEADERINFO_H
#define __MPEGHEADERINFO_H


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define _FREQUENCY_44100 0
#define _FREQUENCY_48000 1
#define _FREQUENCY_32000 2

#define _MODE_FULLSTEREO 0
#define _MODE_JOINT      1
#define _MODE_DUAL       2
#define _MODE_SINGLE     3

#define _VERSION_1       0
#define _VERSION_2       1


#define MAXSUBBAND         32
#define SCALEBLOCK         12



class MpegAudioHeader {

  int protection;
  int layer;
  int version;
  int padding;
  int frequency;
  int frequencyHz;
  int bitrateindex;
  int extendedmode;
  int mode;
  int inputstereo;
  int channelbitrate;
  int tableindex;
  int subbandnumber;
  int stereobound;
  int framesize;
  int layer3slots;
  int lmpeg25;
  unsigned char header[4];
  
 public:
  MpegAudioHeader();
  ~MpegAudioHeader();

  int parseHeader(unsigned char* buf);
  
  inline int getProtection()     { return protection; }
  inline int getLayer()          { return layer; }
  inline int getVersion()        { return version; }
  inline int getPadding()        { return padding; }
  inline int getFrequency()      { return frequency; }
  inline int getFrequencyHz()    { return frequencyHz; }
  inline int getBitrateindex()   { return bitrateindex; }
  inline int getExtendedmode()   { return extendedmode; }
  inline int getMode()           { return mode; }
  inline int getInputstereo()    { return inputstereo; }
  inline int getFramesize()      { return framesize; }
  inline int getLayer25()        { return lmpeg25; } 

  // MPEG layer 2
  inline int getTableindex()     { return tableindex; }
  // MPEG layer 1/2
  inline int getSubbandnumber()  { return subbandnumber; }
  inline int getStereobound()    { return stereobound; }
  // MPEG layer 3
  inline int getLayer3slots()    { return layer3slots; }
  
  int getChannelbitrate();


  inline unsigned char* getHeader() { return header; }
  int  getpcmperframe();


  void copyTo(MpegAudioHeader* dest);

  void print(const char* name);
  void printStates(const char* name);
};
#endif