arduino-audio-tools
Loading...
Searching...
No Matches
HeaderParserAAC.h
Go to the documentation of this file.
1#pragma once
4
5namespace audio_tools {
6
17 public:
20 bool isValid(const uint8_t* data, int len) {
21 if (len < 7) return false;
22 parser.begin();
23 // regular validation
24 if (!parser.parse((uint8_t*)data)) return false;
25 // check if we have a valid 2nd frame
26 if (len > getFrameLength()) {
27 int pos = findSyncWord(data, len, getFrameLength());
28 if (pos == -1) return false;
29 }
30 return true;
31 }
32
34
36
39
41 int findSyncWord(const uint8_t* buf, int nBytes, int start = 0) {
42 return parser.findSyncWord(buf, nBytes, start);
43 }
44
46
47 protected:
49};
50
51} // namespace audio_tools
Structure to hold ADTS header field values.
Definition CodecADTS.h:18
ADTSHeader & data()
Definition CodecADTS.h:100
int findSyncWord(const uint8_t *buf, int nBytes, int start=0)
Definition CodecADTS.h:92
bool begin()
Definition CodecADTS.h:38
int getSampleRate()
Definition CodecADTS.h:81
bool parse(uint8_t *hdr)
Definition CodecADTS.h:44
uint32_t getFrameLength()
Definition CodecADTS.h:73
AAC header parser to check if the data is a valid ADTS aac which can extract some relevant audio info...
Definition HeaderParserAAC.h:16
int findSyncWord(const uint8_t *buf, int nBytes, int start=0)
Finds the mp3/aac sync word.
Definition HeaderParserAAC.h:41
ADTSParser parser
Definition HeaderParserAAC.h:48
int getSampleRate()
Definition HeaderParserAAC.h:33
int getFrameLength()
Determines the frame length.
Definition HeaderParserAAC.h:38
uint8_t getChannels()
Definition HeaderParserAAC.h:35
ADTSParser::ADTSHeader getHeader()
Definition HeaderParserAAC.h:45
bool isValid(const uint8_t *data, int len)
Definition HeaderParserAAC.h:20
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10
size_t writeData(Print *p_out, T *data, int samples, int maxSamples=512)
Definition AudioTypes.h:512
Definition CodecADTS.h:20
uint8_t channel_cfg
Definition CodecADTS.h:28