update hdhr streaming

This commit is contained in:
Luke Pulverenti 2016-04-03 20:01:03 -04:00
parent 0bf4d35f53
commit d9dcd21c47
19 changed files with 26 additions and 123 deletions

View File

@ -1452,10 +1452,7 @@ namespace MediaBrowser.Api.Playback
} }
else if (i == 19) else if (i == 19)
{ {
if (videoRequest != null) // cabac no longer used
{
videoRequest.Cabac = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
}
} }
else if (i == 20) else if (i == 20)
{ {
@ -1805,10 +1802,10 @@ namespace MediaBrowser.Api.Playback
{ {
if (string.IsNullOrEmpty(videoStream.Profile)) if (string.IsNullOrEmpty(videoStream.Profile))
{ {
return false; //return false;
} }
if (!string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase)) if (!string.IsNullOrEmpty(videoStream.Profile) && !string.Equals(request.Profile, videoStream.Profile, StringComparison.OrdinalIgnoreCase))
{ {
var currentScore = GetVideoProfileScore(videoStream.Profile); var currentScore = GetVideoProfileScore(videoStream.Profile);
var requestedScore = GetVideoProfileScore(request.Profile); var requestedScore = GetVideoProfileScore(request.Profile);
@ -1884,24 +1881,16 @@ namespace MediaBrowser.Api.Playback
{ {
if (!videoStream.Level.HasValue) if (!videoStream.Level.HasValue)
{ {
return false; //return false;
} }
if (videoStream.Level.Value > requestLevel) if (videoStream.Level.HasValue && videoStream.Level.Value > requestLevel)
{ {
return false; return false;
} }
} }
} }
if (request.Cabac.HasValue && request.Cabac.Value)
{
if (videoStream.IsCabac.HasValue && !videoStream.IsCabac.Value)
{
return false;
}
}
return request.EnableAutoStreamCopy; return request.EnableAutoStreamCopy;
} }
@ -2028,7 +2017,6 @@ namespace MediaBrowser.Api.Playback
state.TargetPacketLength, state.TargetPacketLength,
state.TargetTimestamp, state.TargetTimestamp,
state.IsTargetAnamorphic, state.IsTargetAnamorphic,
state.IsTargetCabac,
state.TargetRefFrames, state.TargetRefFrames,
state.TargetVideoStreamCount, state.TargetVideoStreamCount,
state.TargetAudioStreamCount, state.TargetAudioStreamCount,
@ -2131,7 +2119,6 @@ namespace MediaBrowser.Api.Playback
state.TargetPacketLength, state.TargetPacketLength,
state.TranscodeSeekInfo, state.TranscodeSeekInfo,
state.IsTargetAnamorphic, state.IsTargetAnamorphic,
state.IsTargetCabac,
state.TargetRefFrames, state.TargetRefFrames,
state.TargetVideoStreamCount, state.TargetVideoStreamCount,
state.TargetAudioStreamCount, state.TargetAudioStreamCount,

View File

@ -137,12 +137,10 @@ namespace MediaBrowser.Api.Playback.Progressive
args += " -mpegts_m2ts_mode 1"; args += " -mpegts_m2ts_mode 1";
} }
var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase);
if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase)) if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{ {
if (state.VideoStream != null && IsH264(state.VideoStream) && if (state.VideoStream != null && IsH264(state.VideoStream) &&
(string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) || isOutputMkv)) (string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase)))
{ {
args += " -bsf:v h264_mp4toannexb"; args += " -bsf:v h264_mp4toannexb";
} }

View File

@ -190,9 +190,6 @@ namespace MediaBrowser.Api.Playback
[ApiMember(Name = "CopyTimestamps", Description = "Whether or not to copy timestamps when transcoding with an offset. Defaults to false.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "CopyTimestamps", Description = "Whether or not to copy timestamps when transcoding with an offset. Defaults to false.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool CopyTimestamps { get; set; } public bool CopyTimestamps { get; set; }
[ApiMember(Name = "Cabac", Description = "Enable if cabac encoding is required", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? Cabac { get; set; }
public VideoStreamRequest() public VideoStreamRequest()
{ {
EnableAutoStreamCopy = true; EnableAutoStreamCopy = true;

View File

@ -480,18 +480,5 @@ namespace MediaBrowser.Api.Playback
return false; return false;
} }
} }
public bool? IsTargetCabac
{
get
{
if (Request.Static)
{
return VideoStream == null ? null : VideoStream.IsCabac;
}
return true;
}
}
} }
} }

View File

@ -59,5 +59,9 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
/// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value> /// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value>
public bool? IsFavorite { get; set; } public bool? IsFavorite { get; set; }
public bool? IsHD { get; set; }
public string AudioCodec { get; set; }
public string VideoCodec { get; set; }
} }
} }

