restore ForceLiveStream param

pull/702/head
Luke Pulverenti 9 years ago
parent a38086126f
commit c59b4329f4

@ -2058,6 +2058,7 @@ namespace MediaBrowser.Api.Playback
if (state.VideoRequest != null)
{
state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;
state.VideoRequest.ForceLiveStream = transcodingProfile.ForceLiveStream;
}
}
}

@ -282,19 +282,12 @@ namespace MediaBrowser.Api.Playback.Hls
{
var isLiveStream = (state.RunTimeTicks ?? 0) == 0;
return isLiveStream;
}
protected override bool CanStreamCopyAudio(StreamState state, List<string> supportedAudioCodecs)
{
var isLiveStream = IsLiveStream(state);
if (!isLiveStream)
if (state.VideoRequest.ForceLiveStream)
{
return false;
return true;
}
return base.CanStreamCopyAudio(state, supportedAudioCodecs);
return isLiveStream;
}
}
}

@ -500,13 +500,6 @@ namespace MediaBrowser.Api.Playback.Hls
return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary<string, string>());
}
private bool IsLiveStream(StreamState state)
{
var isLiveStream = (state.RunTimeTicks ?? 0) == 0;
return isLiveStream;
}
private string GetMasterPlaylistFileText(StreamState state, int totalBitrate)
{
var builder = new StringBuilder();
@ -828,7 +821,7 @@ namespace MediaBrowser.Api.Playback.Hls
args += " -bsf:v h264_mp4toannexb";
}
args += " -flags -global_header -sc_threshold 0";
args += " -flags -global_header";
}
else
{
@ -853,7 +846,7 @@ namespace MediaBrowser.Api.Playback.Hls
args += GetGraphicalSubtitleParam(state, codec);
}
args += " -flags -global_header -sc_threshold 0";
args += " -flags -global_header";
}
if (EnableCopyTs(state) && args.IndexOf("-copyts", StringComparison.OrdinalIgnoreCase) == -1)
@ -866,6 +859,7 @@ namespace MediaBrowser.Api.Playback.Hls
private bool EnableCopyTs(StreamState state)
{
//return state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.VideoRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode;
return true;
}
@ -888,21 +882,26 @@ namespace MediaBrowser.Api.Playback.Hls
var mapArgs = state.IsOutputVideo ? GetMapArgs(state) : string.Empty;
//var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state);
//return string.Format("{0} {10} {1} -map_metadata -1 -threads {2} {3} {4} {5} -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time {6} -segment_format mpegts -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
// inputModifier,
// GetInputArgument(state),
// threads,
// mapArgs,
// GetVideoArguments(state),
// GetAudioArguments(state),
// state.SegmentLength.ToString(UsCulture),
// startNumberParam,
// outputPath,
// outputTsArg,
// toTimeParam
// ).Trim();
var enableGenericSegmenter = false;
if (enableGenericSegmenter)
{
var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state);
return string.Format("{0} {10} {1} -map_metadata -1 -threads {2} {3} {4} {5} -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time {6} -segment_format mpegts -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
inputModifier,
GetInputArgument(state),
threads,
mapArgs,
GetVideoArguments(state),
GetAudioArguments(state),
state.SegmentLength.ToString(UsCulture),
startNumberParam,
outputPath,
outputTsArg,
toTimeParam
).Trim();
}
return string.Format("{0}{11} {1} -map_metadata -1 -threads {2} {3} {4}{5} {6} -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time {7} -start_number {8} -hls_list_size {9} -y \"{10}\"",
inputModifier,

@ -190,6 +190,8 @@ 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; }
public bool ForceLiveStream { get; set; }
public VideoStreamRequest()
{
EnableAutoStreamCopy = true;

@ -443,6 +443,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream;
playlistItem.SubProtocol = transcodingProfile.Protocol;
playlistItem.AudioStreamIndex = audioStreamIndex;

@ -31,6 +31,7 @@ namespace MediaBrowser.Model.Dlna
public string VideoProfile { get; set; }
public bool CopyTimestamps { get; set; }
public bool ForceLiveStream { get; set; }
public string AudioCodec { get; set; }
public int? AudioStreamIndex { get; set; }
@ -204,7 +205,7 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxWidth.Value) : string.Empty));
list.Add(new NameValuePair("MaxHeight", item.MaxHeight.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxHeight.Value) : string.Empty));
if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls"))
if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls") && !item.ForceLiveStream)
{
list.Add(new NameValuePair("StartTimeTicks", string.Empty));
}
@ -234,6 +235,7 @@ namespace MediaBrowser.Model.Dlna
}
list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower()));
list.Add(new NameValuePair("ForceLiveStream", item.ForceLiveStream.ToString().ToLower()));
list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
return list;

@ -19,7 +19,7 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("protocol")]
public string Protocol { get; set; }
[XmlAttribute("estimateContentLength")]
public bool EstimateContentLength { get; set; }
@ -35,6 +35,9 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("context")]
public EncodingContext Context { get; set; }
[XmlAttribute("forceLiveStream")]
public bool ForceLiveStream { get; set; }
public List<string> GetAudioCodecs()
{
List<string> list = new List<string>();

Loading…
Cancel
Save