mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
removed dead code
This commit is contained in:
parent
450da9c1a1
commit
33e1928705
@ -506,137 +506,6 @@
|
||||
return supportsTextTracks;
|
||||
};
|
||||
|
||||
self.getVideoDirectPlayMethod = function (mediaSource, videoStream, audioStream, subtitleStream, bitrate) {
|
||||
|
||||
if (!mediaSource) {
|
||||
throw new Error('Null mediaSource');
|
||||
}
|
||||
|
||||
if (!videoStream) {
|
||||
console.log('Cannot direct play without videoStream info');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mediaSource.Protocol.toLowerCase() == "rtmp" || mediaSource.Protocol.toLowerCase() == "rtsp") {
|
||||
//console.log('Transcoding because the content is not a video file');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mediaSource.VideoType && mediaSource.VideoType != "VideoFile") {
|
||||
//console.log('Transcoding because the content is not a video file');
|
||||
return null;
|
||||
}
|
||||
|
||||
var isH264 = (videoStream.Codec || '').toLowerCase().indexOf('h264') != -1;
|
||||
|
||||
if (!isH264) {
|
||||
console.log('Transcoding because the content is not h264');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (audioStream && !canPlayAudioStreamDirect(audioStream)) {
|
||||
console.log('Transcoding because the audio cannot be played directly.');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (subtitleStream && (!subtitleStream.SupportsExternalStream || !subtitleStream.IsTextSubtitleStream || !self.supportsTextTracks())) {
|
||||
console.log('Transcoding because subtitles are required');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (videoStream.IsCabac != null && !videoStream.IsCabac) {
|
||||
console.log('Video not CABAC');
|
||||
//return false;
|
||||
}
|
||||
|
||||
if (!videoStream.Width) {
|
||||
console.log('Transcoding because resolution is unknown');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (videoStream && videoStream.IsAnamorphic) {
|
||||
console.log('Transcoding because video is anamorphic');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!mediaSource.Bitrate) {
|
||||
console.log('Transcoding because bitrate is unknown');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mediaSource.Bitrate > bitrate) {
|
||||
console.log('Transcoding because bitrate is too high');
|
||||
return null;
|
||||
}
|
||||
|
||||
var extension = (mediaSource.Container || '').toLowerCase();
|
||||
|
||||
var profile = (videoStream ? (videoStream.Profile || '') : '').toLowerCase();
|
||||
|
||||
// only support high, baseline variants and main variants
|
||||
if (isH264 && profile != 'high' && profile.indexOf('baseline') == -1 && profile.indexOf('main') == -1) {
|
||||
console.log('Transcoding because of unsupported h264 profile');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mediaSource.Protocol == 'Http') {
|
||||
if (Dashboard.isConnectMode()) {
|
||||
return null;
|
||||
}
|
||||
return 'DirectPlay';
|
||||
}
|
||||
|
||||
if (extension == 'mp4') {
|
||||
return 'DirectStream';
|
||||
}
|
||||
|
||||
if (extension == 'm4v' || extension == 'mkv') {
|
||||
if ($.browser.chrome) {
|
||||
return 'DirectStream';
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
self.getFinalVideoParams = function (mediaSource, bitrate, audioStreamIndex, subtitleStreamIndex, transcodingExtension) {
|
||||
|
||||
var mediaStreams = mediaSource.MediaStreams;
|
||||
|
||||
var videoStream = mediaStreams.filter(function (stream) {
|
||||
return stream.Type === "Video";
|
||||
})[0];
|
||||
|
||||
var audioStream = mediaStreams.filter(function (stream) {
|
||||
return stream.Index === audioStreamIndex && stream.Type == 'Audio';
|
||||
})[0];
|
||||
|
||||
var subtitleStream = mediaStreams.filter(function (stream) {
|
||||
return stream.Index === subtitleStreamIndex && stream.Type == 'Subtitle';
|
||||
})[0];
|
||||
|
||||
var directPlayMethod = self.getVideoDirectPlayMethod(mediaSource, videoStream, audioStream, subtitleStream, bitrate);
|
||||
|
||||
var audioBitrate = bitrate >= 700000 ? 192000 : 64000;
|
||||
|
||||
var videoBitrate = bitrate - audioBitrate;
|
||||
|
||||
var params = {
|
||||
isStatic: directPlayMethod != null,
|
||||
audioCodec: transcodingExtension == '.webm' ? 'vorbis' : 'aac',
|
||||
videoCodec: transcodingExtension == '.webm' ? 'vpx' : 'h264',
|
||||
audioBitrate: audioBitrate,
|
||||
videoBitrate: videoBitrate
|
||||
};
|
||||
|
||||
if (params.videoCodec == 'h264') {
|
||||
params.profile = 'baseline';
|
||||
params.level = '3';
|
||||
}
|
||||
|
||||
return params;
|
||||
};
|
||||
|
||||
self.canQueueMediaType = function (mediaType) {
|
||||
|
||||
return self.currentItem && self.currentItem.MediaType == mediaType;
|
||||
@ -1750,31 +1619,6 @@
|
||||
})[0];
|
||||
};
|
||||
|
||||
function canPlayAudioStreamDirect(audioStream) {
|
||||
|
||||
var audioCodec = (audioStream.Codec || '').toLowerCase().replace('-', '');
|
||||
|
||||
if (audioCodec.indexOf('aac') == -1 &&
|
||||
audioCodec.indexOf('mp3') == -1 &&
|
||||
audioCodec.indexOf('mpeg') == -1) {
|
||||
|
||||
console.log('Cannot direct play. Unsupported audio codec');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (audioStream.Channels == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// IE won't play at all if more than two channels
|
||||
if (audioStream.Channels > 2 && $.browser.msie) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
var getItemFields = "MediaSources,Chapters";
|
||||
|
||||
self.getCurrentTargetInfo = function () {
|
||||
|
Loading…
Reference in New Issue
Block a user