View File

@ -58,8 +58,6 @@ namespace MediaBrowser.Controller.MediaEncoding
} }
} }
public bool? Cabac { get; set; }
public EncodingJobOptions() public EncodingJobOptions()
{ {
@ -87,7 +85,6 @@ namespace MediaBrowser.Controller.MediaEncoding
MaxRefFrames = info.MaxRefFrames; MaxRefFrames = info.MaxRefFrames;
MaxVideoBitDepth = info.MaxVideoBitDepth; MaxVideoBitDepth = info.MaxVideoBitDepth;
SubtitleMethod = info.SubtitleDeliveryMethod; SubtitleMethod = info.SubtitleDeliveryMethod;
Cabac = info.Cabac;
Context = info.Context; Context = info.Context;
if (info.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External) if (info.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External)

View File

@ -171,7 +171,6 @@ namespace MediaBrowser.Dlna.Didl
streamInfo.TargetPacketLength, streamInfo.TargetPacketLength,
streamInfo.TranscodeSeekInfo, streamInfo.TranscodeSeekInfo,
streamInfo.IsTargetAnamorphic, streamInfo.IsTargetAnamorphic,
streamInfo.IsTargetCabac,
streamInfo.TargetRefFrames, streamInfo.TargetRefFrames,
streamInfo.TargetVideoStreamCount, streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount, streamInfo.TargetAudioStreamCount,
@ -317,7 +316,6 @@ namespace MediaBrowser.Dlna.Didl
streamInfo.TargetPacketLength, streamInfo.TargetPacketLength,
streamInfo.TargetTimestamp, streamInfo.TargetTimestamp,
streamInfo.IsTargetAnamorphic, streamInfo.IsTargetAnamorphic,
streamInfo.IsTargetCabac,
streamInfo.TargetRefFrames, streamInfo.TargetRefFrames,
streamInfo.TargetVideoStreamCount, streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount, streamInfo.TargetAudioStreamCount,

View File

@ -523,7 +523,6 @@ namespace MediaBrowser.Dlna.PlayTo
streamInfo.TargetPacketLength, streamInfo.TargetPacketLength,
streamInfo.TranscodeSeekInfo, streamInfo.TranscodeSeekInfo,
streamInfo.IsTargetAnamorphic, streamInfo.IsTargetAnamorphic,
streamInfo.IsTargetCabac,
streamInfo.TargetRefFrames, streamInfo.TargetRefFrames,
streamInfo.TargetVideoStreamCount, streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount, streamInfo.TargetAudioStreamCount,

View File

@ -391,19 +391,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
} }
} }
public bool? IsTargetCabac
{
get
{
if (Options.Static)
{
return VideoStream == null ? null : VideoStream.IsCabac;
}
return true;
}
}
public int? TargetVideoStreamCount public int? TargetVideoStreamCount
{ {
get get

View File

@ -664,14 +664,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
} }
} }
if (request.Cabac.HasValue && request.Cabac.Value)
{
if (videoStream.IsCabac.HasValue && !videoStream.IsCabac.Value)
{
return false;
}
}
return request.EnableAutoStreamCopy; return request.EnableAutoStreamCopy;
} }
@ -773,7 +765,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
state.TargetPacketLength, state.TargetPacketLength,
state.TargetTimestamp, state.TargetTimestamp,
state.IsTargetAnamorphic, state.IsTargetAnamorphic,
state.IsTargetCabac,
state.TargetRefFrames, state.TargetRefFrames,
state.TargetVideoStreamCount, state.TargetVideoStreamCount,
state.TargetAudioStreamCount, state.TargetAudioStreamCount,

View File

