mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 08:23:28 -03:00
Merge pull request #15959 from nyanmisaka/truehd-dts-hls-codec-string
Add TrueHD and DTS codes string for HLS
This commit is contained in:
@@ -754,7 +754,9 @@ public class DynamicHlsHelper
|
||||
{
|
||||
if (string.Equals(state.ActualOutputAudioCodec, "aac", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string? profile = state.GetRequestedProfiles("aac").FirstOrDefault();
|
||||
string? profile = EncodingHelper.IsCopyCodec(state.OutputAudioCodec)
|
||||
? state.AudioStream?.Profile : state.GetRequestedProfiles("aac").FirstOrDefault();
|
||||
|
||||
return HlsCodecStringHelpers.GetAACString(profile);
|
||||
}
|
||||
|
||||
@@ -788,6 +790,19 @@ public class DynamicHlsHelper
|
||||
return HlsCodecStringHelpers.GetOPUSString();
|
||||
}
|
||||
|
||||
if (string.Equals(state.ActualOutputAudioCodec, "truehd", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return HlsCodecStringHelpers.GetTRUEHDString();
|
||||
}
|
||||
|
||||
if (string.Equals(state.ActualOutputAudioCodec, "dts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// lavc only support encoding DTS core profile
|
||||
string? profile = EncodingHelper.IsCopyCodec(state.OutputAudioCodec) ? state.AudioStream?.Profile : "DTS";
|
||||
|
||||
return HlsCodecStringHelpers.GetDTSString(profile);
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,11 @@ public static class HlsCodecStringHelpers
|
||||
/// </summary>
|
||||
public const string OPUS = "Opus";
|
||||
|
||||
/// <summary>
|
||||
/// Codec name for TRUEHD.
|
||||
/// </summary>
|
||||
public const string TRUEHD = "mlpa";
|
||||
|
||||
/// <summary>
|
||||
/// Gets a MP3 codec string.
|
||||
/// </summary>
|
||||
@@ -59,7 +64,7 @@ public static class HlsCodecStringHelpers
|
||||
{
|
||||
StringBuilder result = new StringBuilder("mp4a", 9);
|
||||
|
||||
if (string.Equals(profile, "HE", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(profile, "HE-AAC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
result.Append(".40.5");
|
||||
}
|
||||
@@ -117,6 +122,46 @@ public static class HlsCodecStringHelpers
|
||||
return OPUS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an TRUEHD codec string.
|
||||
/// </summary>
|
||||
/// <returns>TRUEHD codec string.</returns>
|
||||
public static string GetTRUEHDString()
|
||||
{
|
||||
return TRUEHD;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an DTS codec string.
|
||||
/// </summary>
|
||||
/// <param name="profile">DTS profile.</param>
|
||||
/// <returns>DTS codec string.</returns>
|
||||
public static string GetDTSString(string? profile)
|
||||
{
|
||||
if (string.Equals(profile, "DTS", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(profile, "DTS-ES", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(profile, "DTS 96/24", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "dtsc";
|
||||
}
|
||||
|
||||
if (string.Equals(profile, "DTS-HD HRA", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(profile, "DTS-HD MA", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(profile, "DTS-HD MA + DTS:X", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(profile, "DTS-HD MA + DTS:X IMAX", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "dtsh";
|
||||
}
|
||||
|
||||
if (string.Equals(profile, "DTS Express", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "dtse";
|
||||
}
|
||||
|
||||
// Default to DTS core if profile is invalid
|
||||
return "dtsc";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a H.264 codec string.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user