From 718545a79b0ba8709609b176ebb3922d6fa8eb6d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 19 Sep 2015 22:06:56 -0400 Subject: update metadata editor --- MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | 48 ++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs') diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index 55a3983bb..e20d5d0a2 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -342,9 +342,55 @@ namespace MediaBrowser.MediaEncoding.Encoder inputModifier += " -re"; } + var videoDecoder = GetVideoDecoder(job); + if (!string.IsNullOrWhiteSpace(videoDecoder)) + { + inputModifier += " " + videoDecoder; + } + return inputModifier; } + /// + /// Gets the name of the output video codec + /// + /// The state. + /// System.String. + protected string GetVideoDecoder(EncodingJob state) + { + if (string.Equals(GetEncodingOptions().HardwareVideoDecoder, "qsv", StringComparison.OrdinalIgnoreCase)) + { + if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec)) + { + switch (state.MediaSource.VideoStream.Codec.ToLower()) + { + case "avc": + case "h264": + if (MediaEncoder.SupportsDecoder("h264_qsv")) + { + return "-c:v h264_qsv "; + } + break; + case "mpeg2video": + if (MediaEncoder.SupportsDecoder("mpeg2_qsv")) + { + return "-c:v mpeg2_qsv "; + } + break; + case "vc1": + if (MediaEncoder.SupportsDecoder("vc1_qsv")) + { + return "-c:v vc1_qsv "; + } + break; + } + } + } + + // leave blank so ffmpeg will decide + return null; + } + private string GetUserAgentParam(EncodingJob job) { string useragent = null; @@ -436,7 +482,7 @@ namespace MediaBrowser.MediaEncoding.Encoder state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationToken).ConfigureAwait(false); } - if (state.MediaSource.RequiresOpening) + if (state.MediaSource.RequiresOpening && string.IsNullOrWhiteSpace(state.LiveStreamId)) { var liveStreamResponse = await MediaSourceManager.OpenLiveStream(new LiveStreamRequest { -- cgit v1.2.3