mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-06 15:58:29 +01:00
Merge branch 'master' into NetworkPR2
This commit is contained in:
@@ -67,6 +67,8 @@ namespace MediaBrowser.Model.Configuration
|
||||
|
||||
public bool EnableHardwareEncoding { get; set; }
|
||||
|
||||
public bool AllowHevcEncoding { get; set; }
|
||||
|
||||
public bool EnableSubtitleExtraction { get; set; }
|
||||
|
||||
public string[] HardwareDecodingCodecs { get; set; }
|
||||
@@ -99,6 +101,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
EnableDecodingColorDepth10Hevc = true;
|
||||
EnableDecodingColorDepth10Vp9 = true;
|
||||
EnableHardwareEncoding = true;
|
||||
AllowHevcEncoding = true;
|
||||
EnableSubtitleExtraction = true;
|
||||
HardwareDecodingCodecs = new string[] { "h264", "vc1" };
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
new ResolutionConfiguration(720, 950000),
|
||||
new ResolutionConfiguration(1280, 2500000),
|
||||
new ResolutionConfiguration(1920, 4000000),
|
||||
new ResolutionConfiguration(2560, 8000000),
|
||||
new ResolutionConfiguration(2560, 20000000),
|
||||
new ResolutionConfiguration(3840, 35000000)
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
int? maxWidth,
|
||||
int? maxHeight)
|
||||
{
|
||||
// If the bitrate isn't changing, then don't downlscale the resolution
|
||||
// If the bitrate isn't changing, then don't downscale the resolution
|
||||
if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value)
|
||||
{
|
||||
if (maxWidth.HasValue || maxHeight.HasValue)
|
||||
@@ -80,11 +80,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private static double GetVideoBitrateScaleFactor(string codec)
|
||||
{
|
||||
if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(codec, "vp9", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(codec, "vp9", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return .5;
|
||||
return .6;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -872,11 +872,34 @@ namespace MediaBrowser.Model.Dlna
|
||||
return playlistItem;
|
||||
}
|
||||
|
||||
private static int GetDefaultAudioBitrateIfUnknown(MediaStream audioStream)
|
||||
private static int GetDefaultAudioBitrate(string audioCodec, int? audioChannels)
|
||||
{
|
||||
if ((audioStream.Channels ?? 0) >= 6)
|
||||
if (!string.IsNullOrEmpty(audioCodec))
|
||||
{
|
||||
return 384000;
|
||||
// Default to a higher bitrate for stream copy
|
||||
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(audioCodec, "eac3", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if ((audioChannels ?? 0) < 2)
|
||||
{
|
||||
return 128000;
|
||||
}
|
||||
|
||||
return (audioChannels ?? 0) >= 6 ? 640000 : 384000;
|
||||
}
|
||||
|
||||
if (string.Equals(audioCodec, "flac", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(audioCodec, "alac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if ((audioChannels ?? 0) < 2)
|
||||
{
|
||||
return 768000;
|
||||
}
|
||||
|
||||
return (audioChannels ?? 0) >= 6 ? 3584000 : 1536000;
|
||||
}
|
||||
}
|
||||
|
||||
return 192000;
|
||||
@@ -897,14 +920,27 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetAudioChannels.HasValue && audioStream.Channels.HasValue && targetAudioChannels.Value < audioStream.Channels.Value)
|
||||
if (targetAudioChannels.HasValue
|
||||
&& audioStream.Channels.HasValue
|
||||
&& audioStream.Channels.Value > targetAudioChannels.Value)
|
||||
{
|
||||
// Reduce the bitrate if we're downmixing
|
||||
defaultBitrate = targetAudioChannels.Value < 2 ? 128000 : 192000;
|
||||
// Reduce the bitrate if we're downmixing.
|
||||
defaultBitrate = GetDefaultAudioBitrate(targetAudioCodec, targetAudioChannels);
|
||||
}
|
||||
else if (targetAudioChannels.HasValue
|
||||
&& audioStream.Channels.HasValue
|
||||
&& audioStream.Channels.Value <= targetAudioChannels.Value
|
||||
&& !string.IsNullOrEmpty(audioStream.Codec)
|
||||
&& targetAudioCodecs != null
|
||||
&& targetAudioCodecs.Length > 0
|
||||
&& !Array.Exists(targetAudioCodecs, elem => string.Equals(audioStream.Codec, elem, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
// Shift the bitrate if we're transcoding to a different audio codec.
|
||||
defaultBitrate = GetDefaultAudioBitrate(targetAudioCodec, audioStream.Channels.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultBitrate = audioStream.BitRate ?? GetDefaultAudioBitrateIfUnknown(audioStream);
|
||||
defaultBitrate = audioStream.BitRate ?? GetDefaultAudioBitrate(targetAudioCodec, targetAudioChannels);
|
||||
}
|
||||
|
||||
// Seeing webm encoding failures when source has 1 audio channel and 22k bitrate.
|
||||
@@ -938,8 +974,28 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
return 448000;
|
||||
}
|
||||
else if (totalBitrate <= 4000000)
|
||||
{
|
||||
return 640000;
|
||||
}
|
||||
else if (totalBitrate <= 5000000)
|
||||
{
|
||||
return 768000;
|
||||
}
|
||||
else if (totalBitrate <= 10000000)
|
||||
{
|
||||
return 1536000;
|
||||
}
|
||||
else if (totalBitrate <= 15000000)
|
||||
{
|
||||
return 2304000;
|
||||
}
|
||||
else if (totalBitrate <= 20000000)
|
||||
{
|
||||
return 3584000;
|
||||
}
|
||||
|
||||
return 640000;
|
||||
return 7168000;
|
||||
}
|
||||
|
||||
private (PlayMethod?, List<TranscodeReason>) GetVideoDirectPlayProfile(
|
||||
|
||||
@@ -794,7 +794,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public int? GetTargetAudioChannels(string codec)
|
||||
{
|
||||
var defaultValue = GlobalMaxAudioChannels;
|
||||
var defaultValue = GlobalMaxAudioChannels ?? TranscodingMaxAudioChannels;
|
||||
|
||||
var value = GetOption(codec, "audiochannels");
|
||||
if (string.IsNullOrEmpty(value))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Playlists
|
||||
{
|
||||
@@ -9,15 +10,10 @@ namespace MediaBrowser.Model.Playlists
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public Guid[] ItemIdList { get; set; }
|
||||
public IReadOnlyList<Guid> ItemIdList { get; set; } = Array.Empty<Guid>();
|
||||
|
||||
public string MediaType { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public PlaylistCreationRequest()
|
||||
{
|
||||
ItemIdList = Array.Empty<Guid>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user