Minor improvements (#1685)

* Minor improvements

* Update ffprobe_info.php

* Update ffprobe_info.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-11-28 01:07:44 +07:00 committed by GitHub
commit 68ef591b82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View file

@ -63,11 +63,11 @@ if (isset($ffpInfo->streams)) {
if (!empty($stream->codec_name)) {
$result .= sprintf($lang['AUDIO_CODEC'], $stream->codec_long_name, mb_strtoupper($stream->codec_name, 'UTF-8')) . '<br>';
}
if (!empty($stream->bit_rate) && is_int($stream->bit_rate)) {
$result .= sprintf($lang['BITRATE'], humn_bitrate($stream->bit_rate)) . '<br>';
if (!empty($stream->bit_rate)) {
$result .= sprintf($lang['BITRATE'], humn_bitrate((int)$stream->bit_rate)) . '<br>';
}
if (!empty($stream->sample_rate) && is_int($stream->sample_rate)) {
$result .= sprintf($lang['SAMPLE_RATE'], humn_sample_rate($stream->sample_rate)) . '<br>';
if (!empty($stream->sample_rate)) {
$result .= sprintf($lang['SAMPLE_RATE'], humn_sample_rate((int)$stream->sample_rate)) . '<br>';
}
if (!empty($stream->channels)) {
$result .= sprintf($lang['CHANNELS'], $stream->channels) . '<br>';
@ -136,7 +136,14 @@ function humn_bitrate(int $bitrate, string $space = '&nbsp;'): string
*/
function humn_sample_rate(int $sample_rate, string $space = '&nbsp;'): string
{
$unit = '';
if ($sample_rate >= 1000000) {
$unit = 'Mhz';
} elseif ($sample_rate >= 1000) {
$unit = 'kHz';
} else {
$unit = 'Hz';
}
return sprintf('%.1f', commify($sample_rate)) . $space . $unit;
}