Fix bitrate being treated as byterate in video and audio streams (#1164)
This commit is contained in:
parent
aafbd2b5ad
commit
2e78ca2393
|
|
@ -8,6 +8,7 @@ import { useUserConfigStore } from '../stores/UserConfigStore';
|
||||||
import { useVideoSelectionStore } from '../stores/VideoSelectionStore';
|
import { useVideoSelectionStore } from '../stores/VideoSelectionStore';
|
||||||
import iconChecked from '/img/icon-seen.svg';
|
import iconChecked from '/img/icon-seen.svg';
|
||||||
import iconUnchecked from '/img/icon-unseen.svg';
|
import iconUnchecked from '/img/icon-unseen.svg';
|
||||||
|
import bitsToBytes from '../functions/bitsToBytes';
|
||||||
|
|
||||||
const StreamsTypeEmun = {
|
const StreamsTypeEmun = {
|
||||||
Video: 'video',
|
Video: 'video',
|
||||||
|
|
@ -97,9 +98,9 @@ const VideoListItemTable = ({ videoList, viewStyle }: VideoListItemProps) => {
|
||||||
<td>{`${videoStream?.width || '-'}x${videoStream?.height || '-'}`}</td>
|
<td>{`${videoStream?.width || '-'}x${videoStream?.height || '-'}`}</td>
|
||||||
<td>{humanFileSize(media_size, useSiUnits)}</td>
|
<td>{humanFileSize(media_size, useSiUnits)}</td>
|
||||||
<td>{videoStream?.codec || '-'}</td>
|
<td>{videoStream?.codec || '-'}</td>
|
||||||
<td>{humanFileSize(videoStream?.bitrate || 0, useSiUnits)}</td>
|
<td>{humanFileSize(bitsToBytes(videoStream?.bitrate || 0), useSiUnits)}</td>
|
||||||
<td>{audioStream?.codec || '-'}</td>
|
<td>{audioStream?.codec || '-'}</td>
|
||||||
<td>{humanFileSize(audioStream?.bitrate || 0, useSiUnits)}</td>
|
<td>{humanFileSize(bitsToBytes(audioStream?.bitrate || 0), useSiUnits)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
function bitsToBytes(bits: number) {
|
||||||
|
return bits / 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default bitsToBytes;
|
||||||
|
|
@ -45,6 +45,7 @@ import NotFound from './NotFound';
|
||||||
import { ApiResponseType } from '../functions/APIClient';
|
import { ApiResponseType } from '../functions/APIClient';
|
||||||
import VideoThumbnail from '../components/VideoThumbail';
|
import VideoThumbnail from '../components/VideoThumbail';
|
||||||
import { ViewStylesEnum, ViewStylesType } from '../configuration/constants/ViewStyle';
|
import { ViewStylesEnum, ViewStylesType } from '../configuration/constants/ViewStyle';
|
||||||
|
import bitsToBytes from '../functions/bitsToBytes';
|
||||||
|
|
||||||
const isInPlaylist = (videoId: string, playlist: PlaylistType) => {
|
const isInPlaylist = (videoId: string, playlist: PlaylistType) => {
|
||||||
return playlist.playlist_entries.some(entry => {
|
return playlist.playlist_entries.some(entry => {
|
||||||
|
|
@ -460,7 +461,7 @@ const Video = () => {
|
||||||
return (
|
return (
|
||||||
<p key={stream.index}>
|
<p key={stream.index}>
|
||||||
{capitalizeFirstLetter(stream.type)}: {stream.codec}{' '}
|
{capitalizeFirstLetter(stream.type)}: {stream.codec}{' '}
|
||||||
{humanFileSize(stream.bitrate, useSiUnits)}/s
|
{humanFileSize(bitsToBytes(stream.bitrate), useSiUnits)}/s
|
||||||
{stream.width && (
|
{stream.width && (
|
||||||
<>
|
<>
|
||||||
<span className="space-carrot">|</span> {stream.width}x{stream.height}
|
<span className="space-carrot">|</span> {stream.width}x{stream.height}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue