mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
encapsulate CC limits
This commit is contained in:
parent
e72026f55c
commit
85010d35e0
1 changed files with 30 additions and 19 deletions
|
@ -229,16 +229,17 @@
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getMaxVideoAudioChannels() {
|
function getCodecLimits() {
|
||||||
return 6;
|
return {
|
||||||
}
|
|
||||||
|
|
||||||
function getMaxAudioChannels() {
|
maxVideoAudioChannels: 6,
|
||||||
return 2;
|
maxAudioChannels: 2,
|
||||||
}
|
maxVideoLevel: 41,
|
||||||
|
maxWidth: 1920,
|
||||||
|
maxHeight: 1080,
|
||||||
|
maxSampleRate: 44100
|
||||||
|
|
||||||
function getMaxVideoLevel() {
|
};
|
||||||
return 41;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function canDirectStream(mediaType, mediaSource, maxBitrate) {
|
function canDirectStream(mediaType, mediaSource, maxBitrate) {
|
||||||
|
@ -248,6 +249,8 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var codecLimits = getCodecLimits();
|
||||||
|
|
||||||
if (mediaType == "Audio") {
|
if (mediaType == "Audio") {
|
||||||
|
|
||||||
return ['mp3', 'aac'].indexOf(mediaSource.Container || '') != -1;
|
return ['mp3', 'aac'].indexOf(mediaSource.Container || '') != -1;
|
||||||
|
@ -268,15 +271,15 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!videoStream.Level || videoStream.Level > getMaxVideoLevel()) {
|
if (!videoStream.Level || videoStream.Level > codecLimits.maxVideoLevel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!videoStream.Width || videoStream.Width > 1920) {
|
if (!videoStream.Width || videoStream.Width > codecLimits.maxWidth) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!videoStream.Height || videoStream.Height > 1080) {
|
if (!videoStream.Height || videoStream.Height > codecLimits.maxHeight) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,12 +300,18 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var maxChannels = isVideo ? getMaxVideoAudioChannels() : getMaxAudioChannels();
|
var codecLimits = getCodecLimits();
|
||||||
|
|
||||||
|
var maxChannels = isVideo ? codecLimits.maxVideoAudioChannels : codecLimits.maxAudioChannels;
|
||||||
|
|
||||||
if (!audioStream.Channels || audioStream.Channels > maxChannels) {
|
if (!audioStream.Channels || audioStream.Channels > maxChannels) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!audioStream.SampleRate || audioStream.SampleRate > codecLimits.maxSampleRate) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,11 +549,13 @@
|
||||||
|
|
||||||
var url;
|
var url;
|
||||||
|
|
||||||
|
var codecLimits = getCodecLimits();
|
||||||
|
|
||||||
if (item.MediaType == 'Audio') {
|
if (item.MediaType == 'Audio') {
|
||||||
|
|
||||||
url = ApiClient.serverAddress() + '/mediabrowser/audio/' + item.Id + '/stream.' + mediaSourceInfo.streamContainer + '?';
|
url = ApiClient.serverAddress() + '/mediabrowser/audio/' + item.Id + '/stream.' + mediaSourceInfo.streamContainer + '?';
|
||||||
url += '&static=' + mediaSourceInfo.isStatic.toString();
|
url += '&static=' + mediaSourceInfo.isStatic.toString();
|
||||||
url += '&maxaudiochannels=' + getMaxAudioChannels();
|
url += '&maxaudiochannels=' + codecLimits.maxAudioChannels;
|
||||||
|
|
||||||
if (startTimeTicks) {
|
if (startTimeTicks) {
|
||||||
url += '&startTimeTicks=' + startTimeTicks.toString();
|
url += '&startTimeTicks=' + startTimeTicks.toString();
|
||||||
|
@ -554,7 +565,7 @@
|
||||||
url += '&audiobitrate=' + Math.min(maxBitrate, 320000).toString();
|
url += '&audiobitrate=' + Math.min(maxBitrate, 320000).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
url += '&audiosamplerate=44100';
|
url += '&audiosamplerate=' + codecLimits.maxSampleRate;
|
||||||
url += '&mediasourceid=' + mediaSourceInfo.mediaSource.Id;
|
url += '&mediasourceid=' + mediaSourceInfo.mediaSource.Id;
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
@ -564,7 +575,7 @@
|
||||||
|
|
||||||
url = ApiClient.serverAddress() + '/mediabrowser/videos/' + item.Id + '/stream.' + mediaSourceInfo.streamContainer + '?';
|
url = ApiClient.serverAddress() + '/mediabrowser/videos/' + item.Id + '/stream.' + mediaSourceInfo.streamContainer + '?';
|
||||||
url += 'static=' + mediaSourceInfo.isStatic.toString();
|
url += 'static=' + mediaSourceInfo.isStatic.toString();
|
||||||
url += '&maxaudiochannels=' + getMaxVideoAudioChannels();
|
url += '&maxaudiochannels=' + codecLimits.maxVideoAudioChannels;
|
||||||
|
|
||||||
if (startTimeTicks) {
|
if (startTimeTicks) {
|
||||||
url += '&startTimeTicks=' + startTimeTicks.toString();
|
url += '&startTimeTicks=' + startTimeTicks.toString();
|
||||||
|
@ -578,15 +589,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
url += '&profile=high';
|
url += '&profile=high';
|
||||||
url += '&level=' + getMaxVideoLevel();
|
url += '&level=' + codecLimits.maxVideoLevel;
|
||||||
|
|
||||||
url += '&maxwidth=1920';
|
url += '&maxwidth=' + codecLimits.maxWidth;
|
||||||
url += '&maxheight=1080';
|
url += '&maxheight=' + codecLimits.maxHeight;
|
||||||
|
|
||||||
url += '&videoCodec=h264';
|
url += '&videoCodec=h264';
|
||||||
url += '&audioCodec=aac';
|
url += '&audioCodec=aac';
|
||||||
|
|
||||||
url += '&audiosamplerate=44100';
|
url += '&audiosamplerate=' + codecLimits.maxSampleRate;
|
||||||
url += '&mediasourceid=' + mediaSourceInfo.mediaSource.Id;
|
url += '&mediasourceid=' + mediaSourceInfo.mediaSource.Id;
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue