diff options
Diffstat (limited to 'MediaBrowser.Api/Playback')
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/VideoHlsService.cs | 8 |
2 files changed, 18 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index eb133b7d6..e680546b0 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -247,7 +247,16 @@ namespace MediaBrowser.Api.Playback.Hls { var probeSize = GetProbeSizeArgument(state.Item); - var args = string.Format("-itsoffset 1 {0} {1} {2} -i {3}{4} -threads 0 {5} {6} -sc_threshold 0 {7} -hls_time 10 -start_number 0 -hls_list_size 1440 \"{8}\"", + var hlsVideoRequest = state.VideoRequest as GetHlsVideoStream; + + var itsOffsetMs = hlsVideoRequest == null + ? 0 + : ((GetHlsVideoStream) state.VideoRequest).TimeStampOffsetMs; + + var itsOffset = itsOffsetMs == 0 ? string.Empty : string.Format("-itsoffset {0} ", TimeSpan.FromMilliseconds(itsOffsetMs).TotalSeconds); + + var args = string.Format("{0}{1} {2} {3} -i {4}{5} -threads 0 {6} {7} -sc_threshold 0 {8} -hls_time 10 -start_number 0 -hls_list_size 1440 \"{9}\"", + itsOffset, probeSize, GetUserAgentParam(state.Item), GetFastSeekCommandLineParameter(state.Request), @@ -259,8 +268,6 @@ namespace MediaBrowser.Api.Playback.Hls outputPath ).Trim(); - var hlsVideoRequest = state.VideoRequest as GetHlsVideoStream; - if (hlsVideoRequest != null) { if (hlsVideoRequest.AppendBaselineStream && state.Item is Video) diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 7674fe7b7..901b27688 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -21,6 +21,14 @@ namespace MediaBrowser.Api.Playback.Hls [ApiMember(Name = "AppendBaselineStream", Description = "Optional. Whether or not to include a baseline audio-only stream in the master playlist.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool AppendBaselineStream { get; set; } + + [ApiMember(Name = "TimeStampOffsetMs", Description = "Optional. Alter the timestamps in the playlist by a given amount, in ms. Default is 1000.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] + public int TimeStampOffsetMs { get; set; } + + public GetHlsVideoStream() + { + TimeStampOffsetMs = 1000; + } } /// <summary> |
