mirror of
https://github.com/schnaader/precomp-cpp
synced 2026-08-23 00:23:04 -04:00
Parsing of unsupported MP3 streams improved
- For supported MP3 streams, all frame header information must be the same for the whole stream. - For unsupported MP3 streams, this has been removed and only the stream type has to be the same. This will lead to some more false positives, but give longer streams, so the log is not bloated with thousands small false positives
This commit is contained in:
parent
68801a29ad
commit
c8dc5a0980
1 changed files with 13 additions and 7 deletions
20
precomp.cpp
20
precomp.cpp
|
|
@ -3705,13 +3705,19 @@ bool compress_file(float min_percent, float max_percent) {
|
|||
if ((type != MPEG1_LAYER_III) && (saved_input_file_pos <= suppress_mp3_type_until[type])) {
|
||||
break;
|
||||
}
|
||||
} else if (
|
||||
(mpeg != ((in[1] >> 3) & 0x3)) ||
|
||||
(layer != ((in[1] >> 1) & 0x3)) ||
|
||||
(protection != ((in[1] >> 0) & 0x1)) ||
|
||||
(samples != ((in[2] >> 2) & 0x3)) ||
|
||||
(channels != ((in[3] >> 6) & 0x3)) ||
|
||||
(type != MBITS( in[1], 5, 1))) break;
|
||||
} else {
|
||||
if (type == MPEG1_LAYER_III) { // supported MP3 type, all header information must be identical to the first frame
|
||||
if (
|
||||
(mpeg != ((in[1] >> 3) & 0x3)) ||
|
||||
(layer != ((in[1] >> 1) & 0x3)) ||
|
||||
(protection != ((in[1] >> 0) & 0x1)) ||
|
||||
(samples != ((in[2] >> 2) & 0x3)) ||
|
||||
(channels != ((in[3] >> 6) & 0x3)) ||
|
||||
(type != MBITS( in[1], 5, 1))) break;
|
||||
} else { // unsupported type, compare only type, ignore the other header information to get a longer stream
|
||||
if (type != MBITS( in[1], 5, 1)) break;
|
||||
}
|
||||
}
|
||||
|
||||
bits = (in[2] >> 4) & 0xF;
|
||||
padding = (in[2] >> 1) & 0x1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue