aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorJPVenson <ger-delta-07@hotmail.de>2024-11-14 21:56:18 +0100
committerGitHub <noreply@github.com>2024-11-14 21:56:18 +0100
commite8be7ab01192465735793c98bf9bbab9fca9cb8d (patch)
tree86de393341830e834b0fec743d060a80a57332b3 /MediaBrowser.Controller
parent30ba35aa0ce10916c6bd4cb6b33d573af52219ec (diff)
parent53683809d94cae373882d59e8b6761c517e0af1d (diff)
Merge branch 'jellyfin:master' into feature/EFUserData
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj2
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs55
-rw-r--r--MediaBrowser.Controller/Providers/IProviderManager.cs3
3 files changed, 21 insertions, 39 deletions
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 1ef2eb343..62f36bf28 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -8,7 +8,7 @@
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
<PackageId>Jellyfin.Controller</PackageId>
- <VersionPrefix>10.10.0</VersionPrefix>
+ <VersionPrefix>10.11.0</VersionPrefix>
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
</PropertyGroup>
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index c120e08fa..28f0d1fff 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -629,49 +629,21 @@ namespace MediaBrowser.Controller.MediaEncoding
/// <returns>Codec string.</returns>
public string InferAudioCodec(string container)
{
- var ext = "." + (container ?? string.Empty);
-
- if (string.Equals(ext, ".mp3", StringComparison.OrdinalIgnoreCase))
- {
- return "mp3";
- }
-
- if (string.Equals(ext, ".aac", StringComparison.OrdinalIgnoreCase))
+ if (string.IsNullOrWhiteSpace(container))
{
+ // this may not work, but if the client is that broken we can not do anything better
return "aac";
}
- if (string.Equals(ext, ".wma", StringComparison.OrdinalIgnoreCase))
- {
- return "wma";
- }
-
- if (string.Equals(ext, ".ogg", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
-
- if (string.Equals(ext, ".oga", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
-
- if (string.Equals(ext, ".ogv", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
+ var inferredCodec = container.ToLowerInvariant();
- if (string.Equals(ext, ".webm", StringComparison.OrdinalIgnoreCase))
+ return inferredCodec switch
{
- return "vorbis";
- }
-
- if (string.Equals(ext, ".webma", StringComparison.OrdinalIgnoreCase))
- {
- return "vorbis";
- }
-
- return "copy";
+ "ogg" or "oga" or "ogv" or "webm" or "webma" => "opus",
+ "m4a" or "m4b" or "mp4" or "mov" or "mkv" or "mka" => "aac",
+ "ts" or "avi" or "flv" or "f4v" or "swf" => "mp3",
+ _ => inferredCodec
+ };
}
/// <summary>
@@ -2696,6 +2668,7 @@ namespace MediaBrowser.Controller.MediaEncoding
public string GetFastSeekCommandLineParameter(EncodingJobInfo state, EncodingOptions options, string segmentContainer)
{
var time = state.BaseRequest.StartTimeTicks ?? 0;
+ var maxTime = state.RunTimeTicks ?? 0;
var seekParam = string.Empty;
if (time > 0)
@@ -2706,6 +2679,14 @@ namespace MediaBrowser.Controller.MediaEncoding
// This will help subtitle syncing.
var isHlsRemuxing = state.IsVideoRequest && state.TranscodingType is TranscodingJobType.Hls && IsCopyCodec(state.OutputVideoCodec);
var seekTick = isHlsRemuxing ? time + 5000000L : time;
+
+ // Seeking beyond EOF makes no sense in transcoding. Clamp the seekTick value to
+ // [0, RuntimeTicks - 0.5s], so that the muxer gets packets and avoid error codes.
+ if (maxTime > 0)
+ {
+ seekTick = Math.Clamp(seekTick, 0, Math.Max(maxTime - 5000000L, 0));
+ }
+
seekParam += string.Format(CultureInfo.InvariantCulture, "-ss {0}", _mediaEncoder.GetTimeParameter(seekTick));
if (state.IsVideoRequest)
diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs
index 38fc5f2cc..0d3a334df 100644
--- a/MediaBrowser.Controller/Providers/IProviderManager.cs
+++ b/MediaBrowser.Controller/Providers/IProviderManager.cs
@@ -77,7 +77,8 @@ namespace MediaBrowser.Controller.Providers
Task SaveImage(BaseItem item, Stream source, string mimeType, ImageType type, int? imageIndex, CancellationToken cancellationToken);
/// <summary>
- /// Saves the image.
+ /// Saves the image by giving the image path on filesystem.
+ /// This method will remove the image on the source path after saving it to the destination.
/// </summary>
/// <param name="item">Image to save.</param>
/// <param name="source">Source of image.</param>