mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Merge branch 'master' into images
This commit is contained in:
@@ -135,57 +135,4 @@ namespace MediaBrowser.Controller.Entities
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the small Person stub that is attached to BaseItems
|
||||
/// </summary>
|
||||
public class PersonInfo : IHasProviderIds
|
||||
{
|
||||
public PersonInfo()
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public Guid ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the role.
|
||||
/// </summary>
|
||||
/// <value>The role.</value>
|
||||
public string Role { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sort order - ascending
|
||||
/// </summary>
|
||||
/// <value>The sort order.</value>
|
||||
public int? SortOrder { get; set; }
|
||||
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
public Dictionary<string, string> ProviderIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="string" /> that represents this instance.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="string" /> that represents this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool IsType(string type)
|
||||
{
|
||||
return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase) || string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
63
MediaBrowser.Controller/Entities/PersonInfo.cs
Normal file
63
MediaBrowser.Controller/Entities/PersonInfo.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a small Person stub that is attached to BaseItems.
|
||||
/// </summary>
|
||||
public sealed class PersonInfo : IHasProviderIds
|
||||
{
|
||||
public PersonInfo()
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public Guid ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the role.
|
||||
/// </summary>
|
||||
/// <value>The role.</value>
|
||||
public string Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type.
|
||||
/// </summary>
|
||||
/// <value>The type.</value>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ascending sort order.
|
||||
/// </summary>
|
||||
/// <value>The sort order.</value>
|
||||
public int? SortOrder { get; set; }
|
||||
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
public Dictionary<string, string> ProviderIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="string" /> that represents this instance.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="string" /> that represents this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool IsType(string type)
|
||||
{
|
||||
return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,14 +60,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
PresetViews = query.PresetViews
|
||||
});
|
||||
|
||||
var itemsArray = result;
|
||||
var totalCount = itemsArray.Length;
|
||||
|
||||
return new QueryResult<BaseItem>
|
||||
{
|
||||
TotalRecordCount = totalCount,
|
||||
Items = itemsArray //TODO Fix The co-variant conversion between Folder[] and BaseItem[], this can generate runtime issues.
|
||||
};
|
||||
return UserViewBuilder.SortAndPage(result, null, query, LibraryManager, true);
|
||||
}
|
||||
|
||||
public override int GetChildCount(User user)
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Dto;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -26,4 +26,16 @@
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
|
||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
|
||||
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
.Append(' ');
|
||||
}
|
||||
|
||||
if (state.IsVideoRequest
|
||||
if (state.IsVideoRequest
|
||||
&& string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
|
||||
@@ -486,11 +486,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
arg.Append("-hwaccel qsv ");
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
arg.Append("-init_hw_device qsv=hw -filter_hw_device hw ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arg.Append(videoDecoder + " ");
|
||||
@@ -653,7 +653,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath));
|
||||
// using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf"))
|
||||
// {
|
||||
// using (var fileStream = _fileSystem.GetFileStream(fallbackFontPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||
// using (var fileStream = new FileStream(fallbackFontPath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
// {
|
||||
// stream.CopyTo(fileStream);
|
||||
// }
|
||||
@@ -1624,22 +1624,22 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// Setup default filtergraph utilizing FFMpeg overlay() and FFMpeg scale() (see the return of this function for index reference)
|
||||
var retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay{3}\"";
|
||||
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
/*
|
||||
QSV in FFMpeg can now setup hardware overlay for transcodes.
|
||||
For software decoding and hardware encoding option, frames must be hwuploaded into hardware
|
||||
with fixed frame size.
|
||||
with fixed frame size.
|
||||
*/
|
||||
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay_qsv=x=(W-w)/2:y=(H-h)/2{3}\"";
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}]hwupload=extra_hw_frames=64[v];[v][sub]overlay_qsv=x=(W-w)/2:y=(H-h)/2{3}\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -1731,8 +1731,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
vaapi_or_qsv,
|
||||
outputWidth,
|
||||
outputHeight));
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
filters.Add(string.Format(CultureInfo.InvariantCulture, "scale_{0}=format=nv12", vaapi_or_qsv));
|
||||
}
|
||||
@@ -1979,8 +1979,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
|
||||
|
||||
// If we are software decoding, and hardware encoding
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
|
||||
// If we are software decoding, and hardware encoding
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
|
||||
&& (string.IsNullOrEmpty(videoDecoder) || !videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
filters.Add("format=nv12|qsv");
|
||||
|
||||
@@ -657,7 +657,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
public IProgress<double> Progress { get; set; }
|
||||
public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate)
|
||||
public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
|
||||
{
|
||||
Progress.Report(percentComplete.Value);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
@@ -90,6 +89,15 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
framerate = val;
|
||||
}
|
||||
}
|
||||
else if (part.StartsWith("fps=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var rate = part.Split(new[] { '=' }, 2)[^1];
|
||||
|
||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
|
||||
{
|
||||
framerate = val;
|
||||
}
|
||||
}
|
||||
else if (state.RunTimeTicks.HasValue &&
|
||||
part.StartsWith("time=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -146,7 +154,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (framerate.HasValue || percent.HasValue)
|
||||
{
|
||||
state.ReportTranscodingProgress(transcodingPosition, 0, percent, 0, bitRate);
|
||||
state.ReportTranscodingProgress(transcodingPosition, framerate, percent, bytesTranscoded, bitRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <summary>
|
||||
/// The _active connections
|
||||
/// </summary>
|
||||
protected readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>> ActiveConnections =
|
||||
private readonly List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>> _activeConnections =
|
||||
new List<Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>>();
|
||||
|
||||
/// <summary>
|
||||
@@ -100,9 +100,9 @@ namespace MediaBrowser.Controller.Net
|
||||
InitialDelayMs = dueTimeMs
|
||||
};
|
||||
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
ActiveConnections.Add(new Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>(message.Connection, cancellationTokenSource, state));
|
||||
_activeConnections.Add(new Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>(message.Connection, cancellationTokenSource, state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,9 +110,9 @@ namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
Tuple<IWebSocketConnection, CancellationTokenSource, TStateType>[] tuples;
|
||||
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
tuples = ActiveConnections
|
||||
tuples = _activeConnections
|
||||
.Where(c =>
|
||||
{
|
||||
if (c.Item1.State == WebSocketState.Open && !c.Item2.IsCancellationRequested)
|
||||
@@ -180,9 +180,9 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <param name="message">The message.</param>
|
||||
private void Stop(WebSocketMessageInfo message)
|
||||
{
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
var connection = ActiveConnections.FirstOrDefault(c => c.Item1 == message.Connection);
|
||||
var connection = _activeConnections.FirstOrDefault(c => c.Item1 == message.Connection);
|
||||
|
||||
if (connection != null)
|
||||
{
|
||||
@@ -212,9 +212,9 @@ namespace MediaBrowser.Controller.Net
|
||||
//TODO Investigate and properly fix.
|
||||
}
|
||||
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
ActiveConnections.Remove(connection);
|
||||
_activeConnections.Remove(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,9 +226,9 @@ namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
if (dispose)
|
||||
{
|
||||
lock (ActiveConnections)
|
||||
lock (_activeConnections)
|
||||
{
|
||||
foreach (var connection in ActiveConnections.ToArray())
|
||||
foreach (var connection in _activeConnections.ToArray())
|
||||
{
|
||||
DisposeConnection(connection);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
@@ -66,7 +64,7 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="fileShare">The file share.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
Task<object> GetStaticFileResult(IRequest requestContext, string path, FileShareMode fileShare = FileShareMode.Read);
|
||||
Task<object> GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the static file result.
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
|
||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
public class StaticResultOptions
|
||||
@@ -24,12 +22,12 @@ namespace MediaBrowser.Controller.Net
|
||||
public string Path { get; set; }
|
||||
public long? ContentLength { get; set; }
|
||||
|
||||
public FileShareMode FileShare { get; set; }
|
||||
public FileShare FileShare { get; set; }
|
||||
|
||||
public StaticResultOptions()
|
||||
{
|
||||
ResponseHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
FileShare = FileShareMode.Read;
|
||||
FileShare = FileShare.Read;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Persistence
|
||||
{
|
||||
|
||||
@@ -107,6 +107,8 @@ namespace MediaBrowser.Controller.Session
|
||||
|
||||
public BaseItem FullNowPlayingItem { get; set; }
|
||||
|
||||
public BaseItemDto NowViewingItem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device id.
|
||||
/// </summary>
|
||||
@@ -126,12 +128,6 @@ namespace MediaBrowser.Controller.Session
|
||||
[JsonIgnore]
|
||||
public ISessionController[] SessionControllers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the application icon URL.
|
||||
/// </summary>
|
||||
/// <value>The application icon URL.</value>
|
||||
public string AppIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the supported commands.
|
||||
/// </summary>
|
||||
@@ -245,11 +241,6 @@ namespace MediaBrowser.Controller.Session
|
||||
SessionControllers = controllers.ToArray();
|
||||
}
|
||||
|
||||
public bool ContainsUser(string userId)
|
||||
{
|
||||
return ContainsUser(new Guid(userId));
|
||||
}
|
||||
|
||||
public bool ContainsUser(Guid userId)
|
||||
{
|
||||
if (UserId.Equals(userId))
|
||||
@@ -259,7 +250,7 @@ namespace MediaBrowser.Controller.Session
|
||||
|
||||
foreach (var additionalUser in AdditionalUsers)
|
||||
{
|
||||
if (userId.Equals(userId))
|
||||
if (additionalUser.UserId.Equals(userId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -321,7 +312,7 @@ namespace MediaBrowser.Controller.Session
|
||||
|
||||
var newPositionTicks = positionTicks + ProgressIncrement;
|
||||
var item = progressInfo.Item;
|
||||
long? runtimeTicks = item == null ? null : item.RunTimeTicks;
|
||||
long? runtimeTicks = item?.RunTimeTicks;
|
||||
|
||||
// Don't report beyond the runtime
|
||||
if (runtimeTicks.HasValue && newPositionTicks >= runtimeTicks.Value)
|
||||
|
||||
Reference in New Issue
Block a user