From a181425e54d2ae63e2f8af309345b701014857ce Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Mar 2017 15:29:42 -0500 Subject: [PATCH 1/4] 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(-) 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. /// From cd45b0b69c5daac62dec333c7d74199ffd0bba59 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Mar 2017 15:29:56 -0500 Subject: [PATCH 2/4] update channel sorting --- MediaBrowser.Controller/LiveTv/LiveTvChannel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index d164b5e0d..a0ddac691 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.LiveTv if (double.TryParse(Number, NumberStyles.Any, CultureInfo.InvariantCulture, out number)) { - return number.ToString("00000-") + (Name ?? string.Empty); + return (number * 10).ToString("00000-") + (Name ?? string.Empty); } } From 17e42e68f60886ded225b4b348c790fd8f10f8de Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Mar 2017 15:30:05 -0500 Subject: [PATCH 3/4] update series definitions --- .../LiveTv/Listings/SchedulesDirect.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index f76735030..a36cb124d 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -282,6 +282,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings var showId = programInfo.programID ?? string.Empty; + if (!info.IsSeries) + { + // It's also a series if it starts with SH + info.IsSeries = showId.StartsWith("SH", StringComparison.OrdinalIgnoreCase) && showId.Length >= 14; + } + // According to SchedulesDirect, these are generic, unidentified episodes // SH005316560000 var hasUniqueShowId = !showId.StartsWith("SH", StringComparison.OrdinalIgnoreCase) || @@ -331,7 +337,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings { var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote; info.SeasonNumber = gracenote.season; - info.EpisodeNumber = gracenote.episode; + + if (gracenote.episode > 0) + { + info.EpisodeNumber = gracenote.episode; + } } } From 26c88e6ad6fe5f4ecddfdd15687003c59abeaea3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Mar 2017 15:30:23 -0500 Subject: [PATCH 4/4] 3.2.5.2 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 4e9e9b6ea..c9f393308 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.5.1")] +[assembly: AssemblyVersion("3.2.5.2")]