mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
improve direct play to transcoding fallback
This commit is contained in:
parent
06394d1a9f
commit
8d1ca8ca27
|
@ -296,8 +296,8 @@
|
||||||
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
|
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
|
||||||
<Name>SocketHttpListener.Portable</Name>
|
<Name>SocketHttpListener.Portable</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<Reference Include="Emby.XmlTv, Version=1.0.6251.29080, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Emby.XmlTv, Version=1.0.6299.28292, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Emby.XmlTv.1.0.7\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
|
<HintPath>..\packages\Emby.XmlTv.1.0.8\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.6279.25941, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.6279.25941, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
|
|
@ -268,12 +268,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
var results = reader.GetChannels();
|
var results = reader.GetChannels();
|
||||||
|
|
||||||
// Should this method be async?
|
// Should this method be async?
|
||||||
return results.Select(c => new ChannelInfo()
|
return results.Select(c => new ChannelInfo
|
||||||
{
|
{
|
||||||
Id = c.Id,
|
Id = c.Id,
|
||||||
Name = c.DisplayName,
|
Name = c.DisplayName,
|
||||||
ImageUrl = c.Icon != null && !String.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
|
ImageUrl = c.Icon != null && !String.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
|
||||||
Number = c.Id
|
Number = string.IsNullOrWhiteSpace(c.Number) ? c.Id : c.Number
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Emby.XmlTv" version="1.0.7" targetFramework="portable45-net45+win8" />
|
<package id="Emby.XmlTv" version="1.0.8" targetFramework="portable45-net45+win8" />
|
||||||
<package id="MediaBrowser.Naming" version="1.0.5" targetFramework="portable45-net45+win8" />
|
<package id="MediaBrowser.Naming" version="1.0.5" targetFramework="portable45-net45+win8" />
|
||||||
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
|
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
|
||||||
<package id="SQLitePCLRaw.core" version="1.1.2" targetFramework="portable45-net45+win8" />
|
<package id="SQLitePCLRaw.core" version="1.1.2" targetFramework="portable45-net45+win8" />
|
||||||
|
|
|
@ -127,7 +127,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate,
|
SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate,
|
||||||
request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex,
|
request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex,
|
||||||
request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true, true);
|
request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true, true, true, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
var mediaSourceId = request.MediaSourceId;
|
var mediaSourceId = request.MediaSourceId;
|
||||||
|
|
||||||
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.ForceDirectPlayRemoteMediaSource, request.EnableDirectStream, request.EnableTranscoding);
|
SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.ForceDirectPlayRemoteMediaSource, request.EnableDirectStream, request.EnableTranscoding, request.AllowVideoStreamCopy, request.AllowAudioStreamCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
@ -255,13 +255,15 @@ namespace MediaBrowser.Api.Playback
|
||||||
bool enableDirectPlay,
|
bool enableDirectPlay,
|
||||||
bool forceDirectPlayRemoteMediaSource,
|
bool forceDirectPlayRemoteMediaSource,
|
||||||
bool enableDirectStream,
|
bool enableDirectStream,
|
||||||
bool enableTranscoding)
|
bool enableTranscoding,
|
||||||
|
bool allowVideoStreamCopy,
|
||||||
|
bool allowAudioStreamCopy)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
foreach (var mediaSource in result.MediaSources)
|
foreach (var mediaSource in result.MediaSources)
|
||||||
{
|
{
|
||||||
SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, forceDirectPlayRemoteMediaSource, enableDirectStream, enableTranscoding);
|
SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, forceDirectPlayRemoteMediaSource, enableDirectStream, enableTranscoding, allowVideoStreamCopy, allowAudioStreamCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
SortMediaSources(result, maxBitrate);
|
SortMediaSources(result, maxBitrate);
|
||||||
|
@ -282,7 +284,9 @@ namespace MediaBrowser.Api.Playback
|
||||||
bool enableDirectPlay,
|
bool enableDirectPlay,
|
||||||
bool forceDirectPlayRemoteMediaSource,
|
bool forceDirectPlayRemoteMediaSource,
|
||||||
bool enableDirectStream,
|
bool enableDirectStream,
|
||||||
bool enableTranscoding)
|
bool enableTranscoding,
|
||||||
|
bool allowVideoStreamCopy,
|
||||||
|
bool allowAudioStreamCopy)
|
||||||
{
|
{
|
||||||
var streamBuilder = new StreamBuilder(_mediaEncoder, Logger);
|
var streamBuilder = new StreamBuilder(_mediaEncoder, Logger);
|
||||||
|
|
||||||
|
@ -418,6 +422,15 @@ namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
streamInfo.StartPositionTicks = startTimeTicks;
|
streamInfo.StartPositionTicks = startTimeTicks;
|
||||||
mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
|
mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
|
||||||
|
|
||||||
|
if (!allowVideoStreamCopy)
|
||||||
|
{
|
||||||
|
mediaSource.TranscodingUrl += "&allowVideoStreamCopy=false";
|
||||||
|
}
|
||||||
|
if (!allowAudioStreamCopy)
|
||||||
|
{
|
||||||
|
mediaSource.TranscodingUrl += "&allowAudioStreamCopy=false";
|
||||||
|
}
|
||||||
mediaSource.TranscodingContainer = streamInfo.Container;
|
mediaSource.TranscodingContainer = streamInfo.Container;
|
||||||
mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
|
mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,14 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (string.Equals(container, "ogm", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (string.Equals(container, "divx", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Seeing reported failures here, not sure yet if this is related to specfying input format
|
// Seeing reported failures here, not sure yet if this is related to specfying input format
|
||||||
if (string.Equals(container, "m4v", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(container, "m4v", StringComparison.OrdinalIgnoreCase))
|
||||||
|
@ -750,6 +758,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
|
|
||||||
var request = state.BaseRequest;
|
var request = state.BaseRequest;
|
||||||
|
|
||||||
|
if (!request.AllowVideoStreamCopy)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (videoStream.IsInterlaced)
|
if (videoStream.IsInterlaced)
|
||||||
{
|
{
|
||||||
if (request.DeInterlace)
|
if (request.DeInterlace)
|
||||||
|
@ -895,6 +908,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
|
|
||||||
var request = state.BaseRequest;
|
var request = state.BaseRequest;
|
||||||
|
|
||||||
|
if (!request.AllowAudioStreamCopy)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Source and target codecs must match
|
// Source and target codecs must match
|
||||||
if (string.IsNullOrEmpty(audioStream.Codec) || !supportedAudioCodecs.Contains(audioStream.Codec, StringComparer.OrdinalIgnoreCase))
|
if (string.IsNullOrEmpty(audioStream.Codec) || !supportedAudioCodecs.Contains(audioStream.Codec, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,9 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
[ApiMember(Name = "EnableAutoStreamCopy", Description = "Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "EnableAutoStreamCopy", Description = "Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||||
public bool EnableAutoStreamCopy { get; set; }
|
public bool EnableAutoStreamCopy { get; set; }
|
||||||
|
|
||||||
|
public bool AllowVideoStreamCopy { get; set; }
|
||||||
|
public bool AllowAudioStreamCopy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the audio sample rate.
|
/// Gets or sets the audio sample rate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -218,6 +221,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
public BaseEncodingJobOptions()
|
public BaseEncodingJobOptions()
|
||||||
{
|
{
|
||||||
EnableAutoStreamCopy = true;
|
EnableAutoStreamCopy = true;
|
||||||
|
AllowVideoStreamCopy = true;
|
||||||
|
AllowAudioStreamCopy = true;
|
||||||
Context = EncodingContext.Streaming;
|
Context = EncodingContext.Streaming;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ namespace MediaBrowser.Model.MediaInfo
|
||||||
public bool EnableDirectStream { get; set; }
|
public bool EnableDirectStream { get; set; }
|
||||||
public bool EnableTranscoding { get; set; }
|
public bool EnableTranscoding { get; set; }
|
||||||
public bool ForceDirectPlayRemoteMediaSource { get; set; }
|
public bool ForceDirectPlayRemoteMediaSource { get; set; }
|
||||||
|
public bool AllowVideoStreamCopy { get; set; }
|
||||||
|
public bool AllowAudioStreamCopy { get; set; }
|
||||||
|
|
||||||
public PlaybackInfoRequest()
|
public PlaybackInfoRequest()
|
||||||
{
|
{
|
||||||
|
@ -35,6 +37,8 @@ namespace MediaBrowser.Model.MediaInfo
|
||||||
EnableDirectPlay = true;
|
EnableDirectPlay = true;
|
||||||
EnableDirectStream = true;
|
EnableDirectStream = true;
|
||||||
EnableTranscoding = true;
|
EnableTranscoding = true;
|
||||||
|
AllowVideoStreamCopy = true;
|
||||||
|
AllowAudioStreamCopy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue