mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Remove useless checks and dead code (#13405)
* Remove useless checks and dead code * Enable adaptive bitrate streaming again * Disable adaptive bitrate streaming by default
This commit is contained in:
commit
bcdffa74a8
@ -753,16 +753,9 @@ namespace Emby.Server.Implementations.Library
|
||||
};
|
||||
|
||||
if (folder.Id.IsEmpty())
|
||||
{
|
||||
if (string.IsNullOrEmpty(folder.Path))
|
||||
{
|
||||
folder.Id = GetNewItemId(folder.GetType().Name, folder.GetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
folder.Id = GetNewItemId(folder.Path, folder.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
var dbItem = GetItemById(folder.Id) as BasePluginFolder;
|
||||
|
||||
|
@ -308,39 +308,40 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
var mediaTypes = new List<MediaType>();
|
||||
MediaType[] mediaTypes = [];
|
||||
|
||||
if (includeItemTypes.Length == 0)
|
||||
{
|
||||
HashSet<MediaType> tmpMediaTypes = [];
|
||||
foreach (var parent in parents.OfType<ICollectionFolder>())
|
||||
{
|
||||
switch (parent.CollectionType)
|
||||
{
|
||||
case CollectionType.books:
|
||||
mediaTypes.Add(MediaType.Book);
|
||||
mediaTypes.Add(MediaType.Audio);
|
||||
tmpMediaTypes.Add(MediaType.Book);
|
||||
tmpMediaTypes.Add(MediaType.Audio);
|
||||
break;
|
||||
case CollectionType.music:
|
||||
mediaTypes.Add(MediaType.Audio);
|
||||
tmpMediaTypes.Add(MediaType.Audio);
|
||||
break;
|
||||
case CollectionType.photos:
|
||||
mediaTypes.Add(MediaType.Photo);
|
||||
mediaTypes.Add(MediaType.Video);
|
||||
tmpMediaTypes.Add(MediaType.Photo);
|
||||
tmpMediaTypes.Add(MediaType.Video);
|
||||
break;
|
||||
case CollectionType.homevideos:
|
||||
mediaTypes.Add(MediaType.Photo);
|
||||
mediaTypes.Add(MediaType.Video);
|
||||
tmpMediaTypes.Add(MediaType.Photo);
|
||||
tmpMediaTypes.Add(MediaType.Video);
|
||||
break;
|
||||
default:
|
||||
mediaTypes.Add(MediaType.Video);
|
||||
tmpMediaTypes.Add(MediaType.Video);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mediaTypes = mediaTypes.Distinct().ToList();
|
||||
mediaTypes = tmpMediaTypes.ToArray();
|
||||
}
|
||||
|
||||
var excludeItemTypes = includeItemTypes.Length == 0 && mediaTypes.Count == 0
|
||||
var excludeItemTypes = includeItemTypes.Length == 0 && mediaTypes.Length == 0
|
||||
? new[]
|
||||
{
|
||||
BaseItemKind.Person,
|
||||
@ -366,14 +367,9 @@ namespace Emby.Server.Implementations.Library
|
||||
Limit = limit * 5,
|
||||
IsPlayed = isPlayed,
|
||||
DtoOptions = options,
|
||||
MediaTypes = mediaTypes.ToArray()
|
||||
MediaTypes = mediaTypes
|
||||
};
|
||||
|
||||
if (parents.Count == 0)
|
||||
{
|
||||
return _libraryManager.GetItemList(query, false);
|
||||
}
|
||||
|
||||
return _libraryManager.GetItemList(query, parents);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace Jellyfin.Api.Auth
|
||||
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(ClaimTypes.Name, authorizationInfo.User?.Username ?? string.Empty),
|
||||
new Claim(ClaimTypes.Name, authorizationInfo.User.Username),
|
||||
new Claim(ClaimTypes.Role, role),
|
||||
new Claim(InternalClaimTypes.UserId, authorizationInfo.UserId.ToString("N", CultureInfo.InvariantCulture)),
|
||||
new Claim(InternalClaimTypes.DeviceId, authorizationInfo.DeviceId),
|
||||
|
@ -459,7 +459,7 @@ public class DynamicHlsController : BaseJellyfinApiController
|
||||
[FromQuery] int? videoStreamIndex,
|
||||
[FromQuery] EncodingContext? context,
|
||||
[FromQuery] Dictionary<string, string> streamOptions,
|
||||
[FromQuery] bool enableAdaptiveBitrateStreaming = true,
|
||||
[FromQuery] bool enableAdaptiveBitrateStreaming = false,
|
||||
[FromQuery] bool enableTrickplay = true,
|
||||
[FromQuery] bool enableAudioVbrEncoding = true,
|
||||
[FromQuery] bool alwaysBurnInSubtitleWhenTranscoding = false)
|
||||
@ -634,7 +634,7 @@ public class DynamicHlsController : BaseJellyfinApiController
|
||||
[FromQuery] int? videoStreamIndex,
|
||||
[FromQuery] EncodingContext? context,
|
||||
[FromQuery] Dictionary<string, string> streamOptions,
|
||||
[FromQuery] bool enableAdaptiveBitrateStreaming = true,
|
||||
[FromQuery] bool enableAdaptiveBitrateStreaming = false,
|
||||
[FromQuery] bool enableAudioVbrEncoding = true)
|
||||
{
|
||||
var streamingRequest = new HlsAudioRequestDto
|
||||
|
@ -222,7 +222,7 @@ public class UniversalAudioController : BaseJellyfinApiController
|
||||
TranscodeReasons = mediaSource.TranscodeReasons == 0 ? null : mediaSource.TranscodeReasons.ToString(),
|
||||
Context = EncodingContext.Static,
|
||||
StreamOptions = new Dictionary<string, string>(),
|
||||
EnableAdaptiveBitrateStreaming = true,
|
||||
EnableAdaptiveBitrateStreaming = false,
|
||||
EnableAudioVbrEncoding = enableAudioVbrEncoding
|
||||
};
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class DynamicHlsHelper
|
||||
|
||||
if (EnableAdaptiveBitrateStreaming(state, isLiveStream, enableAdaptiveBitrateStreaming, _httpContextAccessor.HttpContext.GetNormalizedRemoteIP()))
|
||||
{
|
||||
var requestedVideoBitrate = state.VideoRequest is null ? 0 : state.VideoRequest.VideoBitRate ?? 0;
|
||||
var requestedVideoBitrate = state.VideoRequest?.VideoBitRate ?? 0;
|
||||
|
||||
// By default, vary by just 200k
|
||||
var variation = GetBitrateVariation(totalBitrate);
|
||||
@ -526,9 +526,7 @@ public class DynamicHlsHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
// Having problems in android
|
||||
return false;
|
||||
// return state.VideoRequest.VideoBitRate.HasValue;
|
||||
return state.VideoRequest?.VideoBitRate.HasValue ?? false;
|
||||
}
|
||||
|
||||
private void AddSubtitles(StreamState state, IEnumerable<MediaStream> subtitles, StringBuilder builder, ClaimsPrincipal user)
|
||||
@ -616,7 +614,7 @@ public class DynamicHlsHelper
|
||||
&& state.VideoStream is not null
|
||||
&& state.VideoStream.Level.HasValue)
|
||||
{
|
||||
levelString = state.VideoStream.Level.Value.ToString(CultureInfo.InvariantCulture) ?? string.Empty;
|
||||
levelString = state.VideoStream.Level.Value.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text.RegularExpressions;
|
||||
@ -102,7 +103,7 @@ public static partial class NetworkUtils
|
||||
Span<byte> bytes = stackalloc byte[mask.AddressFamily == AddressFamily.InterNetwork ? NetworkConstants.IPv4MaskBytes : NetworkConstants.IPv6MaskBytes];
|
||||
if (!mask.TryWriteBytes(bytes, out var bytesWritten))
|
||||
{
|
||||
Console.WriteLine("Unable to write address bytes, only ${bytesWritten} bytes written.");
|
||||
Console.WriteLine("Unable to write address bytes, only {0} bytes written.", bytesWritten.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
var zeroed = false;
|
||||
|
@ -1242,11 +1242,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.GenreIds.Count > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.VideoTypes.Length > 0)
|
||||
{
|
||||
return false;
|
||||
|
@ -134,7 +134,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
var series = Series;
|
||||
if (series is not null)
|
||||
{
|
||||
return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);
|
||||
return series.PresentationUniqueKey + "-" + IndexNumber.Value.ToString("000", CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1087,12 +1087,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
_logger.LogDebug(
|
||||
"Transcode Result for Profile: {Profile}, Path: {Path}, PlayMethod: {PlayMethod}, AudioStreamIndex: {AudioStreamIndex}, SubtitleStreamIndex: {SubtitleStreamIndex}, Reasons: {TranscodeReason}",
|
||||
options.Profile?.Name ?? "Anonymous Profile",
|
||||
options.Profile.Name ?? "Anonymous Profile",
|
||||
item.Path ?? "Unknown path",
|
||||
playlistItem?.PlayMethod,
|
||||
playlistItem.PlayMethod,
|
||||
audioStream?.Index,
|
||||
playlistItem?.SubtitleStreamIndex,
|
||||
playlistItem?.TranscodeReasons);
|
||||
playlistItem.SubtitleStreamIndex,
|
||||
playlistItem.TranscodeReasons);
|
||||
}
|
||||
|
||||
private static int GetDefaultAudioBitrate(string? audioCodec, int? audioChannels)
|
||||
|
@ -361,7 +361,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
blurayVideoStream.Codec = ffmpegVideoStream.Codec;
|
||||
blurayVideoStream.BitRate = blurayVideoStream.BitRate.GetValueOrDefault() == 0 ? ffmpegVideoStream.BitRate : blurayVideoStream.BitRate;
|
||||
blurayVideoStream.Width = blurayVideoStream.Width.GetValueOrDefault() == 0 ? ffmpegVideoStream.Width : blurayVideoStream.Width;
|
||||
blurayVideoStream.Height = blurayVideoStream.Height.GetValueOrDefault() == 0 ? ffmpegVideoStream.Width : blurayVideoStream.Height;
|
||||
blurayVideoStream.Height = blurayVideoStream.Height.GetValueOrDefault() == 0 ? ffmpegVideoStream.Height : blurayVideoStream.Height;
|
||||
blurayVideoStream.ColorRange = ffmpegVideoStream.ColorRange;
|
||||
blurayVideoStream.ColorSpace = ffmpegVideoStream.ColorSpace;
|
||||
blurayVideoStream.ColorTransfer = ffmpegVideoStream.ColorTransfer;
|
||||
|
@ -124,22 +124,7 @@ namespace Jellyfin.LiveTv.IO
|
||||
|
||||
private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile)
|
||||
{
|
||||
string videoArgs;
|
||||
if (EncodeVideo(mediaSource))
|
||||
{
|
||||
const int MaxBitrate = 25000000;
|
||||
videoArgs = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"-codec:v:0 libx264 -force_key_frames \"expr:gte(t,n_forced*5)\" {0} -pix_fmt yuv420p -preset superfast -crf 23 -b:v {1} -maxrate {1} -bufsize ({1}*2) -profile:v high -level 41",
|
||||
GetOutputSizeParam(),
|
||||
MaxBitrate);
|
||||
}
|
||||
else
|
||||
{
|
||||
videoArgs = "-codec:v:0 copy";
|
||||
}
|
||||
|
||||
videoArgs += " -fflags +genpts";
|
||||
string videoArgs = "-codec:v:0 copy -fflags +genpts";
|
||||
|
||||
var flags = new List<string>();
|
||||
if (mediaSource.IgnoreDts)
|
||||
@ -205,19 +190,6 @@ namespace Jellyfin.LiveTv.IO
|
||||
private static string GetAudioArgs(MediaSourceInfo mediaSource)
|
||||
{
|
||||
return "-codec:a:0 copy";
|
||||
|
||||
// var audioChannels = 2;
|
||||
// var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
// if (audioStream is not null)
|
||||
// {
|
||||
// audioChannels = audioStream.Channels ?? audioChannels;
|
||||
// }
|
||||
// return "-codec:a:0 aac -strict experimental -ab 320000";
|
||||
}
|
||||
|
||||
private static bool EncodeVideo(MediaSourceInfo mediaSource)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected string GetOutputSizeParam()
|
||||
|
Loading…
x
Reference in New Issue
Block a user