feat: add M4A/AAC support and update application version to dev43

This commit is contained in:
2025-12-06 23:06:32 -06:00
parent 5d9ce1fdb9
commit 8be23ca4fc
7 changed files with 204 additions and 27 deletions

View File

@@ -5,6 +5,7 @@
#include "error.h"
#include "file.h"
#include "flac.h"
#include "m4a.h"
#include "mp3.h"
#include "opus.h"
#include "vorbis.h"
@@ -26,7 +27,9 @@ const char* fileToStr(enum file_types ft)
"VORBIS",
"OPUS",
"MP3",
"SID"
"SID",
"M4A",
"AAC"
};
return file_types_str[ft];
@@ -90,24 +93,37 @@ enum file_types getFileType(const char *file)
file_type = FILE_TYPE_SID;
break;
default:
/*
* MP3 without ID3 tag, ID3v1 tag is at the end of file, or MP3
* with ID3 tag at the beginning of the file.
*/
if(isMp3(file) == 0)
{
file_type = FILE_TYPE_MP3;
break;
}
/* TODO: Add this again at some point */
//printf("Unknown magic number: %#010x\n.", fileSig);
errno = FILE_NOT_SUPPORTED;
default:
/* Check for M4A/AAC/ALAC (MP4 container with ftyp atom) */
if((fileSig == 0x70797466) || /* 'ftyp' at offset 4 */
(fileSig == 0x65657266)) /* 'free' at offset 4 (some M4A files) */
{
file_type = FILE_TYPE_M4A;
break;
}
}
/* Check for raw AAC (ADTS format) - sync word 0xFFF */
if((fileSig & 0xFFF60000) == 0xFFF00000)
{
file_type = FILE_TYPE_AAC;
break;
}
err:
/*
* MP3 without ID3 tag, ID3v1 tag is at the end of file, or MP3
* with ID3 tag at the beginning of the file.
*/
if(isMp3(file) == 0)
{
file_type = FILE_TYPE_MP3;
break;
}
/* TODO: Add this again at some point */
//printf("Unknown magic number: %#010x\n.", fileSig);
errno = FILE_NOT_SUPPORTED;
break;
}err:
fclose(ftest);
return file_type;
}