mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
resolve wtv transcoding
This commit is contained in:
parent
a2dc5e090b
commit
b314199319
@ -1,5 +1,6 @@
|
|||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Dlna;
|
using MediaBrowser.Controller.Dlna;
|
||||||
@ -60,9 +61,12 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
|
|
||||||
public class DynamicHlsService : BaseHlsService
|
public class DynamicHlsService : BaseHlsService
|
||||||
{
|
{
|
||||||
public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, IChannelManager channelManager, ISubtitleEncoder subtitleEncoder)
|
protected INetworkManager NetworkManager { get; private set; }
|
||||||
|
|
||||||
|
public DynamicHlsService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, IChannelManager channelManager, ISubtitleEncoder subtitleEncoder, INetworkManager networkManager)
|
||||||
: base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, channelManager, subtitleEncoder)
|
: base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, channelManager, subtitleEncoder)
|
||||||
{
|
{
|
||||||
|
NetworkManager = networkManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Get(GetMasterHlsVideoStream request)
|
public object Get(GetMasterHlsVideoStream request)
|
||||||
@ -480,6 +484,12 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
|
|
||||||
private bool EnableAdaptiveBitrateStreaming(StreamState state)
|
private bool EnableAdaptiveBitrateStreaming(StreamState state)
|
||||||
{
|
{
|
||||||
|
// Within the local network this will likely do more harm than good.
|
||||||
|
if (Request.IsLocal || NetworkManager.IsInLocalNetwork(Request.RemoteIp))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var request = state.Request as GetMasterHlsVideoStream;
|
var request = state.Request as GetMasterHlsVideoStream;
|
||||||
|
|
||||||
if (request != null && !request.EnableAdaptiveBitrateStreaming)
|
if (request != null && !request.EnableAdaptiveBitrateStreaming)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Net
|
namespace MediaBrowser.Common.Net
|
||||||
{
|
{
|
||||||
@ -13,6 +15,65 @@ namespace MediaBrowser.Common.Net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string JsonMimeType = "application/json";
|
public static string JsonMimeType = "application/json";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Any extension in this list is considered a video file - can be added to at runtime for extensibility
|
||||||
|
/// </summary>
|
||||||
|
private static readonly List<string> VideoFileExtensions = new List<string>
|
||||||
|
{
|
||||||
|
".mkv",
|
||||||
|
".m2t",
|
||||||
|
".m2ts",
|
||||||
|
".img",
|
||||||
|
".iso",
|
||||||
|
".mk3d",
|
||||||
|
".ts",
|
||||||
|
".rmvb",
|
||||||
|
".mov",
|
||||||
|
".avi",
|
||||||
|
".mpg",
|
||||||
|
".mpeg",
|
||||||
|
".wmv",
|
||||||
|
".mp4",
|
||||||
|
".divx",
|
||||||
|
".dvr-ms",
|
||||||
|
".wtv",
|
||||||
|
".ogm",
|
||||||
|
".ogv",
|
||||||
|
".asf",
|
||||||
|
".m4v",
|
||||||
|
".flv",
|
||||||
|
".f4v",
|
||||||
|
".3gp",
|
||||||
|
".webm",
|
||||||
|
".mts",
|
||||||
|
".m2v",
|
||||||
|
".rec"
|
||||||
|
};
|
||||||
|
|
||||||
|
private static readonly Dictionary<string, string> VideoFileExtensionsDictionary = VideoFileExtensions.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether [is video file] [the specified path].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
|
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
|
public static bool IsVideoFile(string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("path");
|
||||||
|
}
|
||||||
|
|
||||||
|
var extension = Path.GetExtension(path);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(extension))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return VideoFileExtensionsDictionary.ContainsKey(extension);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type of the MIME.
|
/// Gets the type of the MIME.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,10 +98,6 @@ namespace MediaBrowser.Common.Net
|
|||||||
{
|
{
|
||||||
return "video/mpeg";
|
return "video/mpeg";
|
||||||
}
|
}
|
||||||
if (ext.Equals(".mp4", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return "video/mp4";
|
|
||||||
}
|
|
||||||
if (ext.Equals(".ogv", StringComparison.OrdinalIgnoreCase))
|
if (ext.Equals(".ogv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return "video/ogg";
|
return "video/ogg";
|
||||||
@ -90,6 +147,12 @@ namespace MediaBrowser.Common.Net
|
|||||||
return "video/mp2t";
|
return "video/mp2t";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Catch-all for all video types that don't require specific mime types
|
||||||
|
if (VideoFileExtensionsDictionary.ContainsKey(ext))
|
||||||
|
{
|
||||||
|
return "video/" + ext.TrimStart('.').ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
// Type text
|
// Type text
|
||||||
if (ext.Equals(".css", StringComparison.OrdinalIgnoreCase))
|
if (ext.Equals(".css", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ namespace MediaBrowser.Controller.Connect
|
|||||||
{
|
{
|
||||||
public interface IConnectManager
|
public interface IConnectManager
|
||||||
{
|
{
|
||||||
string WanIpAddress { get; }
|
|
||||||
string WanApiAddress { get; }
|
string WanApiAddress { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
using System.Globalization;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@ -30,43 +31,6 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Any extension in this list is considered a video file - can be added to at runtime for extensibility
|
|
||||||
/// </summary>
|
|
||||||
public static List<string> VideoFileExtensions = new List<string>
|
|
||||||
{
|
|
||||||
".mkv",
|
|
||||||
".m2t",
|
|
||||||
".m2ts",
|
|
||||||
".img",
|
|
||||||
".iso",
|
|
||||||
".mk3d",
|
|
||||||
".ts",
|
|
||||||
".rmvb",
|
|
||||||
".mov",
|
|
||||||
".avi",
|
|
||||||
".mpg",
|
|
||||||
".mpeg",
|
|
||||||
".wmv",
|
|
||||||
".mp4",
|
|
||||||
".divx",
|
|
||||||
".dvr-ms",
|
|
||||||
".wtv",
|
|
||||||
".ogm",
|
|
||||||
".ogv",
|
|
||||||
".asf",
|
|
||||||
".m4v",
|
|
||||||
".flv",
|
|
||||||
".f4v",
|
|
||||||
".3gp",
|
|
||||||
".webm",
|
|
||||||
".mts",
|
|
||||||
".m2v",
|
|
||||||
".rec"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> VideoFileExtensionsDictionary = VideoFileExtensions.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
private static readonly Regex MultiFileRegex = new Regex(
|
private static readonly Regex MultiFileRegex = new Regex(
|
||||||
@"(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck]|d)[ _.-]*[0-9]+)(.*?)(\.[^.]+)$",
|
@"(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck]|d)[ _.-]*[0-9]+)(.*?)(\.[^.]+)$",
|
||||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
@ -156,19 +120,7 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
public static bool IsVideoFile(string path)
|
public static bool IsVideoFile(string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
return MimeTypes.IsVideoFile(path);
|
||||||
{
|
|
||||||
throw new ArgumentNullException("path");
|
|
||||||
}
|
|
||||||
|
|
||||||
var extension = Path.GetExtension(path);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(extension))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return VideoFileExtensionsDictionary.ContainsKey(extension);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -31,7 +31,22 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|||||||
public string ConnectServerId { get; set; }
|
public string ConnectServerId { get; set; }
|
||||||
public string ConnectAccessKey { get; set; }
|
public string ConnectAccessKey { get; set; }
|
||||||
|
|
||||||
public string WanIpAddress { get; private set; }
|
public string DiscoveredWanIpAddress { get; private set; }
|
||||||
|
|
||||||
|
public string WanIpAddress
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var address = _config.Configuration.WanDdns;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(address))
|
||||||
|
{
|
||||||
|
address = DiscoveredWanIpAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string WanApiAddress
|
public string WanApiAddress
|
||||||
{
|
{
|
||||||
@ -75,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|||||||
|
|
||||||
internal void OnWanAddressResolved(string address)
|
internal void OnWanAddressResolved(string address)
|
||||||
{
|
{
|
||||||
WanIpAddress = address;
|
DiscoveredWanIpAddress = address;
|
||||||
|
|
||||||
//UpdateConnectInfo();
|
//UpdateConnectInfo();
|
||||||
}
|
}
|
||||||
|
@ -445,5 +445,6 @@
|
|||||||
"MessageTrialExpired": "The trial period for this feature has expired",
|
"MessageTrialExpired": "The trial period for this feature has expired",
|
||||||
"MessageTrialWillExpireIn": "The trial period for this feature will expire in {0} day(s)",
|
"MessageTrialWillExpireIn": "The trial period for this feature will expire in {0} day(s)",
|
||||||
"MessageInstallPluginFromApp": "This plugin must be installed from with in the app you intend to use it in.",
|
"MessageInstallPluginFromApp": "This plugin must be installed from with in the app you intend to use it in.",
|
||||||
"ValuePriceUSD": "Price: {0} (USD)"
|
"ValuePriceUSD": "Price: {0} (USD)",
|
||||||
|
"MessageFeatureIncludedWithSupporter": "You are registered for this feature, and will be able to continue using it with an active supporter membership."
|
||||||
}
|
}
|
||||||
|
@ -1152,5 +1152,5 @@
|
|||||||
"XmlDocumentAttributeListHelp": "These attributes are applied to the root element of every xml response.",
|
"XmlDocumentAttributeListHelp": "These attributes are applied to the root element of every xml response.",
|
||||||
"OptionSaveMetadataAsHidden": "Save metadata and images as hidden files",
|
"OptionSaveMetadataAsHidden": "Save metadata and images as hidden files",
|
||||||
"LabelExtractChaptersDuringLibraryScan": "Extract chapter images during the library scan",
|
"LabelExtractChaptersDuringLibraryScan": "Extract chapter images during the library scan",
|
||||||
"LabelExtractChaptersDuringLibraryScanHelp": "If enabled, chapter images will be extracted as part of the normal library scan. If disabled they will be extracted during the chapter images scheduled task, allowing the regular library scan to complete faster."
|
"LabelExtractChaptersDuringLibraryScanHelp": "If enabled, chapter images will be extracted when videos are imported during the library scan. If disabled they will be extracted during the chapter images scheduled task, allowing the regular library scan to complete faster."
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user