mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 19:08:27 +01:00
Merge branch 'master' into embytv
This commit is contained in:
@@ -11,6 +11,7 @@ namespace MediaBrowser.Controller.Drawing
|
||||
/// </summary>
|
||||
/// <value>The supported input formats.</value>
|
||||
IReadOnlyCollection<string> SupportedInputFormats { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the supported output formats.
|
||||
/// </summary>
|
||||
@@ -18,9 +19,9 @@ namespace MediaBrowser.Controller.Drawing
|
||||
IReadOnlyCollection<ImageFormat> SupportedOutputFormats { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// Gets the display name for the encoder.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
/// <value>The display name.</value>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -35,17 +36,22 @@ namespace MediaBrowser.Controller.Drawing
|
||||
/// <value><c>true</c> if [supports image encoding]; otherwise, <c>false</c>.</value>
|
||||
bool SupportsImageEncoding { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the dimensions of an image from the filesystem.
|
||||
/// </summary>
|
||||
/// <param name="path">The filepath of the image.</param>
|
||||
/// <returns>The image dimensions.</returns>
|
||||
ImageDimensions GetImageSize(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Encodes the image.
|
||||
/// Encode an image.
|
||||
/// </summary>
|
||||
string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat outputFormat);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the image collage.
|
||||
/// Create an image collage.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="options">The options to use when creating the collage.</param>
|
||||
void CreateImageCollage(ImageCollageOptions options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1098,6 +1098,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
Id = item.Id.ToString("N", CultureInfo.InvariantCulture),
|
||||
Protocol = protocol ?? MediaProtocol.File,
|
||||
MediaStreams = MediaSourceManager.GetMediaStreams(item.Id),
|
||||
MediaAttachments = MediaSourceManager.GetMediaAttachments(item.Id),
|
||||
Name = GetMediaSourceName(item),
|
||||
Path = enablePathSubstitution ? GetMappedPath(item, item.Path, protocol) : item.Path,
|
||||
RunTimeTicks = item.RunTimeTicks,
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
public bool EnableGroupByMetadataKey { get; set; }
|
||||
public bool? HasChapterImages { get; set; }
|
||||
|
||||
public ValueTuple<string, SortOrder>[] OrderBy { get; set; }
|
||||
public IReadOnlyList<(string, SortOrder)> OrderBy { get; set; }
|
||||
|
||||
public DateTime? MinDateCreated { get; set; }
|
||||
public DateTime? MinDateLastSaved { get; set; }
|
||||
|
||||
@@ -226,14 +226,16 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
|
||||
query.AncestorWithPresentationUniqueKey = null;
|
||||
query.SeriesPresentationUniqueKey = seriesKey;
|
||||
if (query.OrderBy.Length == 0)
|
||||
if (query.OrderBy.Count == 0)
|
||||
{
|
||||
query.OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray();
|
||||
}
|
||||
|
||||
if (query.IncludeItemTypes.Length == 0)
|
||||
{
|
||||
query.IncludeItemTypes = new[] { typeof(Episode).Name, typeof(Season).Name };
|
||||
}
|
||||
|
||||
query.IsVirtualItem = false;
|
||||
return LibraryManager.GetItemsResult(query);
|
||||
}
|
||||
|
||||
@@ -450,14 +450,16 @@ namespace MediaBrowser.Controller.Entities
|
||||
return SortAndPage(items, totalRecordLimit, query, libraryManager, true);
|
||||
}
|
||||
|
||||
public static QueryResult<BaseItem> SortAndPage(IEnumerable<BaseItem> items,
|
||||
public static QueryResult<BaseItem> SortAndPage(
|
||||
IEnumerable<BaseItem> items,
|
||||
int? totalRecordLimit,
|
||||
InternalItemsQuery query,
|
||||
ILibraryManager libraryManager, bool enableSorting)
|
||||
ILibraryManager libraryManager,
|
||||
bool enableSorting)
|
||||
{
|
||||
if (enableSorting)
|
||||
{
|
||||
if (query.OrderBy.Length > 0)
|
||||
if (query.OrderBy.Count > 0)
|
||||
{
|
||||
items = libraryManager.Sort(items, query.User, query.OrderBy);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The video3 D format.</value>
|
||||
public Video3DFormat? Video3DFormat { get; set; }
|
||||
|
||||
public string[] GetPlayableStreamFileNames(IMediaEncoder mediaEncoder)
|
||||
public string[] GetPlayableStreamFileNames()
|
||||
{
|
||||
var videoType = VideoType;
|
||||
|
||||
@@ -153,7 +153,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
return mediaEncoder.GetPlayableStreamFileNames(Path, videoType);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Configuration extensions for <c>MediaBrowser.Controller</c>.
|
||||
/// </summary>
|
||||
public static class ConfigurationExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// The key for the FFmpeg probe size option.
|
||||
/// </summary>
|
||||
public const string FfmpegProbeSizeKey = "FFmpeg:probesize";
|
||||
|
||||
/// <summary>
|
||||
/// The key for the FFmpeg analyse duration option.
|
||||
/// </summary>
|
||||
public const string FfmpegAnalyzeDurationKey = "FFmpeg:analyzeduration";
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the FFmpeg probe size from the <see cref="IConfiguration" />.
|
||||
/// </summary>
|
||||
/// <param name="configuration">This configuration.</param>
|
||||
/// <returns>The FFmpeg probe size option.</returns>
|
||||
public static string GetFFmpegProbeSize(this IConfiguration configuration)
|
||||
=> configuration[FfmpegProbeSizeKey];
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the FFmpeg analyse duration from the <see cref="IConfiguration" />.
|
||||
/// </summary>
|
||||
/// <param name="configuration">This configuration.</param>
|
||||
/// <returns>The FFmpeg analyse duration option.</returns>
|
||||
public static string GetFFmpegAnalyzeDuration(this IConfiguration configuration)
|
||||
=> configuration[FfmpegAnalyzeDurationKey];
|
||||
}
|
||||
}
|
||||
@@ -71,13 +71,15 @@ namespace MediaBrowser.Controller
|
||||
/// <summary>
|
||||
/// Gets the local API URL.
|
||||
/// </summary>
|
||||
/// <param name="host">The host.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetLocalApiUrl(string host);
|
||||
/// <param name="hostname">The hostname.</param>
|
||||
/// <returns>The local API URL.</returns>
|
||||
string GetLocalApiUrl(ReadOnlySpan<char> hostname);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the local API URL.
|
||||
/// </summary>
|
||||
/// <param name="address">The IP address.</param>
|
||||
/// <returns>The local API URL.</returns>
|
||||
string GetLocalApiUrl(IPAddress address);
|
||||
|
||||
void LaunchUrl(string url);
|
||||
|
||||
@@ -10,24 +10,12 @@ namespace MediaBrowser.Controller
|
||||
/// <value>The root folder path.</value>
|
||||
string RootFolderPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application resources path. This is the path to the folder containing resources that are deployed as part of the application
|
||||
/// </summary>
|
||||
/// <value>The application resources path.</value>
|
||||
string ApplicationResourcesPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the default user view directory. Used if no specific user view is defined.
|
||||
/// </summary>
|
||||
/// <value>The default user views path.</value>
|
||||
string DefaultUserViewsPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to localization data.
|
||||
/// </summary>
|
||||
/// <value>The localization path.</value>
|
||||
string LocalizationPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the People directory
|
||||
/// </summary>
|
||||
@@ -87,8 +75,13 @@ namespace MediaBrowser.Controller
|
||||
/// </summary>
|
||||
/// <value>The internal metadata path.</value>
|
||||
string InternalMetadataPath { get; }
|
||||
|
||||
string VirtualInternalMetadataPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the artists directory.
|
||||
/// </summary>
|
||||
/// <value>The artists path.</value>
|
||||
string ArtistsPath { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,21 @@ namespace MediaBrowser.Controller.Library
|
||||
List<MediaStream> GetMediaStreams(MediaStreamQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the playback media sources.
|
||||
/// Gets the media attachments.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item identifier.</param>
|
||||
/// <returns>IEnumerable<MediaAttachment>.</returns>
|
||||
List<MediaAttachment> GetMediaAttachments(Guid itemId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media attachments.
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <returns>IEnumerable<MediaAttachment>.</returns>
|
||||
List<MediaAttachment> GetMediaAttachments(MediaAttachmentQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the playack media sources.
|
||||
/// </summary>
|
||||
Task<List<MediaSourceInfo>> GetPlaybackMediaSources(BaseItem item, User user, bool allowMediaProbe, bool enablePathSubstitution, CancellationToken cancellationToken);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ using MediaBrowser.Model.Entities;
|
||||
namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IUserDataManager
|
||||
/// Interface IUserDataManager.
|
||||
/// </summary>
|
||||
public interface IUserDataManager
|
||||
{
|
||||
@@ -26,13 +26,11 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="userData">The user data.</param>
|
||||
/// <param name="reason">The reason.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
||||
void SaveUserData(User userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
|
||||
|
||||
UserItemData GetUserData(User user, BaseItem item);
|
||||
|
||||
UserItemData GetUserData(string userId, BaseItem item);
|
||||
UserItemData GetUserData(Guid userId, BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -49,20 +49,13 @@ namespace MediaBrowser.Controller.Library
|
||||
event EventHandler<GenericEventArgs<User>> UserLockedOut;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a User by Id.
|
||||
/// Gets a user by Id.
|
||||
/// </summary>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns>The user with the specified Id, or <c>null</c> if the user doesn't exist.</returns>
|
||||
/// <exception cref="ArgumentException"><c>id</c> is an empty Guid.</exception>
|
||||
User GetUserById(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user by identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>User.</returns>
|
||||
User GetUserById(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the user by.
|
||||
/// </summary>
|
||||
@@ -109,8 +102,6 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
void DeleteUser(User user);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
|
||||
@@ -6,12 +6,14 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
@@ -22,6 +24,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ISubtitleEncoder _subtitleEncoder;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
private static readonly string[] _videoProfiles = new[]
|
||||
{
|
||||
@@ -34,11 +37,16 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
"ConstrainedHigh"
|
||||
};
|
||||
|
||||
public EncodingHelper(IMediaEncoder mediaEncoder, IFileSystem fileSystem, ISubtitleEncoder subtitleEncoder)
|
||||
public EncodingHelper(
|
||||
IMediaEncoder mediaEncoder,
|
||||
IFileSystem fileSystem,
|
||||
ISubtitleEncoder subtitleEncoder,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_fileSystem = fileSystem;
|
||||
_subtitleEncoder = subtitleEncoder;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string GetH264Encoder(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
@@ -172,7 +180,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetInputFormat(string container)
|
||||
public static string GetInputFormat(string container)
|
||||
{
|
||||
if (string.IsNullOrEmpty(container))
|
||||
{
|
||||
@@ -467,6 +475,27 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
.Append(' ');
|
||||
}
|
||||
|
||||
if (state.IsVideoRequest
|
||||
&& string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
|
||||
var outputVideoCodec = GetVideoEncoder(state, encodingOptions);
|
||||
|
||||
if (encodingOptions.EnableHardwareEncoding && outputVideoCodec.Contains("qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
arg.Append("-hwaccel qsv ");
|
||||
}
|
||||
else
|
||||
{
|
||||
arg.Append("-init_hw_device qsv=hw -filter_hw_device hw ");
|
||||
}
|
||||
}
|
||||
|
||||
arg.Append(videoDecoder + " ");
|
||||
}
|
||||
|
||||
arg.Append("-i ")
|
||||
.Append(GetInputPathArgument(state));
|
||||
|
||||
@@ -641,7 +670,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (!string.IsNullOrEmpty(state.SubtitleStream.Language))
|
||||
{
|
||||
var charenc = _subtitleEncoder.GetSubtitleFileCharacterSet(subtitlePath, state.SubtitleStream.Language, state.MediaSource.Protocol, CancellationToken.None).Result;
|
||||
var charenc = _subtitleEncoder.GetSubtitleFileCharacterSet(
|
||||
subtitlePath,
|
||||
state.SubtitleStream.Language,
|
||||
state.MediaSource.Protocol,
|
||||
CancellationToken.None).GetAwaiter().GetResult();
|
||||
|
||||
if (!string.IsNullOrEmpty(charenc))
|
||||
{
|
||||
@@ -1562,6 +1595,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var videoSizeParam = string.Empty;
|
||||
|
||||
// Setup subtitle scaling
|
||||
if (state.VideoStream != null && state.VideoStream.Width.HasValue && state.VideoStream.Height.HasValue)
|
||||
{
|
||||
videoSizeParam = string.Format(
|
||||
@@ -1570,7 +1604,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
state.VideoStream.Width.Value,
|
||||
state.VideoStream.Height.Value);
|
||||
|
||||
videoSizeParam += ":force_original_aspect_ratio=decrease";
|
||||
//For QSV, feed it into hardware encoder now
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
videoSizeParam += ",hwupload=extra_hw_frames=64";
|
||||
}
|
||||
}
|
||||
|
||||
var mapPrefix = state.SubtitleStream.IsExternal ?
|
||||
@@ -1581,9 +1619,31 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
? 0
|
||||
: state.SubtitleStream.Index;
|
||||
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
|
||||
|
||||
// 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))
|
||||
{
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
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
|
||||
{
|
||||
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,
|
||||
" -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay{3}\"",
|
||||
retStr,
|
||||
mapPrefix,
|
||||
subtitleStreamIndex,
|
||||
state.VideoStream.Index,
|
||||
@@ -1647,31 +1707,34 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
requestedMaxWidth,
|
||||
requestedMaxHeight);
|
||||
|
||||
if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase)
|
||||
if ((string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) || string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
&& width.HasValue
|
||||
&& height.HasValue)
|
||||
{
|
||||
// Work around vaapi's reduced scaling features
|
||||
var scaler = "scale_vaapi";
|
||||
|
||||
// Given the input dimensions (inputWidth, inputHeight), determine the output dimensions
|
||||
// (outputWidth, outputHeight). The user may request precise output dimensions or maximum
|
||||
// output dimensions. Output dimensions are guaranteed to be even.
|
||||
var outputWidth = width.Value;
|
||||
var outputHeight = height.Value;
|
||||
var vaapi_or_qsv = string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) ? "qsv" : "vaapi";
|
||||
|
||||
if (!videoWidth.HasValue
|
||||
|| outputWidth != videoWidth.Value
|
||||
|| !videoHeight.HasValue
|
||||
|| outputHeight != videoHeight.Value)
|
||||
{
|
||||
// Force nv12 pixel format to enable 10-bit to 8-bit colour conversion.
|
||||
filters.Add(
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"{0}=w={1}:h={2}",
|
||||
scaler,
|
||||
"scale_{0}=w={1}:h={2}:format=nv12",
|
||||
vaapi_or_qsv,
|
||||
outputWidth,
|
||||
outputHeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
filters.Add(string.Format(CultureInfo.InvariantCulture, "scale_{0}=format=nv12", vaapi_or_qsv));
|
||||
}
|
||||
}
|
||||
else if ((videoDecoder ?? string.Empty).IndexOf("_cuvid", StringComparison.OrdinalIgnoreCase) != -1
|
||||
@@ -1897,7 +1960,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// If transcoding from 10 bit, transform colour spaces too
|
||||
if (!string.IsNullOrEmpty(videoStream.PixelFormat)
|
||||
&& videoStream.PixelFormat.IndexOf("p10", StringComparison.OrdinalIgnoreCase) != -1
|
||||
&& string.Equals(outputVideoCodec,"libx264", StringComparison.OrdinalIgnoreCase))
|
||||
&& string.Equals(outputVideoCodec, "libx264", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
filters.Add("format=p010le");
|
||||
filters.Add("format=nv12");
|
||||
@@ -1914,10 +1977,26 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
filters.Add("hwupload");
|
||||
}
|
||||
|
||||
if (state.DeInterlace("h264", true)
|
||||
&& string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
|
||||
|
||||
// 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(string.Format(CultureInfo.InvariantCulture, "deinterlace_vaapi"));
|
||||
filters.Add("format=nv12|qsv");
|
||||
filters.Add("hwupload=extra_hw_frames=64");
|
||||
}
|
||||
|
||||
if (state.DeInterlace("h264", true))
|
||||
{
|
||||
if (string.Equals(outputVideoCodec, "h264_vaapi", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
filters.Add(string.Format(CultureInfo.InvariantCulture, "deinterlace_vaapi"));
|
||||
}
|
||||
else if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
filters.Add(string.Format(CultureInfo.InvariantCulture, "deinterlace_qsv"));
|
||||
}
|
||||
}
|
||||
|
||||
if ((state.DeInterlace("h264", true) || state.DeInterlace("h265", true) || state.DeInterlace("hevc", true))
|
||||
@@ -1940,13 +2019,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
var inputHeight = videoStream?.Height;
|
||||
var threeDFormat = state.MediaSource.Video3DFormat;
|
||||
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
|
||||
|
||||
filters.AddRange(GetScalingFilters(inputWidth, inputHeight, threeDFormat, videoDecoder, outputVideoCodec, request.Width, request.Height, request.MaxWidth, request.MaxHeight));
|
||||
|
||||
var output = string.Empty;
|
||||
|
||||
if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode)
|
||||
if (state.SubtitleStream != null
|
||||
&& state.SubtitleStream.IsTextSubtitleStream
|
||||
&& state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode)
|
||||
{
|
||||
var subParam = GetTextSubtitleParam(state);
|
||||
|
||||
@@ -2035,11 +2114,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetProbeSizeArgument(int numInputFiles)
|
||||
=> numInputFiles > 1 ? "-probesize 1G" : "";
|
||||
public string GetProbeSizeArgument(int numInputFiles)
|
||||
=> numInputFiles > 1 ? "-probesize " + _configuration.GetFFmpegProbeSize() : string.Empty;
|
||||
|
||||
public static string GetAnalyzeDurationArgument(int numInputFiles)
|
||||
=> numInputFiles > 1 ? "-analyzeduration 200M" : "";
|
||||
public string GetAnalyzeDurationArgument(int numInputFiles)
|
||||
=> numInputFiles > 1 ? "-analyzeduration " + _configuration.GetFFmpegAnalyzeDuration() : string.Empty;
|
||||
|
||||
public string GetInputModifier(EncodingJobInfo state, EncodingOptions encodingOptions)
|
||||
{
|
||||
@@ -2134,6 +2213,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
|
||||
|
||||
if (!string.IsNullOrEmpty(videoDecoder))
|
||||
{
|
||||
inputModifier += " " + videoDecoder;
|
||||
@@ -2529,13 +2609,25 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
case "h264":
|
||||
if (_mediaEncoder.SupportsDecoder("h264_mmal") && encodingOptions.HardwareDecodingCodecs.Contains("h264", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v h264_mmal";
|
||||
return "-c:v h264_mmal ";
|
||||
}
|
||||
break;
|
||||
case "mpeg2video":
|
||||
if (_mediaEncoder.SupportsDecoder("mpeg2_mmal") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg2video", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v mpeg2_mmal";
|
||||
return "-c:v mpeg2_mmal ";
|
||||
}
|
||||
break;
|
||||
case "mpeg4":
|
||||
if (_mediaEncoder.SupportsDecoder("mpeg4_mmal") && encodingOptions.HardwareDecodingCodecs.Contains("mpeg4", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v mpeg4_mmal ";
|
||||
}
|
||||
break;
|
||||
case "vc1":
|
||||
if (_mediaEncoder.SupportsDecoder("vc1_mmal") && encodingOptions.HardwareDecodingCodecs.Contains("vc1", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return "-c:v vc1_mmal ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
public interface IAttachmentExtractor
|
||||
{
|
||||
Task<(MediaAttachment attachment, Stream stream)> GetAttachment(
|
||||
BaseItem item,
|
||||
string mediaSourceId,
|
||||
int attachmentStreamIndex,
|
||||
CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// </summary>
|
||||
public interface IMediaEncoder : ITranscoderSupport
|
||||
{
|
||||
/// <summary>
|
||||
/// The location of the discovered FFmpeg tool.
|
||||
/// </summary>
|
||||
FFmpegLocation EncoderLocation { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -97,7 +100,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
void UpdateEncoderPath(string path, string pathType);
|
||||
bool SupportsEncoder(string encoder);
|
||||
|
||||
string[] GetPlayableStreamFileNames(string path, VideoType videoType);
|
||||
IEnumerable<string> GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,21 @@ namespace MediaBrowser.Controller.Persistence
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media attachments.
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <returns>IEnumerable{MediaAttachment}.</returns>
|
||||
List<MediaAttachment> GetMediaAttachments(MediaAttachmentQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the media attachments.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <param name="attachments">The attachments.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SaveMediaAttachments(Guid id, IReadOnlyList<MediaAttachment> attachments, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item ids.
|
||||
/// </summary>
|
||||
|
||||
20
MediaBrowser.Controller/Persistence/MediaAttachmentQuery.cs
Normal file
20
MediaBrowser.Controller/Persistence/MediaAttachmentQuery.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Persistence
|
||||
{
|
||||
public class MediaAttachmentQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the index.
|
||||
/// </summary>
|
||||
/// <value>The index.</value>
|
||||
public int? Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the item identifier.
|
||||
/// </summary>
|
||||
/// <value>The item identifier.</value>
|
||||
public Guid ItemId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
{
|
||||
Recursive = true,
|
||||
IsFolder = false,
|
||||
OrderBy = new[] { ItemSortBy.SortName }.Select(i => new ValueTuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
MediaTypes = new[] { mediaType },
|
||||
EnableTotalRecordCount = false,
|
||||
DtoOptions = options
|
||||
|
||||
Reference in New Issue
Block a user