mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #4361 from ssenart/feature/4360-transcoding_flac_downsampling
Add FLAC and define the corresponding target sample rate
This commit is contained in:
commit
e0f60847c0
@ -104,6 +104,7 @@
|
|||||||
- [sorinyo2004](https://github.com/sorinyo2004)
|
- [sorinyo2004](https://github.com/sorinyo2004)
|
||||||
- [sparky8251](https://github.com/sparky8251)
|
- [sparky8251](https://github.com/sparky8251)
|
||||||
- [spookbits](https://github.com/spookbits)
|
- [spookbits](https://github.com/spookbits)
|
||||||
|
- [ssenart] (https://github.com/ssenart)
|
||||||
- [stanionascu](https://github.com/stanionascu)
|
- [stanionascu](https://github.com/stanionascu)
|
||||||
- [stevehayles](https://github.com/stevehayles)
|
- [stevehayles](https://github.com/stevehayles)
|
||||||
- [SuperSandro2000](https://github.com/SuperSandro2000)
|
- [SuperSandro2000](https://github.com/SuperSandro2000)
|
||||||
|
@ -945,7 +945,10 @@ namespace Emby.Dlna.PlayTo
|
|||||||
request.DeviceId = values.GetValueOrDefault("DeviceId");
|
request.DeviceId = values.GetValueOrDefault("DeviceId");
|
||||||
request.MediaSourceId = values.GetValueOrDefault("MediaSourceId");
|
request.MediaSourceId = values.GetValueOrDefault("MediaSourceId");
|
||||||
request.LiveStreamId = values.GetValueOrDefault("LiveStreamId");
|
request.LiveStreamId = values.GetValueOrDefault("LiveStreamId");
|
||||||
request.IsDirectStream = string.Equals("true", values.GetValueOrDefault("Static"), StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
// Be careful, IsDirectStream==true by default (Static != false or not in query).
|
||||||
|
// See initialization of StreamingRequestDto in AudioController.GetAudioStream() method : Static = @static ?? true.
|
||||||
|
request.IsDirectStream = !string.Equals("false", values.GetValueOrDefault("Static"), StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
request.AudioStreamIndex = GetIntValue(values, "AudioStreamIndex");
|
request.AudioStreamIndex = GetIntValue(values, "AudioStreamIndex");
|
||||||
request.SubtitleStreamIndex = GetIntValue(values, "SubtitleStreamIndex");
|
request.SubtitleStreamIndex = GetIntValue(values, "SubtitleStreamIndex");
|
||||||
|
@ -409,7 +409,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
{
|
{
|
||||||
// Don't exceed what the encoder supports
|
// Don't exceed what the encoder supports
|
||||||
// Seeing issues of attempting to encode to 88200
|
// Seeing issues of attempting to encode to 88200
|
||||||
return Math.Min(44100, BaseRequest.AudioSampleRate.Value);
|
return BaseRequest.AudioSampleRate.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -25,6 +25,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
"ac3",
|
"ac3",
|
||||||
"aac",
|
"aac",
|
||||||
"mp3",
|
"mp3",
|
||||||
|
"flac",
|
||||||
"h264_qsv",
|
"h264_qsv",
|
||||||
"hevc_qsv",
|
"hevc_qsv",
|
||||||
"mpeg2_qsv",
|
"mpeg2_qsv",
|
||||||
@ -71,6 +72,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
"libmp3lame",
|
"libmp3lame",
|
||||||
"libopus",
|
"libopus",
|
||||||
"libvorbis",
|
"libvorbis",
|
||||||
|
"flac",
|
||||||
"srt",
|
"srt",
|
||||||
"h264_amf",
|
"h264_amf",
|
||||||
"hevc_amf",
|
"hevc_amf",
|
||||||
|
@ -1438,6 +1438,32 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
break;
|
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:
|
case ProfileConditionValue.AudioChannels:
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(qualifier))
|
if (string.IsNullOrEmpty(qualifier))
|
||||||
|
@ -110,6 +110,8 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
|
|
||||||
public int? AudioBitrate { get; set; }
|
public int? AudioBitrate { get; set; }
|
||||||
|
|
||||||
|
public int? AudioSampleRate { get; set; }
|
||||||
|
|
||||||
public int? VideoBitrate { get; set; }
|
public int? VideoBitrate { get; set; }
|
||||||
|
|
||||||
public int? MaxWidth { get; set; }
|
public int? MaxWidth { get; set; }
|
||||||
@ -183,8 +185,10 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Be careful, IsDirectStream==true by default (Static != false or not in query).
|
||||||
|
// See initialization of StreamingRequestDto in AudioController.GetAudioStream() method : Static = @static ?? true.
|
||||||
if (string.Equals(pair.Name, "Static", StringComparison.OrdinalIgnoreCase) &&
|
if (string.Equals(pair.Name, "Static", StringComparison.OrdinalIgnoreCase) &&
|
||||||
string.Equals(pair.Value, "false", StringComparison.OrdinalIgnoreCase))
|
string.Equals(pair.Value, "true", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -250,6 +254,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("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("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("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("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));
|
list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(CultureInfo.InvariantCulture) : string.Empty));
|
||||||
@ -521,7 +526,9 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var stream = TargetAudioStream;
|
var stream = TargetAudioStream;
|
||||||
return stream == null ? null : stream.SampleRate;
|
return AudioSampleRate.HasValue && !IsDirectStream
|
||||||
|
? AudioSampleRate
|
||||||
|
: stream == null ? null : stream.SampleRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user