diff options
| author | Tthecreator <epostvanthomas@kpnmail.nl> | 2019-01-22 15:22:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 15:22:42 +0000 |
| commit | 189b99df16bd4c93cc96422d7282d01d9ff5b82f (patch) | |
| tree | 26d7da95fe3e3b2772b8b39a2463a6c0ac7652fc /MediaBrowser.Api/Playback/StreamState.cs | |
| parent | a00c0defa8cb22774f5dc8a7d566eb36ac7307e8 (diff) | |
| parent | edcfd8b565f632088c8b1f826db8e2fbecf9790d (diff) | |
Merge pull request #1 from jellyfin/dev
Update from jellyfin repo
Diffstat (limited to 'MediaBrowser.Api/Playback/StreamState.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/StreamState.cs | 125 |
1 files changed, 21 insertions, 104 deletions
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 73741d527..96dc4ab4c 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -1,18 +1,9 @@ -using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Dlna; -using MediaBrowser.Model.Drawing; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.MediaInfo; -using MediaBrowser.Model.Net; using System; -using System.Collections.Generic; -using System.Globalization; using System.IO; -using System.Linq; -using System.Threading; +using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; +using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Net; using Microsoft.Extensions.Logging; namespace MediaBrowser.Api.Playback @@ -26,7 +17,7 @@ namespace MediaBrowser.Api.Playback public StreamRequest Request { - get { return (StreamRequest)BaseRequest; } + get => (StreamRequest)BaseRequest; set { BaseRequest = value; @@ -37,10 +28,7 @@ namespace MediaBrowser.Api.Playback public TranscodingThrottler TranscodingThrottler { get; set; } - public VideoStreamRequest VideoRequest - { - get { return Request as VideoStreamRequest; } - } + public VideoStreamRequest VideoRequest => Request as VideoStreamRequest; /// <summary> /// Gets or sets the log file stream. @@ -51,10 +39,7 @@ namespace MediaBrowser.Api.Playback public string WaitForPath { get; set; } - public bool IsOutputVideo - { - get { return Request is VideoStreamRequest; } - } + public bool IsOutputVideo => Request is VideoStreamRequest; public int SegmentLength { @@ -107,82 +92,60 @@ namespace MediaBrowser.Api.Playback } } - public int HlsListSize - { - get - { - return 0; - } - } - public string UserAgent { get; set; } public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger, TranscodingJobType transcodingType) - : base(logger, mediaSourceManager, transcodingType) + : base(transcodingType) { _mediaSourceManager = mediaSourceManager; _logger = logger; } - public string MimeType { get; set; } - public bool EstimateContentLength { get; set; } public TranscodeSeekInfo TranscodeSeekInfo { get; set; } - public long? EncodingDurationTicks { get; set; } - - public string GetMimeType(string outputPath, bool enableStreamDefault = true) - { - if (!string.IsNullOrEmpty(MimeType)) - { - return MimeType; - } - - return MimeTypes.GetMimeType(outputPath, enableStreamDefault); - } - public bool EnableDlnaHeaders { get; set; } - public void Dispose() + public override void Dispose() { DisposeTranscodingThrottler(); - DisposeLiveStream(); DisposeLogStream(); + DisposeLiveStream(); TranscodingJob = null; } - private void DisposeLogStream() + private void DisposeTranscodingThrottler() { - if (LogFileStream != null) + if (TranscodingThrottler != null) { try { - LogFileStream.Dispose(); + TranscodingThrottler.Dispose(); } catch (Exception ex) { - _logger.LogError(ex, "Error disposing log stream"); + _logger.LogError(ex, "Error disposing TranscodingThrottler"); } - LogFileStream = null; + TranscodingThrottler = null; } } - private void DisposeTranscodingThrottler() + private void DisposeLogStream() { - if (TranscodingThrottler != null) + if (LogFileStream != null) { try { - TranscodingThrottler.Dispose(); + LogFileStream.Dispose(); } catch (Exception ex) { - _logger.LogError(ex, "Error disposing TranscodingThrottler"); + _logger.LogError(ex, "Error disposing log stream"); } - TranscodingThrottler = null; + LogFileStream = null; } } @@ -201,58 +164,12 @@ namespace MediaBrowser.Api.Playback } } - public string OutputFilePath { get; set; } - - public string ActualOutputVideoCodec - { - get - { - var codec = OutputVideoCodec; - - if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase)) - { - var stream = VideoStream; - - if (stream != null) - { - return stream.Codec; - } - - return null; - } - - return codec; - } - } - - public string ActualOutputAudioCodec - { - get - { - var codec = OutputAudioCodec; - - if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase)) - { - var stream = AudioStream; - - if (stream != null) - { - return stream.Codec; - } - - return null; - } - - return codec; - } - } - public DeviceProfile DeviceProfile { get; set; } public TranscodingJob TranscodingJob; - public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate) + public void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate) { - ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, 0, percentComplete, 0, bitRate); + ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate); } } } |
