Merge pull request #7955 from nyanmisaka/fix-ext
(cherry picked from commit 52704e8dd0
)
Signed-off-by: Joshua Boniface <joshua@boniface.me>
This commit is contained in:
parent
a99e87a00c
commit
c0e4a33a0b
|
@ -179,7 +179,7 @@ namespace Jellyfin.Api.Helpers
|
|||
{
|
||||
containerInternal = streamingRequest.Static ?
|
||||
StreamBuilder.NormalizeMediaSourceFormatIntoSingleContainer(state.InputContainer, null, DlnaProfileType.Audio)
|
||||
: GetOutputFileExtension(state);
|
||||
: GetOutputFileExtension(state, mediaSource);
|
||||
}
|
||||
|
||||
state.OutputContainer = (containerInternal ?? string.Empty).TrimStart('.');
|
||||
|
@ -235,7 +235,7 @@ namespace Jellyfin.Api.Helpers
|
|||
ApplyDeviceProfileSettings(state, dlnaManager, deviceManager, httpRequest, streamingRequest.DeviceProfileId, streamingRequest.Static);
|
||||
|
||||
var ext = string.IsNullOrWhiteSpace(state.OutputContainer)
|
||||
? GetOutputFileExtension(state)
|
||||
? GetOutputFileExtension(state, mediaSource)
|
||||
: ("." + state.OutputContainer);
|
||||
|
||||
state.OutputFilePath = GetOutputFilePath(state, ext!, serverConfigurationManager, streamingRequest.DeviceId, streamingRequest.PlaySessionId);
|
||||
|
@ -409,8 +409,9 @@ namespace Jellyfin.Api.Helpers
|
|||
/// Gets the output file extension.
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <param name="mediaSource">The mediaSource.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string? GetOutputFileExtension(StreamState state)
|
||||
private static string? GetOutputFileExtension(StreamState state, MediaSourceInfo? mediaSource)
|
||||
{
|
||||
var ext = Path.GetExtension(state.RequestedUrl);
|
||||
|
||||
|
@ -425,7 +426,7 @@ namespace Jellyfin.Api.Helpers
|
|||
var videoCodec = state.Request.VideoCodec;
|
||||
|
||||
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(videoCodec, "h265", StringComparison.OrdinalIgnoreCase))
|
||||
string.Equals(videoCodec, "hevc", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ".ts";
|
||||
}
|
||||
|
@ -474,6 +475,13 @@ namespace Jellyfin.Api.Helpers
|
|||
}
|
||||
}
|
||||
|
||||
// Fallback to the container of mediaSource
|
||||
if (!string.IsNullOrEmpty(mediaSource?.Container))
|
||||
{
|
||||
var idx = mediaSource.Container.IndexOf(',', StringComparison.OrdinalIgnoreCase);
|
||||
return '.' + (idx == -1 ? mediaSource.Container : mediaSource.Container[..idx]).Trim();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user