mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
7031a6ef87
@ -292,9 +292,9 @@ namespace MediaBrowser.Api.Playback
|
|||||||
return "h264_qsv";
|
return "h264_qsv";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "libnvenc";
|
return "h264_nvenc";
|
||||||
}
|
}
|
||||||
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
@ -338,8 +338,8 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// h264 (libnvenc)
|
// h264 (h264_nvenc)
|
||||||
else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
param = "-preset high-performance";
|
param = "-preset high-performance";
|
||||||
}
|
}
|
||||||
@ -412,9 +412,9 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(state.VideoRequest.Level))
|
if (!string.IsNullOrEmpty(state.VideoRequest.Level))
|
||||||
{
|
{
|
||||||
// h264_qsv and libnvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
|
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
|
||||||
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
|
||||||
string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
switch (state.VideoRequest.Level)
|
switch (state.VideoRequest.Level)
|
||||||
{
|
{
|
||||||
@ -458,7 +458,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) &&
|
if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) &&
|
!string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
!string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
param = "-pix_fmt yuv420p " + param;
|
param = "-pix_fmt yuv420p " + param;
|
||||||
}
|
}
|
||||||
@ -1645,7 +1645,8 @@ namespace MediaBrowser.Api.Playback
|
|||||||
var state = new StreamState(MediaSourceManager, Logger)
|
var state = new StreamState(MediaSourceManager, Logger)
|
||||||
{
|
{
|
||||||
Request = request,
|
Request = request,
|
||||||
RequestedUrl = url
|
RequestedUrl = url,
|
||||||
|
UserAgent = Request.UserAgent
|
||||||
};
|
};
|
||||||
|
|
||||||
//if ((Request.UserAgent ?? string.Empty).IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 ||
|
//if ((Request.UserAgent ?? string.Empty).IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
|
@ -74,10 +74,16 @@ namespace MediaBrowser.Api.Playback
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var userAgent = UserAgent ?? string.Empty;
|
||||||
|
if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,6 +105,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
public string OutputVideoSync = "-1";
|
public string OutputVideoSync = "-1";
|
||||||
|
|
||||||
public List<string> SupportedAudioCodecs { get; set; }
|
public List<string> SupportedAudioCodecs { get; set; }
|
||||||
|
public string UserAgent { get; set; }
|
||||||
|
|
||||||
public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger)
|
public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +123,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveConfiguration()
|
public void SaveConfiguration()
|
||||||
{
|
{
|
||||||
|
Logger.Info("Saving system configuration");
|
||||||
var path = CommonApplicationPaths.SystemConfigurationFilePath;
|
var path = CommonApplicationPaths.SystemConfigurationFilePath;
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
@ -296,6 +296,8 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
|||||||
|
|
||||||
private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
||||||
{
|
{
|
||||||
|
_logger.Info("Checking for cache file {0}", responseCachePath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
|
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||||
|
@ -80,6 +80,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
|||||||
/// <param name="file">The file.</param>
|
/// <param name="file">The file.</param>
|
||||||
public void SerializeToFile(object obj, string file)
|
public void SerializeToFile(object obj, string file)
|
||||||
{
|
{
|
||||||
|
_logger.Debug("Serializing to file {0}", file);
|
||||||
using (var stream = new FileStream(file, FileMode.Create))
|
using (var stream = new FileStream(file, FileMode.Create))
|
||||||
{
|
{
|
||||||
SerializeToStream(obj, stream);
|
SerializeToStream(obj, stream);
|
||||||
|
@ -193,6 +193,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||||||
/// <returns>Task{List{PackageInfo}}.</returns>
|
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
|
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
_logger.Info("Opening {0}", PackageCachePath);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var stream = _fileSystem.OpenRead(PackageCachePath))
|
using (var stream = _fileSystem.OpenRead(PackageCachePath))
|
||||||
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
/// <param name="imageStreamIndex">Index of the image stream.</param>
|
/// <param name="imageStreamIndex">Index of the image stream.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{Stream}.</returns>
|
/// <returns>Task{Stream}.</returns>
|
||||||
Task<Stream> ExtractAudioImage(string path, int? imageStreamIndex, CancellationToken cancellationToken);
|
Task<string> ExtractAudioImage(string path, int? imageStreamIndex, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts the video image.
|
/// Extracts the video image.
|
||||||
@ -46,9 +46,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
/// <param name="offset">The offset.</param>
|
/// <param name="offset">The offset.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{Stream}.</returns>
|
/// <returns>Task{Stream}.</returns>
|
||||||
Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
|
Task<string> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
|
||||||
|
|
||||||
Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, int? imageStreamIndex, CancellationToken cancellationToken);
|
Task<string> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, int? imageStreamIndex, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extracts the video images on interval.
|
/// Extracts the video images on interval.
|
||||||
|
@ -607,10 +607,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// h264 (libnvenc)
|
// h264 (h264_nvenc)
|
||||||
else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
else if (string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
param = "-preset high-performance";
|
param = "-preset llhq";
|
||||||
}
|
}
|
||||||
|
|
||||||
// webm
|
// webm
|
||||||
@ -683,9 +683,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(levelString))
|
if (!string.IsNullOrEmpty(levelString))
|
||||||
{
|
{
|
||||||
// h264_qsv and libnvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
|
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
|
||||||
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
|
||||||
string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
switch (levelString)
|
switch (levelString)
|
||||||
{
|
{
|
||||||
@ -729,7 +729,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) &&
|
if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) &&
|
!string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) &&
|
||||||
!string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
!string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
param = "-pix_fmt yuv420p " + param;
|
param = "-pix_fmt yuv420p " + param;
|
||||||
}
|
}
|
||||||
|
@ -78,17 +78,19 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
"libx265",
|
"libx265",
|
||||||
"mpeg4",
|
"mpeg4",
|
||||||
"msmpeg4",
|
"msmpeg4",
|
||||||
//"libvpx",
|
"libvpx",
|
||||||
//"libvpx-vp9",
|
"libvpx-vp9",
|
||||||
"aac",
|
"aac",
|
||||||
"libmp3lame",
|
"libmp3lame",
|
||||||
"libopus",
|
"libopus",
|
||||||
//"libvorbis",
|
"libvorbis",
|
||||||
"srt",
|
"srt",
|
||||||
"libnvenc",
|
"h264_nvenc",
|
||||||
"h264_qsv"
|
"h264_qsv"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
output = output ?? string.Empty;
|
||||||
|
|
||||||
foreach (var codec in required)
|
foreach (var codec in required)
|
||||||
{
|
{
|
||||||
var srch = " " + codec + " ";
|
var srch = " " + codec + " ";
|
||||||
@ -115,8 +117,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
Arguments = arguments,
|
Arguments = arguments,
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
ErrorDialog = false,
|
ErrorDialog = false,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true
|
||||||
RedirectStandardError = true
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -126,8 +127,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
process.BeginErrorReadLine();
|
|
||||||
|
|
||||||
return process.StandardOutput.ReadToEnd();
|
return process.StandardOutput.ReadToEnd();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -562,9 +562,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
return "h264_qsv";
|
return "h264_qsv";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(options.HardwareAccelerationType, "libnvenc", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "libnvenc";
|
return "h264_nvenc";
|
||||||
}
|
}
|
||||||
if (string.Equals(options.HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(options.HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -767,22 +767,22 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
public Task<Stream> ExtractAudioImage(string path, int? imageStreamIndex, CancellationToken cancellationToken)
|
public Task<string> ExtractAudioImage(string path, int? imageStreamIndex, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return ExtractImage(new[] { path }, imageStreamIndex, MediaProtocol.File, true, null, null, cancellationToken);
|
return ExtractImage(new[] { path }, imageStreamIndex, MediaProtocol.File, true, null, null, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken)
|
public Task<string> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return ExtractImage(inputFiles, null, protocol, false, threedFormat, offset, cancellationToken);
|
return ExtractImage(inputFiles, null, protocol, false, threedFormat, offset, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, int? imageStreamIndex, CancellationToken cancellationToken)
|
public Task<string> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, int? imageStreamIndex, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return ExtractImage(inputFiles, imageStreamIndex, protocol, false, null, null, cancellationToken);
|
return ExtractImage(inputFiles, imageStreamIndex, protocol, false, null, null, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Stream> ExtractImage(string[] inputFiles, int? imageStreamIndex, MediaProtocol protocol, bool isAudio,
|
private async Task<string> ExtractImage(string[] inputFiles, int? imageStreamIndex, MediaProtocol protocol, bool isAudio,
|
||||||
Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken)
|
Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var resourcePool = isAudio ? _audioImageResourcePool : _videoImageResourcePool;
|
var resourcePool = isAudio ? _audioImageResourcePool : _videoImageResourcePool;
|
||||||
@ -816,13 +816,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
return await ExtractImageInternal(inputArgument, imageStreamIndex, protocol, threedFormat, offset, false, resourcePool, cancellationToken).ConfigureAwait(false);
|
return await ExtractImageInternal(inputArgument, imageStreamIndex, protocol, threedFormat, offset, false, resourcePool, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Stream> ExtractImageInternal(string inputPath, int? imageStreamIndex, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, bool useIFrame, SemaphoreSlim resourcePool, CancellationToken cancellationToken)
|
private async Task<string> ExtractImageInternal(string inputPath, int? imageStreamIndex, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, bool useIFrame, SemaphoreSlim resourcePool, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(inputPath))
|
if (string.IsNullOrEmpty(inputPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("inputPath");
|
throw new ArgumentNullException("inputPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg");
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(tempExtractPath));
|
||||||
|
|
||||||
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
|
// apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
|
||||||
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
|
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
|
||||||
var vf = "scale=600:trunc(600/dar/2)*2";
|
var vf = "scale=600:trunc(600/dar/2)*2";
|
||||||
@ -855,8 +858,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
var mapArg = imageStreamIndex.HasValue ? (" -map 0:v:" + imageStreamIndex.Value.ToString(CultureInfo.InvariantCulture)) : string.Empty;
|
var mapArg = imageStreamIndex.HasValue ? (" -map 0:v:" + imageStreamIndex.Value.ToString(CultureInfo.InvariantCulture)) : string.Empty;
|
||||||
|
|
||||||
// Use ffmpeg to sample 100 (we can drop this if required using thumbnail=50 for 50 frames) frames and pick the best thumbnail. Have a fall back just in case.
|
// Use ffmpeg to sample 100 (we can drop this if required using thumbnail=50 for 50 frames) frames and pick the best thumbnail. Have a fall back just in case.
|
||||||
var args = useIFrame ? string.Format("-i {0}{3} -threads 1 -v quiet -vframes 1 -vf \"{2},thumbnail=30\" -f image2 \"{1}\"", inputPath, "-", vf, mapArg) :
|
var args = useIFrame ? string.Format("-i {0}{3} -threads 1 -v quiet -vframes 1 -vf \"{2},thumbnail=30\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg) :
|
||||||
string.Format("-i {0}{3} -threads 1 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, "-", vf, mapArg);
|
string.Format("-i {0}{3} -threads 1 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg);
|
||||||
|
|
||||||
var probeSize = GetProbeSizeArgument(new[] { inputPath }, protocol);
|
var probeSize = GetProbeSizeArgument(new[] { inputPath }, protocol);
|
||||||
|
|
||||||
@ -880,8 +883,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
Arguments = args,
|
Arguments = args,
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
ErrorDialog = false,
|
ErrorDialog = false,
|
||||||
RedirectStandardOutput = true,
|
|
||||||
RedirectStandardError = true,
|
|
||||||
RedirectStandardInput = true
|
RedirectStandardInput = true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -894,20 +895,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
bool ranToCompletion;
|
bool ranToCompletion;
|
||||||
|
|
||||||
var memoryStream = new MemoryStream();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StartProcess(processWrapper);
|
StartProcess(processWrapper);
|
||||||
|
|
||||||
#pragma warning disable 4014
|
|
||||||
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
|
|
||||||
process.StandardOutput.BaseStream.CopyToAsync(memoryStream);
|
|
||||||
#pragma warning restore 4014
|
|
||||||
|
|
||||||
// MUST read both stdout and stderr asynchronously or a deadlock may occurr
|
|
||||||
process.BeginErrorReadLine();
|
|
||||||
|
|
||||||
ranToCompletion = process.WaitForExit(10000);
|
ranToCompletion = process.WaitForExit(10000);
|
||||||
|
|
||||||
if (!ranToCompletion)
|
if (!ranToCompletion)
|
||||||
@ -922,11 +913,10 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1;
|
var exitCode = ranToCompletion ? processWrapper.ExitCode ?? 0 : -1;
|
||||||
|
var file = new FileInfo(tempExtractPath);
|
||||||
|
|
||||||
if (exitCode == -1 || memoryStream.Length == 0)
|
if (exitCode == -1 || !file.Exists || file.Length == 0)
|
||||||
{
|
{
|
||||||
memoryStream.Dispose();
|
|
||||||
|
|
||||||
var msg = string.Format("ffmpeg image extraction failed for {0}", inputPath);
|
var msg = string.Format("ffmpeg image extraction failed for {0}", inputPath);
|
||||||
|
|
||||||
_logger.Error(msg);
|
_logger.Error(msg);
|
||||||
@ -934,8 +924,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
throw new ApplicationException(msg);
|
throw new ApplicationException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryStream.Position = 0;
|
return tempExtractPath;
|
||||||
return memoryStream;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,12 +83,17 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index;
|
var imageStreamIndex = imageStream == null ? (int?)null : imageStream.Index;
|
||||||
|
|
||||||
using (var stream = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false))
|
var tempFile = await _mediaEncoder.ExtractAudioImage(item.Path, imageStreamIndex, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
File.Copy(tempFile, path, true);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using (var fileStream = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, true))
|
File.Delete(tempFile);
|
||||||
{
|
|
||||||
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ??
|
imageStreams.FirstOrDefault(i => (i.Comment ?? string.Empty).IndexOf("cover", StringComparison.OrdinalIgnoreCase) != -1) ??
|
||||||
imageStreams.FirstOrDefault();
|
imageStreams.FirstOrDefault();
|
||||||
|
|
||||||
Stream stream;
|
string extractedImagePath;
|
||||||
|
|
||||||
if (imageStream != null)
|
if (imageStream != null)
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, videoIndex, cancellationToken).ConfigureAwait(false);
|
extractedImagePath = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, videoIndex, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -146,14 +146,15 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
? TimeSpan.FromTicks(Convert.ToInt64(item.RunTimeTicks.Value * .1))
|
? TimeSpan.FromTicks(Convert.ToInt64(item.RunTimeTicks.Value * .1))
|
||||||
: TimeSpan.FromSeconds(10);
|
: TimeSpan.FromSeconds(10);
|
||||||
|
|
||||||
stream = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, item.Video3DFormat, imageOffset, cancellationToken).ConfigureAwait(false);
|
extractedImagePath = await _mediaEncoder.ExtractVideoImage(inputPath, protocol, item.Video3DFormat, imageOffset, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DynamicImageResponse
|
return new DynamicImageResponse
|
||||||
{
|
{
|
||||||
Format = ImageFormat.Jpg,
|
Format = ImageFormat.Jpg,
|
||||||
HasImage = true,
|
HasImage = true,
|
||||||
Stream = stream
|
Path = extractedImagePath,
|
||||||
|
Protocol = MediaProtocol.File
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -12,6 +12,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Localization
|
namespace MediaBrowser.Server.Implementations.Localization
|
||||||
{
|
{
|
||||||
@ -35,6 +36,7 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||||||
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
|
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
|
||||||
@ -42,11 +44,12 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||||||
/// <param name="configurationManager">The configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="jsonSerializer">The json serializer.</param>
|
/// <param name="jsonSerializer">The json serializer.</param>
|
||||||
public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer)
|
public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger)
|
||||||
{
|
{
|
||||||
_configurationManager = configurationManager;
|
_configurationManager = configurationManager;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
ExtractAll();
|
ExtractAll();
|
||||||
}
|
}
|
||||||
@ -75,7 +78,10 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||||||
{
|
{
|
||||||
using (var stream = type.Assembly.GetManifestResourceStream(resource))
|
using (var stream = type.Assembly.GetManifestResourceStream(resource))
|
||||||
{
|
{
|
||||||
using (var fs = _fileSystem.GetFileStream(Path.Combine(localizationPath, filename), FileMode.Create, FileAccess.Write, FileShare.Read))
|
var target = Path.Combine(localizationPath, filename);
|
||||||
|
_logger.Info("Extracting ratings to {0}", target);
|
||||||
|
|
||||||
|
using (var fs = _fileSystem.GetFileStream(target, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||||
{
|
{
|
||||||
stream.CopyTo(fs);
|
stream.CopyTo(fs);
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,16 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
|||||||
{
|
{
|
||||||
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
|
||||||
using (var stream = await _encoder.ExtractVideoImage(inputPath, protocol, video.Video3DFormat, time, cancellationToken).ConfigureAwait(false))
|
var tempFile = await _encoder.ExtractVideoImage(inputPath, protocol, video.Video3DFormat, time, cancellationToken).ConfigureAwait(false);
|
||||||
|
File.Copy(tempFile, path, true);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using (var fileStream = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, true))
|
File.Delete(tempFile);
|
||||||
{
|
|
||||||
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chapter.ImagePath = path;
|
chapter.ImagePath = path;
|
||||||
|
@ -3862,7 +3862,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
? (CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)
|
? (CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)
|
||||||
: CommandBehavior.SequentialAccess;
|
: CommandBehavior.SequentialAccess;
|
||||||
|
|
||||||
Logger.Debug("GetItemValues: " + cmd.CommandText);
|
//Logger.Debug("GetItemValues: " + cmd.CommandText);
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader(commandBehavior))
|
using (var reader = cmd.ExecuteReader(commandBehavior))
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using Mono.Security.X509;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using MediaBrowser.Server.Mono.Security;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Mono.Networking
|
namespace MediaBrowser.Server.Mono.Networking
|
||||||
{
|
{
|
||||||
|
@ -34,18 +34,13 @@ using System.Collections;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Mono.Security {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// a. ITU ASN.1 standards (free download)
|
// a. ITU ASN.1 standards (free download)
|
||||||
// http://www.itu.int/ITU-T/studygroups/com17/languages/
|
// http://www.itu.int/ITU-T/studygroups/com17/languages/
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public class ASN1 {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class ASN1 {
|
|
||||||
|
|
||||||
private byte m_nTag;
|
private byte m_nTag;
|
||||||
private byte[] m_aValue;
|
private byte[] m_aValue;
|
||||||
|
@ -30,23 +30,17 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Mono.Security {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// a. ITU ASN.1 standards (free download)
|
// a. ITU ASN.1 standards (free download)
|
||||||
// http://www.itu.int/ITU-T/studygroups/com17/languages/
|
// http://www.itu.int/ITU-T/studygroups/com17/languages/
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public static class ASN1Convert {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
static class ASN1Convert {
|
|
||||||
// RFC3280, section 4.2.1.5
|
// RFC3280, section 4.2.1.5
|
||||||
// CAs conforming to this profile MUST always encode certificate
|
// CAs conforming to this profile MUST always encode certificate
|
||||||
// validity dates through the year 2049 as UTCTime; certificate validity
|
// validity dates through the year 2049 as UTCTime; certificate validity
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Mono.Security
|
namespace MediaBrowser.Server.Mono.Security
|
||||||
{
|
{
|
||||||
internal sealed class BitConverterLE
|
internal sealed class BitConverterLE
|
||||||
{
|
{
|
||||||
|
@ -32,14 +32,9 @@ using System.Globalization;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Mono.Security.Cryptography {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public sealed class CryptoConvert {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
sealed class CryptoConvert {
|
|
||||||
|
|
||||||
private CryptoConvert ()
|
private CryptoConvert ()
|
||||||
{
|
{
|
||||||
@ -166,31 +161,30 @@ namespace Mono.Security.Cryptography {
|
|||||||
throw new CryptographicException ("Invalid blob.", e);
|
throw new CryptographicException ("Invalid blob.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INSIDE_CORLIB && MOBILE
|
|
||||||
RSA rsa = RSA.Create ();
|
|
||||||
rsa.ImportParameters (rsap);
|
|
||||||
#else
|
|
||||||
RSA rsa = null;
|
RSA rsa = null;
|
||||||
try {
|
try
|
||||||
rsa = RSA.Create ();
|
{
|
||||||
rsa.ImportParameters (rsap);
|
rsa = RSA.Create();
|
||||||
|
rsa.ImportParameters(rsap);
|
||||||
}
|
}
|
||||||
catch (CryptographicException ce) {
|
catch (CryptographicException ce)
|
||||||
|
{
|
||||||
// this may cause problem when this code is run under
|
// this may cause problem when this code is run under
|
||||||
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
||||||
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
||||||
try {
|
try
|
||||||
CspParameters csp = new CspParameters ();
|
{
|
||||||
|
CspParameters csp = new CspParameters();
|
||||||
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
||||||
rsa = new RSACryptoServiceProvider (csp);
|
rsa = new RSACryptoServiceProvider(csp);
|
||||||
rsa.ImportParameters (rsap);
|
rsa.ImportParameters(rsap);
|
||||||
}
|
}
|
||||||
catch {
|
catch
|
||||||
|
{
|
||||||
// rethrow original, not the later, exception if this fails
|
// rethrow original, not the later, exception if this fails
|
||||||
throw ce;
|
throw ce;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return rsa;
|
return rsa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,31 +245,30 @@ namespace Mono.Security.Cryptography {
|
|||||||
throw new CryptographicException ("Invalid blob.", e);
|
throw new CryptographicException ("Invalid blob.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INSIDE_CORLIB && MOBILE
|
|
||||||
DSA dsa = (DSA)DSA.Create ();
|
|
||||||
dsa.ImportParameters (dsap);
|
|
||||||
#else
|
|
||||||
DSA dsa = null;
|
DSA dsa = null;
|
||||||
try {
|
try
|
||||||
dsa = (DSA)DSA.Create ();
|
{
|
||||||
dsa.ImportParameters (dsap);
|
dsa = (DSA)DSA.Create();
|
||||||
|
dsa.ImportParameters(dsap);
|
||||||
}
|
}
|
||||||
catch (CryptographicException ce) {
|
catch (CryptographicException ce)
|
||||||
|
{
|
||||||
// this may cause problem when this code is run under
|
// this may cause problem when this code is run under
|
||||||
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
||||||
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
||||||
try {
|
try
|
||||||
CspParameters csp = new CspParameters ();
|
{
|
||||||
|
CspParameters csp = new CspParameters();
|
||||||
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
||||||
dsa = new DSACryptoServiceProvider (csp);
|
dsa = new DSACryptoServiceProvider(csp);
|
||||||
dsa.ImportParameters (dsap);
|
dsa.ImportParameters(dsap);
|
||||||
}
|
}
|
||||||
catch {
|
catch
|
||||||
|
{
|
||||||
// rethrow original, not the later, exception if this fails
|
// rethrow original, not the later, exception if this fails
|
||||||
throw ce;
|
throw ce;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return dsa;
|
return dsa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,25 +437,22 @@ namespace Mono.Security.Cryptography {
|
|||||||
rsap.Modulus = new byte [byteLen];
|
rsap.Modulus = new byte [byteLen];
|
||||||
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
|
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
|
||||||
Array.Reverse (rsap.Modulus);
|
Array.Reverse (rsap.Modulus);
|
||||||
#if INSIDE_CORLIB && MOBILE
|
|
||||||
RSA rsa = RSA.Create ();
|
|
||||||
rsa.ImportParameters (rsap);
|
|
||||||
#else
|
|
||||||
RSA rsa = null;
|
RSA rsa = null;
|
||||||
try {
|
try
|
||||||
rsa = RSA.Create ();
|
{
|
||||||
rsa.ImportParameters (rsap);
|
rsa = RSA.Create();
|
||||||
|
rsa.ImportParameters(rsap);
|
||||||
}
|
}
|
||||||
catch (CryptographicException) {
|
catch (CryptographicException)
|
||||||
|
{
|
||||||
// this may cause problem when this code is run under
|
// this may cause problem when this code is run under
|
||||||
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
||||||
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
||||||
CspParameters csp = new CspParameters ();
|
CspParameters csp = new CspParameters();
|
||||||
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
||||||
rsa = new RSACryptoServiceProvider (csp);
|
rsa = new RSACryptoServiceProvider(csp);
|
||||||
rsa.ImportParameters (rsap);
|
rsa.ImportParameters(rsap);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return rsa;
|
return rsa;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -31,18 +31,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace Mono.Security.Cryptography {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// a. PKCS#1: RSA Cryptography Standard
|
// a. PKCS#1: RSA Cryptography Standard
|
||||||
// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
|
// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public sealed class PKCS1 {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
sealed class PKCS1 {
|
|
||||||
|
|
||||||
private PKCS1 ()
|
private PKCS1 ()
|
||||||
{
|
{
|
||||||
|
@ -37,17 +37,9 @@ using System.IO;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Mono.Security;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
using Mono.Security.Cryptography;
|
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
public class PKCS5 {
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class PKCS5 {
|
|
||||||
|
|
||||||
public const string pbeWithMD2AndDESCBC = "1.2.840.113549.1.5.1";
|
public const string pbeWithMD2AndDESCBC = "1.2.840.113549.1.5.1";
|
||||||
public const string pbeWithMD5AndDESCBC = "1.2.840.113549.1.5.3";
|
public const string pbeWithMD5AndDESCBC = "1.2.840.113549.1.5.3";
|
||||||
@ -59,12 +51,7 @@ namespace Mono.Security.X509 {
|
|||||||
public PKCS5 () {}
|
public PKCS5 () {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public class PKCS9 {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class PKCS9 {
|
|
||||||
|
|
||||||
public const string friendlyName = "1.2.840.113549.1.9.20";
|
public const string friendlyName = "1.2.840.113549.1.9.20";
|
||||||
public const string localKeyId = "1.2.840.113549.1.9.21";
|
public const string localKeyId = "1.2.840.113549.1.9.21";
|
||||||
@ -92,12 +79,7 @@ namespace Mono.Security.X509 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public class PKCS12 : ICloneable {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class PKCS12 : ICloneable {
|
|
||||||
|
|
||||||
public const string pbeWithSHAAnd128BitRC4 = "1.2.840.113549.1.12.1.1";
|
public const string pbeWithSHAAnd128BitRC4 = "1.2.840.113549.1.12.1.1";
|
||||||
public const string pbeWithSHAAnd40BitRC4 = "1.2.840.113549.1.12.1.2";
|
public const string pbeWithSHAAnd40BitRC4 = "1.2.840.113549.1.12.1.2";
|
||||||
@ -657,28 +639,7 @@ namespace Mono.Security.X509 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SymmetricAlgorithm sa = null;
|
SymmetricAlgorithm sa = null;
|
||||||
#if INSIDE_CORLIB && FULL_AOT_RUNTIME
|
sa = SymmetricAlgorithm.Create(algorithm);
|
||||||
// we do not want CryptoConfig to bring the whole crypto stack
|
|
||||||
// in particular Rijndael which is not supported by CommonCrypto
|
|
||||||
switch (algorithm) {
|
|
||||||
case "DES":
|
|
||||||
sa = DES.Create ();
|
|
||||||
break;
|
|
||||||
case "RC2":
|
|
||||||
sa = RC2.Create ();
|
|
||||||
break;
|
|
||||||
case "TripleDES":
|
|
||||||
sa = TripleDES.Create ();
|
|
||||||
break;
|
|
||||||
case "RC4":
|
|
||||||
sa = RC4.Create ();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new NotSupportedException (algorithm);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
sa = SymmetricAlgorithm.Create (algorithm);
|
|
||||||
#endif
|
|
||||||
sa.Key = pd.DeriveKey (keyLength);
|
sa.Key = pd.DeriveKey (keyLength);
|
||||||
// IV required only for block ciphers (not stream ciphers)
|
// IV required only for block ciphers (not stream ciphers)
|
||||||
if (ivLength > 0) {
|
if (ivLength > 0) {
|
||||||
@ -1968,34 +1929,5 @@ namespace Mono.Security.X509 {
|
|||||||
password_max_length = value;
|
password_max_length = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static methods
|
|
||||||
|
|
||||||
static private byte[] LoadFile (string filename)
|
|
||||||
{
|
|
||||||
byte[] data = null;
|
|
||||||
using (FileStream fs = File.OpenRead (filename)) {
|
|
||||||
data = new byte [fs.Length];
|
|
||||||
fs.Read (data, 0, data.Length);
|
|
||||||
fs.Close ();
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public PKCS12 LoadFromFile (string filename)
|
|
||||||
{
|
|
||||||
if (filename == null)
|
|
||||||
throw new ArgumentNullException ("filename");
|
|
||||||
|
|
||||||
return new PKCS12 (LoadFile (filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
static public PKCS12 LoadFromFile (string filename, string password)
|
|
||||||
{
|
|
||||||
if (filename == null)
|
|
||||||
throw new ArgumentNullException ("filename");
|
|
||||||
|
|
||||||
return new PKCS12 (LoadFile (filename), password);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,16 +33,9 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
using Mono.Security.X509;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
namespace Mono.Security {
|
public sealed class PKCS7 {
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
sealed class PKCS7 {
|
|
||||||
|
|
||||||
public class Oid {
|
public class Oid {
|
||||||
// pkcs 1
|
// pkcs 1
|
||||||
|
@ -33,14 +33,9 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
using Mono.Security.X509;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
namespace Mono.Security.Cryptography {
|
public sealed class PKCS8 {
|
||||||
|
|
||||||
#if !INSIDE_CORLIB
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
sealed class PKCS8 {
|
|
||||||
|
|
||||||
public enum KeyInfo {
|
public enum KeyInfo {
|
||||||
PrivateKey,
|
PrivateKey,
|
||||||
@ -277,19 +272,13 @@ namespace Mono.Security.Cryptography {
|
|||||||
rsa.ImportParameters (param);
|
rsa.ImportParameters (param);
|
||||||
}
|
}
|
||||||
catch (CryptographicException) {
|
catch (CryptographicException) {
|
||||||
#if MONOTOUCH
|
|
||||||
// there's no machine-wide store available for iOS so we can drop the dependency on
|
|
||||||
// CspParameters (which drops other things, like XML key persistance, unless used elsewhere)
|
|
||||||
throw;
|
|
||||||
#else
|
|
||||||
// this may cause problem when this code is run under
|
// this may cause problem when this code is run under
|
||||||
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
// the SYSTEM identity on Windows (e.g. ASP.NET). See
|
||||||
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
|
||||||
CspParameters csp = new CspParameters ();
|
CspParameters csp = new CspParameters();
|
||||||
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
csp.Flags = CspProviderFlags.UseMachineKeyStore;
|
||||||
rsa = new RSACryptoServiceProvider (csp);
|
rsa = new RSACryptoServiceProvider(csp);
|
||||||
rsa.ImportParameters (param);
|
rsa.ImportParameters(param);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return rsa;
|
return rsa;
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,7 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Mono.Security;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
using Mono.Security.Cryptography;
|
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// 1. Information technology - Open Systems Interconnection - The Directory: Models
|
// 1. Information technology - Open Systems Interconnection - The Directory: Models
|
||||||
@ -49,12 +46,7 @@ namespace Mono.Security.X509 {
|
|||||||
*
|
*
|
||||||
* RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
|
* RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
|
||||||
*/
|
*/
|
||||||
#if INSIDE_CORLIB
|
public sealed class X501 {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
sealed class X501 {
|
|
||||||
|
|
||||||
static byte[] countryName = { 0x55, 0x04, 0x06 };
|
static byte[] countryName = { 0x55, 0x04, 0x06 };
|
||||||
static byte[] organizationName = { 0x55, 0x04, 0x0A };
|
static byte[] organizationName = { 0x55, 0x04, 0x0A };
|
||||||
|
@ -33,9 +33,7 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
using Mono.Security;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
|
||||||
|
|
||||||
public abstract class X509Builder {
|
public abstract class X509Builder {
|
||||||
|
|
||||||
|
@ -31,12 +31,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using SSCX = System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Mono.Security.Cryptography;
|
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// a. Internet X.509 Public Key Infrastructure Certificate and CRL Profile
|
// a. Internet X.509 Public Key Infrastructure Certificate and CRL Profile
|
||||||
@ -44,11 +42,8 @@ namespace Mono.Security.X509 {
|
|||||||
// b. ITU ASN.1 standards (free download)
|
// b. ITU ASN.1 standards (free download)
|
||||||
// http://www.itu.int/ITU-T/studygroups/com17/languages/
|
// http://www.itu.int/ITU-T/studygroups/com17/languages/
|
||||||
|
|
||||||
#if INSIDE_CORLIB
|
public class X509Certificate : ISerializable
|
||||||
internal class X509Certificate : ISerializable {
|
{
|
||||||
#else
|
|
||||||
public class X509Certificate : ISerializable {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private ASN1 decoder;
|
private ASN1 decoder;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
// From RFC3280
|
// From RFC3280
|
||||||
/*
|
/*
|
||||||
* Certificate ::= SEQUENCE {
|
* Certificate ::= SEQUENCE {
|
||||||
|
@ -31,15 +31,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
#if INSIDE_CORLIB
|
public class X509CertificateCollection : CollectionBase, IEnumerable {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class X509CertificateCollection : CollectionBase, IEnumerable {
|
|
||||||
|
|
||||||
public X509CertificateCollection ()
|
public X509CertificateCollection ()
|
||||||
{
|
{
|
||||||
|
@ -31,9 +31,7 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Mono.Security;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
|
||||||
/*
|
/*
|
||||||
* Extension ::= SEQUENCE {
|
* Extension ::= SEQUENCE {
|
||||||
* extnID OBJECT IDENTIFIER,
|
* extnID OBJECT IDENTIFIER,
|
||||||
@ -41,12 +39,7 @@ namespace Mono.Security.X509 {
|
|||||||
* extnValue OCTET STRING
|
* extnValue OCTET STRING
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
#if INSIDE_CORLIB
|
public class X509Extension {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class X509Extension {
|
|
||||||
|
|
||||||
protected string extnOid;
|
protected string extnOid;
|
||||||
protected bool extnCritical;
|
protected bool extnCritical;
|
||||||
|
@ -32,20 +32,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
using Mono.Security;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
|
||||||
/*
|
/*
|
||||||
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
|
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
|
||||||
*
|
*
|
||||||
* Note: 1..MAX -> There shouldn't be 0 Extensions in the ASN1 structure
|
* Note: 1..MAX -> There shouldn't be 0 Extensions in the ASN1 structure
|
||||||
*/
|
*/
|
||||||
#if INSIDE_CORLIB
|
public sealed class X509ExtensionCollection : CollectionBase, IEnumerable {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
sealed class X509ExtensionCollection : CollectionBase, IEnumerable {
|
|
||||||
|
|
||||||
private bool readOnly;
|
private bool readOnly;
|
||||||
|
|
||||||
|
@ -28,12 +28,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Mono.Security;
|
namespace MediaBrowser.Server.Mono.Security {
|
||||||
|
|
||||||
namespace Mono.Security.X509 {
|
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// 1. Information technology - Open Systems Interconnection - The Directory: Selected attribute types
|
// 1. Information technology - Open Systems Interconnection - The Directory: Selected attribute types
|
||||||
@ -55,12 +52,7 @@ namespace Mono.Security.X509 {
|
|||||||
*
|
*
|
||||||
* AttributeValue ::= ANY DEFINED BY AttributeType
|
* AttributeValue ::= ANY DEFINED BY AttributeType
|
||||||
*/
|
*/
|
||||||
#if INSIDE_CORLIB
|
public class X520 {
|
||||||
internal
|
|
||||||
#else
|
|
||||||
public
|
|
||||||
#endif
|
|
||||||
class X520 {
|
|
||||||
|
|
||||||
public abstract class AttributeTypeAndValue {
|
public abstract class AttributeTypeAndValue {
|
||||||
private string oid;
|
private string oid;
|
||||||
|
@ -418,7 +418,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
RegisterSingleInstance(ServerConfigurationManager);
|
RegisterSingleInstance(ServerConfigurationManager);
|
||||||
|
|
||||||
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer);
|
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LogManager.GetLogger("LocalizationManager"));
|
||||||
RegisterSingleInstance(LocalizationManager);
|
RegisterSingleInstance(LocalizationManager);
|
||||||
|
|
||||||
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
||||||
@ -489,7 +489,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
var encryptionManager = new EncryptionManager();
|
var encryptionManager = new EncryptionManager();
|
||||||
RegisterSingleInstance<IEncryptionManager>(encryptionManager);
|
RegisterSingleInstance<IEncryptionManager>(encryptionManager);
|
||||||
|
|
||||||
ConnectManager = new ConnectManager(LogManager.GetLogger("Connect"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager, SecurityManager, FileSystemManager);
|
ConnectManager = new ConnectManager(LogManager.GetLogger("ConnectManager"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager, SecurityManager, FileSystemManager);
|
||||||
RegisterSingleInstance(ConnectManager);
|
RegisterSingleInstance(ConnectManager);
|
||||||
|
|
||||||
DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, LogManager.GetLogger("DeviceManager"), FileSystemManager), UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
|
DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, LogManager.GetLogger("DeviceManager"), FileSystemManager), UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user