mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-10 04:50:31 -04:00
feat(pcmaudio): add some more audio format checks
This commit is contained in:
parent
0f212f019a
commit
f8aed78f1c
@ -576,6 +576,19 @@ bool pcmaudio_categorizer_<LoggerPolicy>::check_aiff(
|
|||||||
iff_parser<LoggerPolicy, chunk_hdr_t, endianness::BIG> parser(
|
iff_parser<LoggerPolicy, chunk_hdr_t, endianness::BIG> parser(
|
||||||
LOG_GET_LOGGER, "AIFF", path, data, sizeof(file_hdr_t));
|
LOG_GET_LOGGER, "AIFF", path, data, sizeof(file_hdr_t));
|
||||||
|
|
||||||
|
file_hdr_t file_header;
|
||||||
|
if (!parser.read_file_header(file_header)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
file_header.size = folly::Endian::big(file_header.size);
|
||||||
|
|
||||||
|
if (file_header.size != data.size() - offsetof(file_hdr_t, form)) {
|
||||||
|
LOG_WARN << "[AIFF] " << path
|
||||||
|
<< ": unexpected file size: " << file_header.size << " (expected "
|
||||||
|
<< data.size() - offsetof(file_hdr_t, form) << ")";
|
||||||
|
}
|
||||||
|
|
||||||
bool meta_valid{false};
|
bool meta_valid{false};
|
||||||
uint32_t num_sample_frames;
|
uint32_t num_sample_frames;
|
||||||
pcmaudio_metadata meta;
|
pcmaudio_metadata meta;
|
||||||
@ -878,6 +891,16 @@ bool pcmaudio_categorizer_<LoggerPolicy>::check_wav_like(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t const expected_size =
|
||||||
|
data.size() -
|
||||||
|
(FormatPolicy::size_includes_header ? 0 : offsetof(file_hdr_t, form));
|
||||||
|
|
||||||
|
if (file_header.size != expected_size) {
|
||||||
|
LOG_WARN << "[" << FormatPolicy::format_name << "] " << path
|
||||||
|
<< ": unexpected file size: " << file_header.size << " (expected "
|
||||||
|
<< expected_size << ")";
|
||||||
|
}
|
||||||
|
|
||||||
bool meta_valid{false};
|
bool meta_valid{false};
|
||||||
pcmaudio_metadata meta;
|
pcmaudio_metadata meta;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user