Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a free format mp3 files #358

Merged
merged 1 commit into from
Dec 22, 2021

Conversation

StudioMaX
Copy link
Collaborator

While analyzing warnings in new php versions, I found erroneous behavior in my opinion.

According to this part:

// LAME CBR
if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) {
$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
$thisfile_mpeg_audio['bitrate'] = self::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']);
$info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
//if (empty($thisfile_mpeg_audio['bitrate']) || (!empty($thisfile_mpeg_audio_lame['bitrate_min']) && ($thisfile_mpeg_audio_lame['bitrate_min'] != 255))) {
// $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio_lame['bitrate_min'];
//}
}

The self::ClosestStandardMP3Bitrate method will be called, which is passed the $thisfile_mpeg_audio['bitrate'] argument. In the case when $thisfile_mpeg_audio['bitrate'] is equal to free then method self::ClosestStandardMP3Bitrate will return - and this value will be written to $info['audio']['bitrate'] and $thisfile_mpeg_audio['bitrate'].

By additional checking that the bitrate is not equal to free, we prevent writing to $info['audio']['bitrate'] an incorrect value -, since the correctly calculated bitrate is already there.

Could you please confirm my guesses?

Sample (and some others in mp3/freeformat): https://github.com/JamesHeinrich/getID3-testfiles/raw/master/mp3/freeformat/3903d-freeformat384.mp3

@JamesHeinrich JamesHeinrich merged commit 73e16a9 into JamesHeinrich:master Dec 22, 2021
@JamesHeinrich
Copy link
Owner

Looks good to me, thanks.

@StudioMaX StudioMaX deleted the mp3-freeformat branch December 22, 2021 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants