diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 3fd171416..52e3a7a38 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.MediaEncoding; @@ -1089,15 +1090,13 @@ namespace MediaBrowser.Api.Playback { state.Dispose(); - var outputFilePath = GetOutputFilePath(state); - try { - Logger.Info("FFMpeg exited with code {0} for {1}", process.ExitCode, outputFilePath); + Logger.Info("FFMpeg exited with code {0}", process.ExitCode); } catch { - Logger.Info("FFMpeg exited with an error for {0}", outputFilePath); + Logger.Info("FFMpeg exited with an error."); } } @@ -1388,6 +1387,7 @@ namespace MediaBrowser.Api.Playback state.DeInterlace = true; state.InputVideoSync = "-1"; state.InputAudioSync = "1"; + state.InputContainer = recording.Container; } else if (item is LiveTvChannel) { @@ -1439,6 +1439,14 @@ namespace MediaBrowser.Api.Playback state.DeInterlace = string.Equals(video.Container, "wtv", StringComparison.OrdinalIgnoreCase); state.InputTimestamp = video.Timestamp ?? TransportStreamTimestamp.None; + + state.InputContainer = video.Container; + } + + var audio = item as Audio; + if (audio != null) + { + state.InputContainer = audio.Container; } state.RunTimeTicks = item.RunTimeTicks; @@ -1484,14 +1492,13 @@ namespace MediaBrowser.Api.Playback if (string.IsNullOrEmpty(container)) { - container = Path.GetExtension(GetOutputFilePath(state)); + container = request.Static ? state.InputContainer : Path.GetExtension(GetOutputFilePath(state)); } state.OutputContainer = (container ?? string.Empty).TrimStart('.'); ApplyDeviceProfileSettings(state); - state.OutputContainer = GetOutputFileExtension(state).TrimStart('.'); state.OutputAudioBitrate = GetAudioBitrateParam(state.Request, state.AudioStream); state.OutputAudioSampleRate = request.AudioSampleRate; state.OutputAudioChannels = GetNumAudioChannelsParam(state.Request, state.AudioStream); @@ -1519,8 +1526,8 @@ namespace MediaBrowser.Api.Playback state.DeviceProfile = string.IsNullOrWhiteSpace(state.Request.DeviceProfileId) ? DlnaManager.GetProfile(headers) : - DlnaManager.GetProfile(state.Request.DeviceProfileId); - + DlnaManager.GetProfile(state.Request.DeviceProfileId); + return state; } @@ -1670,8 +1677,8 @@ namespace MediaBrowser.Api.Playback var mediaProfile = state.VideoRequest == null ? profile.GetAudioMediaProfile(state.OutputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate) : - profile.GetVideoMediaProfile(state.OutputContainer, - audioCodec, + profile.GetVideoMediaProfile(state.OutputContainer, + audioCodec, videoCodec, state.OutputAudioBitrate, state.OutputAudioChannels, diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 38d734ff9..cc733dfaf 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -34,6 +34,8 @@ namespace MediaBrowser.Api.Playback /// The log file stream. public Stream LogFileStream { get; set; } + public string InputContainer { get; set; } + public MediaStream AudioStream { get; set; } public MediaStream VideoStream { get; set; } public MediaStream SubtitleStream { get; set; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index d4547c713..9570faa73 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -2,8 +2,8 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; -using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.MediaInfo; using System; using System.Collections; using System.Collections.Generic; @@ -12,7 +12,6 @@ using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs b/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs index f8cdc6eee..700fe1f41 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs @@ -12,6 +12,8 @@ namespace MediaBrowser.Controller.LiveTv string MediaType { get; } + string Container { get; } + RecordingInfo RecordingInfo { get; set; } long? RunTimeTicks { get; set; }