From 5fa3817a7667b5de8822ed436b8a66bd05a1afde Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 26 Feb 2017 16:47:52 -0500 Subject: update components --- .../MediaEncoding/EncodingHelper.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 4e1a0a8d7..ad61f3e73 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -154,6 +154,23 @@ namespace MediaBrowser.Controller.MediaEncoding { return "mpegts"; } + if (string.Equals(container, "mpg", StringComparison.OrdinalIgnoreCase)) + { + return "mpeg"; + } + // For these need to find out the ffmpeg names + if (string.Equals(container, "m2ts", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + if (string.Equals(container, "wmv", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + if (string.Equals(container, "vob", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return container; } @@ -1477,7 +1494,7 @@ namespace MediaBrowser.Controller.MediaEncoding //inputModifier += " -noaccurate_seek"; } - if (!string.IsNullOrWhiteSpace(state.InputContainer)) + if (!string.IsNullOrWhiteSpace(state.InputContainer) && state.VideoType == VideoType.VideoFile) { var inputFormat = GetInputFormat(state.InputContainer); if (!string.IsNullOrWhiteSpace(inputFormat)) @@ -1486,7 +1503,8 @@ namespace MediaBrowser.Controller.MediaEncoding } } - if (state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) + // Only do this for video files due to sometimes unpredictable codec names coming from BDInfo + if (state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType) && state.VideoType == VideoType.VideoFile) { foreach (var stream in state.MediaSource.MediaStreams) { -- cgit v1.2.3 From a181425e54d2ae63e2f8af309345b701014857ce Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Mar 2017 15:29:42 -0500 Subject: omit input container when hw encoding --- .../LiveTv/EmbyTV/EncodedRecorder.cs | 7 +-- .../MediaEncoding/EncodingHelper.cs | 21 +++++-- .../Subtitles/SubtitleEncoder.cs | 17 ++++-- MediaBrowser.Model/Dto/BaseItemDto.cs | 66 ---------------------- 4 files changed, 29 insertions(+), 82 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 7460a9f06..0567bdfd9 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -163,8 +163,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks); var inputModifiers = "-fflags +genpts -async 1 -vsync -1"; - var mapArgs = "-map 0 -ignore_unknown"; - var commandLineArgs = "-i \"{0}\"{5} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3}{4} -y \"{1}\""; + var commandLineArgs = "-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4} -y \"{1}\""; long startTimeTicks = 0; //if (mediaSource.DateLiveStreamOpened.HasValue) @@ -207,7 +206,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV // do not copy aac because many players have difficulty with aac_latm if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings && !string.Equals(inputAudioCodec, "aac", StringComparison.OrdinalIgnoreCase)) { - return "-codec:a copy"; + return "-codec:a:0 copy"; } var audioChannels = 2; @@ -216,7 +215,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { audioChannels = audioStream.Channels ?? audioChannels; } - return "-codec:a aac -strict experimental -ab 320000"; + return "-codec:a:0 aac -strict experimental -ab 320000"; } private bool EncodeVideo(MediaSourceInfo mediaSource) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index ad61f3e73..18508a399 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -154,10 +154,6 @@ namespace MediaBrowser.Controller.MediaEncoding { return "mpegts"; } - if (string.Equals(container, "mpg", StringComparison.OrdinalIgnoreCase)) - { - return "mpeg"; - } // For these need to find out the ffmpeg names if (string.Equals(container, "m2ts", StringComparison.OrdinalIgnoreCase)) { @@ -171,12 +167,21 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + if (string.Equals(container, "mpg", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + if (string.Equals(container, "mpeg", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return container; } public string GetDecoderFromCodec(string codec) { + // For these need to find out the ffmpeg names if (string.Equals(codec, "mp2", StringComparison.OrdinalIgnoreCase)) { return null; @@ -185,6 +190,10 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + if (string.Equals(codec, "eac3", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return codec; } @@ -1494,7 +1503,7 @@ namespace MediaBrowser.Controller.MediaEncoding //inputModifier += " -noaccurate_seek"; } - if (!string.IsNullOrWhiteSpace(state.InputContainer) && state.VideoType == VideoType.VideoFile) + if (!string.IsNullOrWhiteSpace(state.InputContainer) && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) { var inputFormat = GetInputFormat(state.InputContainer); if (!string.IsNullOrWhiteSpace(inputFormat)) @@ -1504,7 +1513,7 @@ namespace MediaBrowser.Controller.MediaEncoding } // Only do this for video files due to sometimes unpredictable codec names coming from BDInfo - if (state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType) && state.VideoType == VideoType.VideoFile) + if (state.RunTimeTicks.HasValue && state.VideoType == VideoType.VideoFile && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) { foreach (var stream in state.MediaSource.MediaStreams) { diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index ca22dac2d..4a1bf5305 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -734,6 +734,16 @@ namespace MediaBrowser.MediaEncoding.Subtitles } } + var charsetFromLanguage = string.IsNullOrWhiteSpace(language) + ? null + : GetSubtitleFileCharacterSetFromLanguage(language); + + // This assumption should only be made for external subtitles + if (!string.IsNullOrWhiteSpace(charsetFromLanguage) && !string.Equals(charsetFromLanguage, "windows-1252", StringComparison.OrdinalIgnoreCase)) + { + return charsetFromLanguage; + } + var charset = await DetectCharset(path, language, protocol, cancellationToken).ConfigureAwait(false); if (!string.IsNullOrWhiteSpace(charset)) @@ -746,12 +756,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles return charset; } - if (!string.IsNullOrWhiteSpace(language)) - { - return GetSubtitleFileCharacterSetFromLanguage(language); - } - - return null; + return charsetFromLanguage; } public string GetSubtitleFileCharacterSetFromLanguage(string language) diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index c78c92967..5122227e1 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -827,72 +827,6 @@ namespace MediaBrowser.Model.Dto get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); } } - /// - /// Gets a value indicating whether this instance is audio. - /// - /// true if this instance is audio; otherwise, false. - [IgnoreDataMember] - public bool IsAudio - { - get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Audio); } - } - - /// - /// Gets a value indicating whether this instance is game. - /// - /// true if this instance is game; otherwise, false. - [IgnoreDataMember] - public bool IsGame - { - get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Game); } - } - - /// - /// Gets a value indicating whether this instance is person. - /// - /// true if this instance is person; otherwise, false. - [IgnoreDataMember] - public bool IsPerson - { - get { return StringHelper.EqualsIgnoreCase(Type, "Person"); } - } - - [IgnoreDataMember] - public bool IsMusicGenre - { - get { return StringHelper.EqualsIgnoreCase(Type, "MusicGenre"); } - } - - [IgnoreDataMember] - public bool IsGameGenre - { - get { return StringHelper.EqualsIgnoreCase(Type, "GameGenre"); } - } - - [IgnoreDataMember] - public bool IsGenre - { - get { return StringHelper.EqualsIgnoreCase(Type, "Genre"); } - } - - [IgnoreDataMember] - public bool IsArtist - { - get { return StringHelper.EqualsIgnoreCase(Type, "MusicArtist"); } - } - - [IgnoreDataMember] - public bool IsAlbum - { - get { return StringHelper.EqualsIgnoreCase(Type, "MusicAlbum"); } - } - - [IgnoreDataMember] - public bool IsStudio - { - get { return StringHelper.EqualsIgnoreCase(Type, "Studio"); } - } - /// /// Gets or sets the program identifier. /// -- cgit v1.2.3 From c811d57bca4e837707acd8483029fb643d56ad1b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 3 Mar 2017 15:16:43 -0500 Subject: remove hardcoded address families --- .../LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs | 2 +- .../LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs | 4 ++-- MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 4 ++++ MediaBrowser.Model/Session/PlaybackProgressInfo.cs | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 7397380e1..af3f1359f 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun using (var manager = new HdHomerunManager(_socketFactory)) { // Legacy HdHomeruns are IPv4 only - var ipInfo = new IpAddressInfo(uri.Host, IpAddressFamily.InterNetwork); + var ipInfo = _networkManager.ParseIpAddress(uri.Host); for (int i = 0; i < model.TunerCount; ++i) { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs index 95ceb0660..8c749b1b5 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs @@ -96,9 +96,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun { using (var hdHomerunManager = new HdHomerunManager(_socketFactory)) { - var remoteAddress = new IpAddressInfo(remoteIp, IpAddressFamily.InterNetwork); + var remoteAddress = _networkManager.ParseIpAddress(remoteIp); IpAddressInfo localAddress = null; - using (var tcpSocket = _socketFactory.CreateSocket(IpAddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, false)) + using (var tcpSocket = _socketFactory.CreateSocket(remoteAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp, false)) { try { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 18508a399..ef356c7cd 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -175,6 +175,10 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + if (string.Equals(container, "rec", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return container; } diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs index 345931a62..fff4ee8e0 100644 --- a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs @@ -73,6 +73,10 @@ namespace MediaBrowser.Model.Session /// The volume level. public int? VolumeLevel { get; set; } + public int? Brightness { get; set; } + + public string AspectRatio { get; set; } + /// /// Gets or sets the play method. /// -- cgit v1.2.3 From ce3f2bdd20024e8dd6cec34bb42e38af0565c225 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 5 Mar 2017 10:38:36 -0500 Subject: reduce AnalyzeDurationMs for live tv --- Emby.Drawing.ImageMagick/ImageMagickEncoder.cs | 4 +- Emby.Server.Implementations/Dto/DtoService.cs | 2 +- .../Library/LibraryManager.cs | 3 +- .../LiveTv/LiveStreamHelper.cs | 7 ++- .../LiveTv/TunerHosts/MulticastStream.cs | 2 +- .../MediaEncoding/EncodingHelper.cs | 50 ++++++++++++------- .../MediaEncoding/IMediaEncoder.cs | 8 --- .../MediaEncoding/MediaInfoRequest.cs | 2 +- .../Encoder/EncodingUtils.cs | 10 ---- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 57 +++++++++------------- MediaBrowser.Model/Dto/MediaSourceInfo.cs | 2 + 11 files changed, 69 insertions(+), 78 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs index 39088c94b..77482d56b 100644 --- a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs +++ b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs @@ -44,7 +44,9 @@ namespace Emby.Drawing.ImageMagick "cr2", "crw", "dng", - "nef", + + // Remove until supported + //"nef", "orf", "pef", "arw", diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 8b6b388db..e0df65b8e 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Dto } } - if (!(item is LiveTvProgram)) + if (!(item is LiveTvProgram) || fields.Contains(ItemFields.PlayAccess)) { dto.PlayAccess = item.GetPlayAccess(user); } diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 56bffc233..32fb4ca7a 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -425,8 +425,7 @@ namespace Emby.Server.Implementations.Library if (parent != null) { - await parent.ValidateChildren(new Progress(), CancellationToken.None) - .ConfigureAwait(false); + await parent.ValidateChildren(new Progress(), CancellationToken.None, new MetadataRefreshOptions(_fileSystem), false) .ConfigureAwait(false); } } else if (parent != null) diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs index e2f973699..9a8a930bd 100644 --- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs +++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; namespace Emby.Server.Implementations.LiveTv @@ -16,6 +15,8 @@ namespace Emby.Server.Implementations.LiveTv private readonly IMediaEncoder _mediaEncoder; private readonly ILogger _logger; + const int AnalyzeDurationMs = 2000; + public LiveStreamHelper(IMediaEncoder mediaEncoder, ILogger logger) { _mediaEncoder = mediaEncoder; @@ -34,7 +35,7 @@ namespace Emby.Server.Implementations.LiveTv Protocol = mediaSource.Protocol, MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video, ExtractChapters = false, - AnalyzeDurationSections = 2 + AnalyzeDurationMs = AnalyzeDurationMs }, cancellationToken).ConfigureAwait(false); @@ -98,6 +99,8 @@ namespace Emby.Server.Implementations.LiveTv // Try to estimate this mediaSource.InferTotalBitrate(true); + + mediaSource.AnalyzeDurationMs = AnalyzeDurationMs; } } } diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs index df83d4341..2cfa1b9a5 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs @@ -40,7 +40,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts _sharedBuffer.Enqueue(copy); - while (_sharedBuffer.Count > 3000) + while (_sharedBuffer.Count > 10000) { byte[] bytes; _sharedBuffer.TryDequeue(out bytes); diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index ef356c7cd..d66d0dbcb 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -463,21 +463,6 @@ namespace MediaBrowser.Controller.MediaEncoding return level; } - /// - /// Gets the probe size argument. - /// - /// The state. - /// System.String. - public string GetProbeSizeArgument(EncodingJobInfo state) - { - if (state.PlayableStreamFileNames.Count > 0) - { - return _mediaEncoder.GetProbeSizeAndAnalyzeDurationArgument(state.PlayableStreamFileNames.ToArray(), state.InputProtocol); - } - - return _mediaEncoder.GetProbeSizeAndAnalyzeDurationArgument(new[] { state.MediaPath }, state.InputProtocol); - } - /// /// Gets the text subtitle param. /// @@ -1452,12 +1437,43 @@ namespace MediaBrowser.Controller.MediaEncoding } } + public static string GetProbeSizeArgument(int numInputFiles) + { + return numInputFiles > 1 ? "-probesize 1G" : ""; + } + + public static string GetAnalyzeDurationArgument(int numInputFiles) + { + return numInputFiles > 1 ? "-analyzeduration 200M" : ""; + } + public string GetInputModifier(EncodingJobInfo state, EncodingOptions encodingOptions) { var inputModifier = string.Empty; - var probeSize = GetProbeSizeArgument(state); - inputModifier += " " + probeSize; + var numInputFiles = state.PlayableStreamFileNames.Count > 0 ? state.PlayableStreamFileNames.Count : 1; + var probeSizeArgument = GetProbeSizeArgument(numInputFiles); + + string analyzeDurationArgument; + if (state.MediaSource.AnalyzeDurationMs.HasValue) + { + analyzeDurationArgument = "-analyzeduration " + (state.MediaSource.AnalyzeDurationMs.Value * 1000).ToString(CultureInfo.InvariantCulture); + } + else + { + analyzeDurationArgument = GetAnalyzeDurationArgument(numInputFiles); + } + + if (!string.IsNullOrWhiteSpace(probeSizeArgument)) + { + inputModifier += " " + probeSizeArgument; + } + + if (!string.IsNullOrWhiteSpace(analyzeDurationArgument)) + { + inputModifier += " " + analyzeDurationArgument; + } + inputModifier = inputModifier.Trim(); var userAgentParam = GetUserAgentParam(state); diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 45aaa8e8e..78ed1dc59 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -78,14 +78,6 @@ namespace MediaBrowser.Controller.MediaEncoding /// Task. Task GetMediaInfo(MediaInfoRequest request, CancellationToken cancellationToken); - /// - /// Gets the probe size argument. - /// - /// The input files. - /// The protocol. - /// System.String. - string GetProbeSizeAndAnalyzeDurationArgument(string[] inputFiles, MediaProtocol protocol); - /// /// Gets the input argument. /// diff --git a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs index 9ff7567d4..0785ee29f 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs @@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.MediaEncoding public IIsoMount MountedIso { get; set; } public VideoType VideoType { get; set; } public List PlayableStreamFileNames { get; set; } - public int AnalyzeDurationSections { get; set; } + public int AnalyzeDurationMs { get; set; } public MediaInfoRequest() { diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs index e547f2fae..498df214f 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs @@ -61,15 +61,5 @@ namespace MediaBrowser.MediaEncoding.Encoder // Quotes are valid path characters in linux and they need to be escaped here with a leading \ return path.Replace("\"", "\\\""); } - - public static string GetProbeSizeArgument(int numInputFiles) - { - return numInputFiles > 1 ? "-probesize 1G" : ""; - } - - public static string GetAnalyzeDurationArgument(int numInputFiles) - { - return numInputFiles > 1 ? "-analyzeduration 200M" : ""; - } } } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index e7737b6a6..580f5c615 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -523,17 +523,17 @@ namespace MediaBrowser.MediaEncoding.Encoder var inputFiles = MediaEncoderHelpers.GetInputArgument(FileSystem, request.InputPath, request.Protocol, request.MountedIso, request.PlayableStreamFileNames); - var probeSize = EncodingUtils.GetProbeSizeArgument(inputFiles.Length); + var probeSize = EncodingHelper.GetProbeSizeArgument(inputFiles.Length); string analyzeDuration; - if (request.AnalyzeDurationSections > 0) + if (request.AnalyzeDurationMs > 0) { analyzeDuration = "-analyzeduration " + - (request.AnalyzeDurationSections * 1000000).ToString(CultureInfo.InvariantCulture); + (request.AnalyzeDurationMs * 1000).ToString(CultureInfo.InvariantCulture); } else { - analyzeDuration = EncodingUtils.GetAnalyzeDurationArgument(inputFiles.Length); + analyzeDuration = EncodingHelper.GetAnalyzeDurationArgument(inputFiles.Length); } probeSize = probeSize + " " + analyzeDuration; @@ -557,31 +557,6 @@ namespace MediaBrowser.MediaEncoding.Encoder return EncodingUtils.GetInputArgument(inputFiles.ToList(), protocol); } - /// - /// Gets the probe size argument. - /// - /// The input files. - /// The protocol. - /// System.String. - public string GetProbeSizeAndAnalyzeDurationArgument(string[] inputFiles, MediaProtocol protocol) - { - var results = new List(); - - var probeSize = EncodingUtils.GetProbeSizeArgument(inputFiles.Length); - var analyzeDuration = EncodingUtils.GetAnalyzeDurationArgument(inputFiles.Length); - - if (!string.IsNullOrWhiteSpace(probeSize)) - { - results.Add(probeSize); - } - - if (!string.IsNullOrWhiteSpace(analyzeDuration)) - { - results.Add(analyzeDuration); - } - return string.Join(" ", results.ToArray()); - } - /// /// Gets the media info internal. /// @@ -984,11 +959,17 @@ namespace MediaBrowser.MediaEncoding.Encoder var args = useIFrame ? string.Format("-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}{4}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg, thumbnail) : string.Format("-i {0}{3} -threads 0 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, tempExtractPath, vf, mapArg); - var probeSize = GetProbeSizeAndAnalyzeDurationArgument(new[] { inputPath }, protocol); + var probeSizeArgument = EncodingHelper.GetProbeSizeArgument(1); + var analyzeDurationArgument = EncodingHelper.GetAnalyzeDurationArgument(1); + + if (!string.IsNullOrWhiteSpace(probeSizeArgument)) + { + args = probeSizeArgument + " " + args; + } - if (!string.IsNullOrEmpty(probeSize)) + if (!string.IsNullOrWhiteSpace(analyzeDurationArgument)) { - args = probeSize + " " + args; + args = analyzeDurationArgument + " " + args; } if (offset.HasValue) @@ -1092,11 +1073,17 @@ namespace MediaBrowser.MediaEncoding.Encoder var args = string.Format("-i {0} -threads 0 -v quiet -vf \"{2}\" -f image2 \"{1}\"", inputArgument, outputPath, vf); - var probeSize = GetProbeSizeAndAnalyzeDurationArgument(new[] { inputArgument }, protocol); + var probeSizeArgument = EncodingHelper.GetProbeSizeArgument(1); + var analyzeDurationArgument = EncodingHelper.GetAnalyzeDurationArgument(1); + + if (!string.IsNullOrWhiteSpace(probeSizeArgument)) + { + args = probeSizeArgument + " " + args; + } - if (!string.IsNullOrEmpty(probeSize)) + if (!string.IsNullOrWhiteSpace(analyzeDurationArgument)) { - args = probeSize + " " + args; + args = analyzeDurationArgument + " " + args; } var process = _processFactory.Create(new ProcessOptions diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index d20911a7f..d416cfd96 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -60,6 +60,8 @@ namespace MediaBrowser.Model.Dto public string TranscodingSubProtocol { get; set; } public string TranscodingContainer { get; set; } + public int? AnalyzeDurationMs { get; set; } + public MediaSourceInfo() { Formats = new List(); -- cgit v1.2.3 From 9fa6868af3decfa85fe51243b863e5d790fa1246 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Mar 2017 13:27:56 -0500 Subject: update legacy hd homerun support --- Emby.Dlna/Profiles/DefaultProfile.cs | 6 ++++ Emby.Dlna/Profiles/DirectTvProfile.cs | 9 ++++++ Emby.Dlna/Profiles/DishHopperJoeyProfile.cs | 8 +++++ Emby.Dlna/Profiles/LinksysDMA2100Profile.cs | 9 ++++++ Emby.Dlna/Profiles/PopcornHourProfile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyBravia2010Profile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyBravia2011Profile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyBravia2012Profile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyBravia2013Profile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyBravia2014Profile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyPs3Profile.cs | 9 ++++++ Emby.Dlna/Profiles/SonyPs4Profile.cs | 9 ++++++ Emby.Dlna/Profiles/Xbox360Profile.cs | 9 ++++++ Emby.Dlna/Profiles/XboxOneProfile.cs | 9 ++++++ Emby.Dlna/Profiles/Xml/Default.xml | 1 + Emby.Dlna/Profiles/Xml/Denon AVR.xml | 1 + Emby.Dlna/Profiles/Xml/MediaMonkey.xml | 1 + Emby.Dlna/Profiles/Xml/foobar2000.xml | 1 + .../Devices/DeviceManager.cs | 7 ++--- .../Library/LibraryManager.cs | 35 ++++++++++++++++++---- Emby.Server.Implementations/Library/UserManager.cs | 5 ++++ .../LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs | 1 + .../TunerHosts/HdHomerun/HdHomerunManager.cs | 25 +++++++++++++++- .../MediaEncoding/EncodingHelper.cs | 5 ++++ MediaBrowser.Model/Dto/UserDto.cs | 4 ++- SharedVersion.cs | 2 +- 27 files changed, 206 insertions(+), 13 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs index c670f268e..f05a4869a 100644 --- a/Emby.Dlna/Profiles/DefaultProfile.cs +++ b/Emby.Dlna/Profiles/DefaultProfile.cs @@ -83,6 +83,12 @@ namespace Emby.Dlna.Profiles { Format = "srt", Method = SubtitleDeliveryMethod.Embed + }, + + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.External, } }; diff --git a/Emby.Dlna/Profiles/DirectTvProfile.cs b/Emby.Dlna/Profiles/DirectTvProfile.cs index 153d55204..bb9ce903c 100644 --- a/Emby.Dlna/Profiles/DirectTvProfile.cs +++ b/Emby.Dlna/Profiles/DirectTvProfile.cs @@ -113,6 +113,15 @@ namespace Emby.Dlna.Profiles } }; + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; + ResponseProfiles = new ResponseProfile[] { }; } } diff --git a/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs b/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs index 89e0697c1..331312bec 100644 --- a/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs +++ b/Emby.Dlna/Profiles/DishHopperJoeyProfile.cs @@ -214,6 +214,14 @@ namespace Emby.Dlna.Profiles } }; + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs b/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs index 2b31ab55f..d2f5fef76 100644 --- a/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs +++ b/Emby.Dlna/Profiles/LinksysDMA2100Profile.cs @@ -40,6 +40,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/PopcornHourProfile.cs b/Emby.Dlna/Profiles/PopcornHourProfile.cs index d13b5c6ad..ac8fba84c 100644 --- a/Emby.Dlna/Profiles/PopcornHourProfile.cs +++ b/Emby.Dlna/Profiles/PopcornHourProfile.cs @@ -210,6 +210,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs b/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs index c67bd85b2..d9eab28e1 100644 --- a/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs +++ b/Emby.Dlna/Profiles/SonyBlurayPlayerProfile.cs @@ -269,6 +269,15 @@ namespace Emby.Dlna.Profiles Type = DlnaProfileType.Audio } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2010Profile.cs b/Emby.Dlna/Profiles/SonyBravia2010Profile.cs index 518550371..60a99561f 100644 --- a/Emby.Dlna/Profiles/SonyBravia2010Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2010Profile.cs @@ -351,6 +351,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2011Profile.cs b/Emby.Dlna/Profiles/SonyBravia2011Profile.cs index 427820a33..346845d9d 100644 --- a/Emby.Dlna/Profiles/SonyBravia2011Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2011Profile.cs @@ -374,6 +374,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2012Profile.cs b/Emby.Dlna/Profiles/SonyBravia2012Profile.cs index 206ca554c..23a39a922 100644 --- a/Emby.Dlna/Profiles/SonyBravia2012Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2012Profile.cs @@ -292,6 +292,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2013Profile.cs b/Emby.Dlna/Profiles/SonyBravia2013Profile.cs index c618c9990..2d36d3414 100644 --- a/Emby.Dlna/Profiles/SonyBravia2013Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2013Profile.cs @@ -310,6 +310,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyBravia2014Profile.cs b/Emby.Dlna/Profiles/SonyBravia2014Profile.cs index c30bcfc85..2c871a5d6 100644 --- a/Emby.Dlna/Profiles/SonyBravia2014Profile.cs +++ b/Emby.Dlna/Profiles/SonyBravia2014Profile.cs @@ -310,6 +310,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyPs3Profile.cs b/Emby.Dlna/Profiles/SonyPs3Profile.cs index 001ef2bd8..2a0490f9a 100644 --- a/Emby.Dlna/Profiles/SonyPs3Profile.cs +++ b/Emby.Dlna/Profiles/SonyPs3Profile.cs @@ -255,6 +255,15 @@ namespace Emby.Dlna.Profiles Type = DlnaProfileType.Audio } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/SonyPs4Profile.cs b/Emby.Dlna/Profiles/SonyPs4Profile.cs index 832733184..c7f70f989 100644 --- a/Emby.Dlna/Profiles/SonyPs4Profile.cs +++ b/Emby.Dlna/Profiles/SonyPs4Profile.cs @@ -264,6 +264,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/Xbox360Profile.cs b/Emby.Dlna/Profiles/Xbox360Profile.cs index 9f0130856..7bdcd2a6f 100644 --- a/Emby.Dlna/Profiles/Xbox360Profile.cs +++ b/Emby.Dlna/Profiles/Xbox360Profile.cs @@ -312,6 +312,15 @@ namespace Emby.Dlna.Profiles } } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/XboxOneProfile.cs b/Emby.Dlna/Profiles/XboxOneProfile.cs index 8994082ad..e17640f2f 100644 --- a/Emby.Dlna/Profiles/XboxOneProfile.cs +++ b/Emby.Dlna/Profiles/XboxOneProfile.cs @@ -357,6 +357,15 @@ namespace Emby.Dlna.Profiles MimeType = "video/mp4" } }; + + SubtitleProfiles = new[] + { + new SubtitleProfile + { + Format = "srt", + Method = SubtitleDeliveryMethod.Embed + } + }; } } } diff --git a/Emby.Dlna/Profiles/Xml/Default.xml b/Emby.Dlna/Profiles/Xml/Default.xml index b5a5d24b6..b0b0d7ac1 100644 --- a/Emby.Dlna/Profiles/Xml/Default.xml +++ b/Emby.Dlna/Profiles/Xml/Default.xml @@ -46,5 +46,6 @@ + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/Denon AVR.xml b/Emby.Dlna/Profiles/Xml/Denon AVR.xml index 6ddad3146..00b56c03d 100644 --- a/Emby.Dlna/Profiles/Xml/Denon AVR.xml +++ b/Emby.Dlna/Profiles/Xml/Denon AVR.xml @@ -46,5 +46,6 @@ + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml index 48dfbf9bb..9b726ad4c 100644 --- a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml @@ -52,5 +52,6 @@ + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/foobar2000.xml b/Emby.Dlna/Profiles/Xml/foobar2000.xml index b793e2274..779e59310 100644 --- a/Emby.Dlna/Profiles/Xml/foobar2000.xml +++ b/Emby.Dlna/Profiles/Xml/foobar2000.xml @@ -52,5 +52,6 @@ + \ No newline at end of file diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index 88c0ea203..588b42a09 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -195,13 +195,12 @@ namespace Emby.Server.Implementations.Devices } var config = _config.GetUploadOptions(); - if (!string.IsNullOrWhiteSpace(config.CameraUploadPath)) + var path = config.CameraUploadPath; + if (string.IsNullOrWhiteSpace(path)) { - return config.CameraUploadPath; + path = DefaultCameraUploadsPath; } - var path = DefaultCameraUploadsPath; - if (config.EnableCameraUploadSubfolders) { path = Path.Combine(path, _fileSystem.GetValidFilename(device.Name)); diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 32fb4ca7a..f7706db47 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -409,18 +409,41 @@ namespace Emby.Server.Implementations.Library if (options.DeleteFileLocation && locationType != LocationType.Remote && locationType != LocationType.Virtual) { + // Assume only the first is required + // Add this flag to GetDeletePaths if required in the future + var isRequiredForDelete = true; + foreach (var fileSystemInfo in item.GetDeletePaths().ToList()) { - if (fileSystemInfo.IsDirectory) + try { - _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); - _fileSystem.DeleteDirectory(fileSystemInfo.FullName, true); + if (fileSystemInfo.IsDirectory) + { + _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); + _fileSystem.DeleteDirectory(fileSystemInfo.FullName, true); + } + else + { + _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); + _fileSystem.DeleteFile(fileSystemInfo.FullName); + } } - else + catch (IOException) { - _logger.Debug("Deleting path {0}", fileSystemInfo.FullName); - _fileSystem.DeleteFile(fileSystemInfo.FullName); + if (isRequiredForDelete) + { + throw; + } } + catch (UnauthorizedAccessException) + { + if (isRequiredForDelete) + { + throw; + } + } + + isRequiredForDelete = false; } if (parent != null) diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index eb0d0cf9b..3b11a4767 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -434,6 +434,11 @@ namespace Emby.Server.Implementations.Library Policy = user.Policy }; + if (!hasPassword && Users.Count() == 1) + { + dto.EnableAutoLogin = true; + } + var image = user.GetImageInfo(ImageType.Primary, 0); if (image != null) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 25d7de0fd..62385e172 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -596,6 +596,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun else { var mediaSource = GetMediaSource(info, hdhrId, channelInfo, profile); + //var modelInfo = await GetModelInfo(info, false, cancellationToken).ConfigureAwait(false); return new HdHomerunHttpStream(mediaSource, streamId, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost); //return new HdHomerunUdpStream(mediaSource, streamId, new HdHomerunChannelCommands(hdhomerunChannel.Number), modelInfo.TunerCount, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager); diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs index 0c3ba3041..2c678d9f8 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs @@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun { var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, _lockkey.Value); await tcpClient.SendAsync(channelMsg, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false); - await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false); + response = await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false); // parse response to make sure it worked if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal)) { @@ -172,6 +172,29 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun } } + public async Task ChangeChannel(IHdHomerunChannelCommands commands, CancellationToken cancellationToken) + { + if (!_lockkey.HasValue) + return; + + using (var tcpClient = _socketFactory.CreateTcpSocket(_remoteIp, HdHomeRunPort)) + { + var commandList = commands.GetCommands(); + foreach (Tuple command in commandList) + { + var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey.Value); + await tcpClient.SendAsync(channelMsg, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false); + var response = await tcpClient.ReceiveAsync(cancellationToken).ConfigureAwait(false); + // parse response to make sure it worked + string returnVal; + if (!ParseReturnMessage(response.Buffer, response.ReceivedBytes, out returnVal)) + { + return; + } + } + } + } + public async Task StopStreaming() { if (!_lockkey.HasValue) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index d66d0dbcb..21a3494c5 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -179,6 +179,11 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + // Seeing reported failures here, not sure yet if this is related to specfying input format + if (string.Equals(container, "m4v", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return container; } diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.cs index f9e3f7718..37a554166 100644 --- a/MediaBrowser.Model/Dto/UserDto.cs +++ b/MediaBrowser.Model/Dto/UserDto.cs @@ -89,7 +89,9 @@ namespace MediaBrowser.Model.Dto /// /// true if this instance has configured easy password; otherwise, false. public bool HasConfiguredEasyPassword { get; set; } - + + public bool? EnableAutoLogin { get; set; } + /// /// Gets or sets the last login date. /// diff --git a/SharedVersion.cs b/SharedVersion.cs index 864fc8633..80c22d9e3 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.5.7")] +[assembly: AssemblyVersion("3.2.6.1")] -- cgit v1.2.3 From 1f63a30ee788764524a839358a8318c9de9aeef4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Mar 2017 14:05:44 -0500 Subject: update mjpeg stream detection --- .../MediaEncoding/EncodingHelper.cs | 5 ---- .../Probing/ProbeResultNormalizer.cs | 29 +++++++++++++++++++--- MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 1 + MediaBrowser.Model/Net/MimeTypes.cs | 3 +++ 4 files changed, 30 insertions(+), 8 deletions(-) (limited to 'MediaBrowser.Controller/MediaEncoding') diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 21a3494c5..80b9cc154 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1190,11 +1190,6 @@ namespace MediaBrowser.Controller.MediaEncoding } } - if (type == MediaStreamType.Video) - { - streams = streams.Where(i => !string.Equals(i.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)).ToList(); - } - if (returnFirstIfNoIndex && type == MediaStreamType.Audio) { return streams.FirstOrDefault(i => i.Channels.HasValue && i.Channels.Value > 0) ?? diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 256c38597..7927ddb6a 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -558,13 +558,36 @@ namespace MediaBrowser.MediaEncoding.Probing ? MediaStreamType.EmbeddedImage : MediaStreamType.Video; + stream.AverageFrameRate = GetFrameRate(streamInfo.avg_frame_rate); + stream.RealFrameRate = GetFrameRate(streamInfo.r_frame_rate); + + if (isAudio || string.Equals(stream.Codec, "gif", StringComparison.OrdinalIgnoreCase) || + string.Equals(stream.Codec, "png", StringComparison.OrdinalIgnoreCase)) + { + stream.Type = MediaStreamType.EmbeddedImage; + } + else if (string.Equals(stream.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)) + { + // How to differentiate between video and embedded image? + // The only difference I've seen thus far is presence of codec tag, also embedded images have high (unusual) framerates + if (!string.IsNullOrWhiteSpace(stream.CodecTag)) + { + stream.Type = MediaStreamType.Video; + } + else + { + stream.Type = MediaStreamType.EmbeddedImage; + } + } + else + { + stream.Type = MediaStreamType.Video; + } + stream.Width = streamInfo.width; stream.Height = streamInfo.height; stream.AspectRatio = GetAspectRatio(streamInfo); - stream.AverageFrameRate = GetFrameRate(streamInfo.avg_frame_rate); - stream.RealFrameRate = GetFrameRate(streamInfo.r_frame_rate); - if (streamInfo.bits_per_sample > 0) { stream.BitDepth = streamInfo.bits_per_sample; diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index e2c6b0503..79a484a46 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -36,6 +36,7 @@ namespace MediaBrowser.Model.LiveTv MediaLocationsCreated = new string[] { }; RecordingEncodingFormat = "mp4"; RecordingPostProcessorArguments = "\"{path}\""; + EnableRecordingEncoding = true; } } diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index 902253e80..790f8a8f6 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -322,6 +322,9 @@ namespace MediaBrowser.Model.Net throw new ArgumentNullException("mimeType"); } + // handle text/html; charset=UTF-8 + mimeType = mimeType.Split(';')[0]; + string result; if (ExtensionLookup.TryGetValue(mimeType, out result)) { -- cgit v1.2.3