update hdhr streaming

pull/702/head
Luke Pulverenti 9 years ago
parent 0bf4d35f53
commit d9dcd21c47

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

@ -137,12 +137,10 @@ namespace MediaBrowser.Api.Playback.Progressive
args += " -mpegts_m2ts_mode 1";
}
var isOutputMkv = string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase);
if (string.Equals(videoCodec, "copy", StringComparison.OrdinalIgnoreCase))
{
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";
}

@ -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")]
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()
{
EnableAutoStreamCopy = true;

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

@ -59,5 +59,9 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <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? IsHD { get; set; }
public string AudioCodec { get; set; }
public string VideoCodec { get; set; }
}
}

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

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

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

@ -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
{
get

@ -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;
}
@ -773,7 +765,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
state.TargetPacketLength,
state.TargetTimestamp,
state.IsTargetAnamorphic,
state.IsTargetCabac,
state.TargetRefFrames,
state.TargetVideoStreamCount,
state.TargetAudioStreamCount,

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

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

@ -283,7 +283,6 @@ namespace MediaBrowser.Model.Dlna
int? packetLength,
TransportStreamTimestamp timestamp,
bool? isAnamorphic,
bool? isCabac,
int? refFrames,
int? numVideoStreams,
int? numAudioStreams,
@ -321,7 +320,7 @@ namespace MediaBrowser.Model.Dlna
var anyOff = false;
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;
break;

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

@ -597,7 +597,6 @@ namespace MediaBrowser.Model.Dlna
string videoProfile = videoStream == null ? null : videoStream.Profile;
float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate;
bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic;
bool? isCabac = videoStream == null ? null : videoStream.IsCabac;
string videoCodecTag = videoStream == null ? null : videoStream.CodecTag;
int? audioBitrate = audioStream == null ? null : audioStream.BitRate;
@ -614,7 +613,7 @@ namespace MediaBrowser.Model.Dlna
// Check container 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);
@ -647,7 +646,7 @@ namespace MediaBrowser.Model.Dlna
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);
@ -910,22 +909,6 @@ namespace MediaBrowser.Model.Dlna
}
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.AudioProfile:
case ProfileConditionValue.Has64BitOffsets:

@ -30,7 +30,6 @@ namespace MediaBrowser.Model.Dlna
public string VideoCodec { get; set; }
public string VideoProfile { get; set; }
public bool? Cabac { get; set; }
public bool CopyTimestamps { 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("MaxVideoBitDepth", item.MaxVideoBitDepth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxVideoBitDepth.Value) : 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("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
{
get

@ -232,11 +232,5 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value>
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; }
}
}

@ -89,7 +89,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture),
Id = GetChannelId(info, i),
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))
{
var lineup = await GetLineup(info, CancellationToken.None).ConfigureAwait(false);
var channel = lineup.FirstOrDefault(i => string.Equals(i.GuideNumber, channelId, StringComparison.OrdinalIgnoreCase));
var channels = await GetChannels(info, true, CancellationToken.None).ConfigureAwait(false);
var channel = channels.FirstOrDefault(i => string.Equals(i.Number, channelId, StringComparison.OrdinalIgnoreCase));
if (channel != null)
{
videoCodec = channel.VideoCodec;
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,
Height = height,
BitRate = videoBitrate
},
new MediaStream
{

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

Loading…
Cancel
Save