@ -17,7 +17,6 @@ namespace MediaBrowser.Model.Dlna
int? packetLength, int? packetLength,
TransportStreamTimestamp? timestamp, TransportStreamTimestamp? timestamp,
bool? isAnamorphic, bool? isAnamorphic,
bool? isCabac,
int? refFrames, int? refFrames,
int? numVideoStreams, int? numVideoStreams,
int? numAudioStreams, int? numAudioStreams,
@ -27,8 +26,6 @@ namespace MediaBrowser.Model.Dlna
{ {
case ProfileConditionValue.IsAnamorphic: case ProfileConditionValue.IsAnamorphic:
return IsConditionSatisfied(condition, isAnamorphic); return IsConditionSatisfied(condition, isAnamorphic);
case ProfileConditionValue.IsCabac:
return IsConditionSatisfied(condition, isCabac);
case ProfileConditionValue.VideoFramerate: case ProfileConditionValue.VideoFramerate:
return IsConditionSatisfied(condition, videoFramerate); return IsConditionSatisfied(condition, videoFramerate);
case ProfileConditionValue.VideoLevel: case ProfileConditionValue.VideoLevel:

View File

@ -115,7 +115,6 @@ namespace MediaBrowser.Model.Dlna
int? packetLength, int? packetLength,
TranscodeSeekInfo transcodeSeekInfo, TranscodeSeekInfo transcodeSeekInfo,
bool? isAnamorphic, bool? isAnamorphic,
bool? isCabac,
int? refFrames, int? refFrames,
int? numVideoStreams, int? numVideoStreams,
int? numAudioStreams, int? numAudioStreams,
@ -157,7 +156,6 @@ namespace MediaBrowser.Model.Dlna
packetLength, packetLength,
timestamp, timestamp,
isAnamorphic, isAnamorphic,
isCabac,
refFrames, refFrames,
numVideoStreams, numVideoStreams,
numAudioStreams, numAudioStreams,

View File

@ -283,7 +283,6 @@ namespace MediaBrowser.Model.Dlna
int? packetLength, int? packetLength,
TransportStreamTimestamp timestamp, TransportStreamTimestamp timestamp,
bool? isAnamorphic, bool? isAnamorphic,
bool? isCabac,
int? refFrames, int? refFrames,
int? numVideoStreams, int? numVideoStreams,
int? numAudioStreams, int? numAudioStreams,
@ -321,7 +320,7 @@ namespace MediaBrowser.Model.Dlna
var anyOff = false; var anyOff = false;
foreach (ProfileCondition c in i.Conditions) foreach (ProfileCondition c in i.Conditions)
{ {
if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag))
{ {
anyOff = true; anyOff = true;
break; break;

View File

@ -17,7 +17,6 @@
VideoTimestamp = 12, VideoTimestamp = 12,
IsAnamorphic = 13, IsAnamorphic = 13,
RefFrames = 14, RefFrames = 14,
IsCabac = 15,
NumAudioStreams = 16, NumAudioStreams = 16,
NumVideoStreams = 17, NumVideoStreams = 17,
IsSecondaryAudio = 18, IsSecondaryAudio = 18,

View File

@ -597,7 +597,6 @@ namespace MediaBrowser.Model.Dlna
string videoProfile = videoStream == null ? null : videoStream.Profile; string videoProfile = videoStream == null ? null : videoStream.Profile;
float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate;
bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic;
bool? isCabac = videoStream == null ? null : videoStream.IsCabac;
string videoCodecTag = videoStream == null ? null : videoStream.CodecTag; string videoCodecTag = videoStream == null ? null : videoStream.CodecTag;
int? audioBitrate = audioStream == null ? null : audioStream.BitRate; int? audioBitrate = audioStream == null ? null : audioStream.BitRate;
@ -614,7 +613,7 @@ namespace MediaBrowser.Model.Dlna
// Check container conditions // Check container conditions
foreach (ProfileCondition i in conditions) foreach (ProfileCondition i in conditions)
{ {
if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag))
{ {
LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource); LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource);
@ -647,7 +646,7 @@ namespace MediaBrowser.Model.Dlna
foreach (ProfileCondition i in conditions) foreach (ProfileCondition i in conditions)
{ {
if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag))
{ {
LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource); LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource);
@ -910,22 +909,6 @@ namespace MediaBrowser.Model.Dlna
} }
break; break;
} }
case ProfileConditionValue.IsCabac:
{
bool val;
if (BoolHelper.TryParseCultureInvariant(value, out val))
{
if (condition.Condition == ProfileConditionType.Equals)
{
item.Cabac = val;
}
else if (condition.Condition == ProfileConditionType.NotEquals)
{
item.Cabac = !val;
}
}
break;
}
case ProfileConditionValue.IsAnamorphic: case ProfileConditionValue.IsAnamorphic:
case ProfileConditionValue.AudioProfile: case ProfileConditionValue.AudioProfile:
case ProfileConditionValue.Has64BitOffsets: case ProfileConditionValue.Has64BitOffsets:

View File

