mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 20:54:20 +01:00
crobibero styling, format, code suggestions
This commit is contained in:
@@ -90,6 +90,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{ "truehd", 6 },
|
||||
};
|
||||
|
||||
private static readonly string _defaultMjpegEncoder = "mjpeg";
|
||||
private static readonly Dictionary<string, string> _mjpegCodecMap = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "vaapi", _defaultMjpegEncoder + "_vaapi" },
|
||||
{ "qsv", _defaultMjpegEncoder + "_qsv" }
|
||||
};
|
||||
|
||||
public static readonly string[] LosslessAudioCodecs = new string[]
|
||||
{
|
||||
"alac",
|
||||
@@ -151,32 +158,20 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
private string GetMjpegEncoder(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
{
|
||||
var defaultEncoder = "mjpeg";
|
||||
|
||||
if (state.VideoType == VideoType.VideoFile)
|
||||
{
|
||||
var hwType = encodingOptions.HardwareAccelerationType;
|
||||
|
||||
var codecMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "vaapi", defaultEncoder + "_vaapi" },
|
||||
{ "qsv", defaultEncoder + "_qsv" }
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(hwType)
|
||||
&& encodingOptions.EnableHardwareEncoding
|
||||
&& codecMap.ContainsKey(hwType))
|
||||
&& _mjpegCodecMap.TryGetValue(hwType, out var preferredEncoder)
|
||||
&& _mediaEncoder.SupportsEncoder(preferredEncoder))
|
||||
{
|
||||
var preferredEncoder = codecMap[hwType];
|
||||
|
||||
if (_mediaEncoder.SupportsEncoder(preferredEncoder))
|
||||
{
|
||||
return preferredEncoder;
|
||||
}
|
||||
return preferredEncoder;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultEncoder;
|
||||
return _defaultMjpegEncoder;
|
||||
}
|
||||
|
||||
private bool IsVaapiSupported(EncodingJobInfo state)
|
||||
|
||||
@@ -5,50 +5,49 @@ using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Trickplay
|
||||
namespace MediaBrowser.Controller.Trickplay;
|
||||
|
||||
/// <summary>
|
||||
/// Interface ITrickplayManager.
|
||||
/// </summary>
|
||||
public interface ITrickplayManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface ITrickplayManager.
|
||||
/// Generate or replace trickplay data.
|
||||
/// </summary>
|
||||
public interface ITrickplayManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Generate or replace trickplay data.
|
||||
/// </summary>
|
||||
/// <param name="video">The video.</param>
|
||||
/// <param name="replace">Whether or not existing data should be replaced.</param>
|
||||
/// <param name="cancellationToken">CancellationToken to use for operation.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RefreshTrickplayData(Video video, bool replace, CancellationToken cancellationToken);
|
||||
/// <param name="video">The video.</param>
|
||||
/// <param name="replace">Whether or not existing data should be replaced.</param>
|
||||
/// <param name="cancellationToken">CancellationToken to use for operation.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RefreshTrickplayDataAsync(Video video, bool replace, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get available trickplay resolutions and corresponding info.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item.</param>
|
||||
/// <returns>Map of width resolutions to trickplay tiles info.</returns>
|
||||
Dictionary<int, TrickplayTilesInfo> GetTilesResolutions(Guid itemId);
|
||||
/// <summary>
|
||||
/// Get available trickplay resolutions and corresponding info.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item.</param>
|
||||
/// <returns>Map of width resolutions to trickplay tiles info.</returns>
|
||||
Dictionary<int, TrickplayTilesInfo> GetTilesResolutions(Guid itemId);
|
||||
|
||||
/// <summary>
|
||||
/// Saves trickplay tiles info.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item.</param>
|
||||
/// <param name="tilesInfo">The trickplay tiles info.</param>
|
||||
void SaveTilesInfo(Guid itemId, TrickplayTilesInfo tilesInfo);
|
||||
/// <summary>
|
||||
/// Saves trickplay tiles info.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item.</param>
|
||||
/// <param name="tilesInfo">The trickplay tiles info.</param>
|
||||
void SaveTilesInfo(Guid itemId, TrickplayTilesInfo tilesInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the trickplay manifest.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>A map of media source id to a map of tile width to tile info.</returns>
|
||||
Dictionary<Guid, Dictionary<int, TrickplayTilesInfo>> GetTrickplayManifest(BaseItem item);
|
||||
/// <summary>
|
||||
/// Gets the trickplay manifest.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>A map of media source id to a map of tile width to tile info.</returns>
|
||||
Dictionary<Guid, Dictionary<int, TrickplayTilesInfo>> GetTrickplayManifest(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to a trickplay tiles image.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="width">The width of a single tile.</param>
|
||||
/// <param name="index">The tile grid's index.</param>
|
||||
/// <returns>The absolute path.</returns>
|
||||
string GetTrickplayTilePath(BaseItem item, int width, int index);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the path to a trickplay tiles image.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="width">The width of a single tile.</param>
|
||||
/// <param name="index">The tile grid's index.</param>
|
||||
/// <returns>The absolute path.</returns>
|
||||
string GetTrickplayTilePath(BaseItem item, int width, int index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user