[AudioTranscoding] Add FLAC as supported target audio format and be able to define the corresponding target sample rate
This commit is contained in:
parent
82d27e6461
commit
28ee4f0a7f
|
@ -404,7 +404,10 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||
{
|
||||
// Don't exceed what the encoder supports
|
||||
// Seeing issues of attempting to encode to 88200
|
||||
return Math.Min(44100, BaseRequest.AudioSampleRate.Value);
|
||||
// return Math.Min(44100, BaseRequest.AudioSampleRate.Value);
|
||||
|
||||
// I don't see any reason why limiting the sample rate to a maximum of 44100 !
|
||||
return BaseRequest.AudioSampleRate.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
"ac3",
|
||||
"aac",
|
||||
"mp3",
|
||||
"flac",
|
||||
"h264_qsv",
|
||||
"hevc_qsv",
|
||||
"mpeg2_qsv",
|
||||
|
@ -71,6 +72,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
"libmp3lame",
|
||||
"libopus",
|
||||
"libvorbis",
|
||||
"flac",
|
||||
"srt",
|
||||
"h264_amf",
|
||||
"hevc_amf",
|
||||
|
|
|
@ -1438,6 +1438,32 @@ namespace MediaBrowser.Model.Dlna
|
|||
break;
|
||||
}
|
||||
|
||||
case ProfileConditionValue.AudioSampleRate:
|
||||
{
|
||||
if (!enableNonQualifiedConditions)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (int.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var num))
|
||||
{
|
||||
if (condition.Condition == ProfileConditionType.Equals)
|
||||
{
|
||||
item.AudioSampleRate = num;
|
||||
}
|
||||
else if (condition.Condition == ProfileConditionType.LessThanEqual)
|
||||
{
|
||||
item.AudioSampleRate = Math.Min(num, item.AudioSampleRate ?? num);
|
||||
}
|
||||
else if (condition.Condition == ProfileConditionType.GreaterThanEqual)
|
||||
{
|
||||
item.AudioSampleRate = Math.Max(num, item.AudioSampleRate ?? num);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ProfileConditionValue.AudioChannels:
|
||||
{
|
||||
if (string.IsNullOrEmpty(qualifier))
|
||||
|
|
|
@ -110,6 +110,8 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
public int? AudioBitrate { get; set; }
|
||||
|
||||
public int? AudioSampleRate { get; set; }
|
||||
|
||||
public int? VideoBitrate { get; set; }
|
||||
|
||||
public int? MaxWidth { get; set; }
|
||||
|
@ -184,7 +186,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
|
||||
if (string.Equals(pair.Name, "Static", StringComparison.OrdinalIgnoreCase) &&
|
||||
string.Equals(pair.Value, "false", StringComparison.OrdinalIgnoreCase))
|
||||
string.Equals(pair.Value, "true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -250,6 +252,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
list.Add(new NameValuePair("SubtitleStreamIndex", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleStreamIndex.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||
list.Add(new NameValuePair("VideoBitrate", item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||
list.Add(new NameValuePair("AudioBitrate", item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||
list.Add(new NameValuePair("AudioSampleRate", item.AudioSampleRate.HasValue ? item.AudioSampleRate.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||
|
||||
list.Add(new NameValuePair("MaxFramerate", item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||
list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||
|
@ -521,7 +524,9 @@ namespace MediaBrowser.Model.Dlna
|
|||
get
|
||||
{
|
||||
var stream = TargetAudioStream;
|
||||
return stream == null ? null : stream.SampleRate;
|
||||
return AudioSampleRate.HasValue && !IsDirectStream
|
||||
? AudioSampleRate
|
||||
: stream == null ? null : stream.SampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user