@ -30,7 +30,6 @@ namespace MediaBrowser.Model.Dlna
public string VideoCodec { get; set; } public string VideoCodec { get; set; }
public string VideoProfile { get; set; } public string VideoProfile { get; set; }
public bool? Cabac { get; set; }
public bool CopyTimestamps { get; set; } public bool CopyTimestamps { get; set; }
public string AudioCodec { get; set; } public string AudioCodec { get; set; }
@ -219,7 +218,9 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("MaxRefFrames", item.MaxRefFrames.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxRefFrames.Value) : string.Empty)); list.Add(new NameValuePair("MaxRefFrames", item.MaxRefFrames.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxRefFrames.Value) : string.Empty));
list.Add(new NameValuePair("MaxVideoBitDepth", item.MaxVideoBitDepth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxVideoBitDepth.Value) : string.Empty)); list.Add(new NameValuePair("MaxVideoBitDepth", item.MaxVideoBitDepth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxVideoBitDepth.Value) : string.Empty));
list.Add(new NameValuePair("Profile", item.VideoProfile ?? string.Empty)); list.Add(new NameValuePair("Profile", item.VideoProfile ?? string.Empty));
list.Add(new NameValuePair("Cabac", item.Cabac.HasValue ? item.Cabac.Value.ToString() : string.Empty));
// no longer used
list.Add(new NameValuePair("Cabac", string.Empty));
list.Add(new NameValuePair("PlaySessionId", item.PlaySessionId ?? string.Empty)); list.Add(new NameValuePair("PlaySessionId", item.PlaySessionId ?? string.Empty));
list.Add(new NameValuePair("api_key", accessToken ?? string.Empty)); list.Add(new NameValuePair("api_key", accessToken ?? string.Empty));
@ -632,19 +633,6 @@ namespace MediaBrowser.Model.Dlna
} }
} }
public bool? IsTargetCabac
{
get
{
if (IsDirectStream)
{
return TargetVideoStream == null ? null : TargetVideoStream.IsCabac;
}
return true;
}
}
public int? TargetWidth public int? TargetWidth
{ {
get get

View File

@ -232,11 +232,5 @@ namespace MediaBrowser.Model.Entities
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value>
public bool? IsAnamorphic { get; set; } public bool? IsAnamorphic { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is cabac.
/// </summary>
/// <value><c>null</c> if [is cabac] contains no value, <c>true</c> if [is cabac]; otherwise, <c>false</c>.</value>
public bool? IsCabac { get; set; }
} }
} }

View File

@ -89,7 +89,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture), Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture),
Id = GetChannelId(info, i), Id = GetChannelId(info, i),
IsFavorite = i.Favorite, IsFavorite = i.Favorite,
TunerHostId = info.Id TunerHostId = info.Id,
IsHD = i.HD == 1,
AudioCodec = i.AudioCodec,
VideoCodec = i.VideoCodec
}); });
} }
@ -303,14 +306,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
if (string.IsNullOrWhiteSpace(videoCodec)) if (string.IsNullOrWhiteSpace(videoCodec))
{ {
var lineup = await GetLineup(info, CancellationToken.None).ConfigureAwait(false); var channels = await GetChannels(info, true, CancellationToken.None).ConfigureAwait(false);
var channel = lineup.FirstOrDefault(i => string.Equals(i.GuideNumber, channelId, StringComparison.OrdinalIgnoreCase)); var channel = channels.FirstOrDefault(i => string.Equals(i.Number, channelId, StringComparison.OrdinalIgnoreCase));
if (channel != null) if (channel != null)
{ {
videoCodec = channel.VideoCodec; videoCodec = channel.VideoCodec;
audioCodec = channel.AudioCodec; audioCodec = channel.AudioCodec;
videoBitrate = channel.HD == 1 ? 15000000 : 2000000; videoBitrate = (channel.IsHD ?? true) ? 15000000 : 2000000;
} }
} }
@ -343,7 +346,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
Width = width, Width = width,
Height = height, Height = height,
BitRate = videoBitrate BitRate = videoBitrate
}, },
new MediaStream new MediaStream
{ {

View File

@ -2755,7 +2755,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveStreamCommand.GetParameter(index++).Value = stream.BitDepth; _saveStreamCommand.GetParameter(index++).Value = stream.BitDepth;
_saveStreamCommand.GetParameter(index++).Value = stream.IsAnamorphic; _saveStreamCommand.GetParameter(index++).Value = stream.IsAnamorphic;
_saveStreamCommand.GetParameter(index++).Value = stream.RefFrames; _saveStreamCommand.GetParameter(index++).Value = stream.RefFrames;
_saveStreamCommand.GetParameter(index++).Value = stream.IsCabac; _saveStreamCommand.GetParameter(index++).Value = null;
_saveStreamCommand.GetParameter(index++).Value = stream.CodecTag; _saveStreamCommand.GetParameter(index++).Value = stream.CodecTag;
_saveStreamCommand.GetParameter(index++).Value = stream.Comment; _saveStreamCommand.GetParameter(index++).Value = stream.Comment;
@ -2907,10 +2907,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
item.RefFrames = reader.GetInt32(24); item.RefFrames = reader.GetInt32(24);
} }
if (!reader.IsDBNull(25)) // cabac no longer used
{
item.IsCabac = reader.GetBoolean(25);
}
if (!reader.IsDBNull(26)) if (!reader.IsDBNull(26))
{ {