diff options
Diffstat (limited to 'MediaBrowser.Api/Playback')
4 files changed, 23 insertions, 5 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 4fde66d1a..d157f1b65 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -779,7 +779,7 @@ namespace MediaBrowser.Api.Playback if (string.IsNullOrEmpty(container)) { container = request.Static ? - state.InputContainer : + StreamBuilder.NormalizeMediaSourceFormatIntoSingleContainer(state.InputContainer, null, DlnaProfileType.Audio) : GetOutputFileExtension(state); } diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index 536236f5f..9d2359102 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -117,7 +117,7 @@ namespace MediaBrowser.Api.Playback var authInfo = _authContext.GetAuthorizationInfo(Request); var result = await _mediaSourceManager.OpenLiveStream(request, CancellationToken.None).ConfigureAwait(false); - + var profile = request.DeviceProfile; if (profile == null) { @@ -144,6 +144,11 @@ namespace MediaBrowser.Api.Playback } } + if (result.MediaSource != null) + { + NormalizeMediaSourceContainer(result.MediaSource, profile, DlnaProfileType.Video); + } + return result; } @@ -207,9 +212,22 @@ namespace MediaBrowser.Api.Playback } } + if (info.MediaSources != null) + { + foreach (var mediaSource in info.MediaSources) + { + NormalizeMediaSourceContainer(mediaSource, profile, DlnaProfileType.Video); + } + } + return info; } + private void NormalizeMediaSourceContainer(MediaSourceInfo mediaSource, DeviceProfile profile, DlnaProfileType type) + { + mediaSource.Container = StreamBuilder.NormalizeMediaSourceFormatIntoSingleContainer(mediaSource.Container, profile, type); + } + public async Task<object> Post(GetPostedPlaybackInfo request) { var result = await GetPlaybackInfo(request).ConfigureAwait(false); diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index db5c78a2f..95b8c3329 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -167,7 +167,7 @@ namespace MediaBrowser.Api.Playback.Progressive // Static stream if (request.Static) { - var contentType = state.GetMimeType(state.MediaPath); + var contentType = state.GetMimeType("." + state.OutputContainer, false) ?? state.GetMimeType(state.MediaPath); using (state) { diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index eecc12432..6c098deea 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -131,14 +131,14 @@ namespace MediaBrowser.Api.Playback public long? EncodingDurationTicks { get; set; } - public string GetMimeType(string outputPath) + public string GetMimeType(string outputPath, bool enableStreamDefault = true) { if (!string.IsNullOrEmpty(MimeType)) { return MimeType; } - return MimeTypes.GetMimeType(outputPath); + return MimeTypes.GetMimeType(outputPath, enableStreamDefault); } public bool EnableDlnaHeaders { get; set; } |
