mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-06 18:26:33 +00:00
Trickplay generation, manager, storage
This commit is contained in:
@@ -149,6 +149,36 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return defaultEncoder;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
var preferredEncoder = codecMap[hwType];
|
||||
|
||||
if (_mediaEncoder.SupportsEncoder(preferredEncoder))
|
||||
{
|
||||
return preferredEncoder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return defaultEncoder;
|
||||
}
|
||||
|
||||
private bool IsVaapiSupported(EncodingJobInfo state)
|
||||
{
|
||||
// vaapi will throw an error with this input
|
||||
@@ -277,6 +307,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return GetH264Encoder(state, encodingOptions);
|
||||
}
|
||||
|
||||
if (string.Equals(codec, "mjpeg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return GetMjpegEncoder(state, encodingOptions);
|
||||
}
|
||||
|
||||
if (string.Equals(codec, "vp8", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(codec, "vpx", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Dto;
|
||||
@@ -137,6 +138,32 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// <returns>Location of video image.</returns>
|
||||
Task<string> ExtractVideoImage(string inputFile, string container, MediaSourceInfo mediaSource, MediaStream imageStream, int? imageStreamIndex, ImageFormat? targetFormat, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the video images on interval.
|
||||
/// </summary>
|
||||
/// <param name="inputFile">Input file.</param>
|
||||
/// <param name="container">Video container type.</param>
|
||||
/// <param name="mediaSource">Media source information.</param>
|
||||
/// <param name="imageStream">Media stream information.</param>
|
||||
/// <param name="interval">The interval.</param>
|
||||
/// <param name="maxWidth">The maximum width.</param>
|
||||
/// <param name="allowHwAccel">Allow for hardware acceleration.</param>
|
||||
/// <param name="allowHwEncode">Allow for hardware encoding. allowHwAccel must also be true.</param>
|
||||
/// <param name="encodingHelper">EncodingHelper instance.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Directory where images where extracted. A given image made before another will always be named with a lower number.</returns>
|
||||
Task<string> ExtractVideoImagesOnIntervalAccelerated(
|
||||
string inputFile,
|
||||
string container,
|
||||
MediaSourceInfo mediaSource,
|
||||
MediaStream imageStream,
|
||||
TimeSpan interval,
|
||||
int maxWidth,
|
||||
bool allowHwAccel,
|
||||
bool allowHwEncode,
|
||||
EncodingHelper encodingHelper,
|
||||
CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media info.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user