Skip to content

Commit e6ffae7

Browse files
committed
MimeDetector comments
1 parent faefadc commit e6ffae7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/AudioTools/CoreAudio/AudioMetaData/MimeDetector.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#include "AudioTools/CoreAudio/AudioBasic/StrView.h"
43
#include "AudioTools/AudioCodecs/MP3HeaderParser.h"
4+
#include "AudioTools/CoreAudio/AudioBasic/StrView.h"
55

66
namespace audio_tools {
77

@@ -10,6 +10,9 @@ namespace audio_tools {
1010
* By default the following mime types are supported (audio/aac, audio/mpeg,
1111
* audio/vnd.wave, audio/ogg). You can register your own custom detection logic
1212
* to cover additional file types.
13+
*
14+
* Please not that the distinction between mp3 and aac is difficult and might
15+
* fail is some cases
1316
* @ingroup codecs
1417
* @ingroup decoder
1518
* @author Phil Schatzmann
@@ -67,15 +70,16 @@ class MimeDetector {
6770

6871
static bool checkAACExt(uint8_t* start, size_t len) {
6972
// quick check
70-
if (!(start[0] == 0xFF && (start[1] == 0xF0 || start[1] == 0xF1 || start[1] == 0xF9)))
73+
if (!(start[0] == 0xFF &&
74+
(start[1] == 0xF0 || start[1] == 0xF1 || start[1] == 0xF9)))
7175
return false;
7276
MP3HeaderParser mp3;
7377
// it should start with a synch word
74-
if (mp3.findSyncWord((const uint8_t*)start, len)!=0){
78+
if (mp3.findSyncWord((const uint8_t*)start, len) != 0) {
7579
return false;
7680
}
7781
// make sure that it is not an mp3
78-
if (mp3.isValid(start, len)){
82+
if (mp3.isValid(start, len)) {
7983
return false;
8084
}
8185
return true;

0 commit comments

Comments
 (0)