hls updates

This commit is contained in:
Luke Pulverenti 2015-05-21 16:53:14 -04:00
parent a100effdb6
commit 11aa20a7b8
7 changed files with 39 additions and 13 deletions

View File

@ -179,7 +179,7 @@ namespace MediaBrowser.Api.Playback
if (time > _slowSeekTicks && _slowSeekTicks > 0)
{
return string.Format("-ss {0}", MediaEncoder.GetTimeParameter(_slowSeekTicks));
return string.Format("-ss {0}", MediaEncoder.GetTimeParameter(time));
}
return string.Empty;

View File

@ -244,7 +244,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
catch (FileNotFoundException)
{
}
}
@ -675,7 +675,7 @@ namespace MediaBrowser.Api.Playback.Hls
builder.AppendLine("#EXTM3U");
builder.AppendLine("#EXT-X-VERSION:3");
builder.AppendLine("#EXT-X-TARGETDURATION:" + state.SegmentLength.ToString(UsCulture));
builder.AppendLine("#EXT-X-TARGETDURATION:" + (state.SegmentLength).ToString(UsCulture));
builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
var queryStringIndex = Request.RawUrl.IndexOf('?');
@ -758,12 +758,14 @@ namespace MediaBrowser.Api.Playback.Hls
}
var keyFrameArg = string.Format(" -force_key_frames expr:gte(t,n_forced*{0})",
1.ToString(UsCulture));
state.SegmentLength.ToString(UsCulture));
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
args += " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
//args += " -mixed-refs 0 -refs 3 -x264opts b_pyramid=0:weightb=0:weightp=0";
// Add resolution params, if specified
if (!hasGraphicalSubs)
{
@ -783,7 +785,7 @@ namespace MediaBrowser.Api.Playback.Hls
{
var threads = GetNumberOfThreads(state, false);
var inputModifier = GetInputModifier(state);
var inputModifier = GetInputModifier(state, false);
// If isEncoding is true we're actually starting ffmpeg
var startNumberParam = isEncoding ? GetStartNumber(state).ToString(UsCulture) : "0";
@ -799,7 +801,8 @@ namespace MediaBrowser.Api.Playback.Hls
if (endTime < state.RunTimeTicks.Value)
{
toTimeParam = " -to " + MediaEncoder.GetTimeParameter(endTime);
//toTimeParam = " -to " + MediaEncoder.GetTimeParameter(endTime);
toTimeParam = " -t " + MediaEncoder.GetTimeParameter(TimeSpan.FromSeconds(durationSeconds).Ticks);
}
}
@ -809,11 +812,13 @@ namespace MediaBrowser.Api.Playback.Hls
slowSeekParam = " " + slowSeekParam;
}
//state.EnableGenericHlsSegmenter = true;
if (state.EnableGenericHlsSegmenter)
{
var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d.ts";
return string.Format("{0} {1}{10}{11} -map_metadata -1 -threads {2} {3} {4} -flags -global_header -sc_threshold 0 {5} -f segment -segment_time {6} -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
return string.Format("{0} {11} {1}{10} -map_metadata -1 -threads {2} {3} {4} -flags -global_header -sc_threshold 0 {5} -f segment -segment_time {6} -segment_format mpegts -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
inputModifier,
GetInputArgument(state),
threads,
@ -829,7 +834,7 @@ namespace MediaBrowser.Api.Playback.Hls
).Trim();
}
return string.Format("{0} {1}{10}{11} -map_metadata -1 -threads {2} {3} {4} -flags -global_header -copyts -sc_threshold 0 {5} -hls_time {6} -start_number {7} -hls_list_size {8} -y \"{9}\"",
return string.Format("{0}{11} {1}{10} -map_metadata -1 -threads {2} {3} {4} -output_ts_offset " + MediaEncoder.GetTimeParameter(state.Request.StartTimeTicks ?? 0) + " -flags -global_header -sc_threshold 0 {5} -hls_time {6} -start_number {7} -hls_list_size {8} -y \"{9}\"",
inputModifier,
GetInputArgument(state),
threads,

View File

@ -32,6 +32,7 @@ namespace MediaBrowser.Server.Implementations.Library
".wd_tv",
// Synology
"@eaDir",
"eaDir"
};

View File

@ -1243,6 +1243,7 @@
"OptionNoThemeVideo": "No Theme Video",
"LabelOneTimeDonationAmount": "Donation amount:",
"ButtonDonate": "Donate",
"ButtonPurchase": "Purchase",
"OptionActor": "Actor",
"OptionComposer": "Composer",
"OptionDirector": "Director",

View File

@ -320,6 +320,19 @@ namespace MediaBrowser.WebDashboard.Api
await DumpFile(filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false);
}
var excludeFiles = new List<string>();
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
excludeFiles.Add("supporter.html");
excludeFiles.Add("supporterkey.html");
}
foreach (var file in excludeFiles)
{
File.Delete(Path.Combine(destination, file));
}
}
private async Task DumpJs(string source, string mode, string destination, string culture, string appVersion)

View File

@ -291,7 +291,7 @@ namespace MediaBrowser.WebDashboard.Api
html = ReplaceBetween(html, "<!--CORDOVA_EXCLUDE_START-->", "<!--CORDOVA_EXCLUDE_END-->", string.Empty);
// Replace CORDOVA_REPLACE_SUPPORTER_SUBMIT_START
html = ReplaceBetween(html, "<!--CORDOVA_REPLACE_SUPPORTER_SUBMIT_START-->", "<!--CORDOVA_REPLACE_SUPPORTER_SUBMIT_END-->", "<i class=\"fa fa-check\"></i><span>${ButtonDonate}</span>");
html = ReplaceBetween(html, "<!--CORDOVA_REPLACE_SUPPORTER_SUBMIT_START-->", "<!--CORDOVA_REPLACE_SUPPORTER_SUBMIT_END-->", "<i class=\"fa fa-check\"></i><span>${ButtonPurchase}</span>");
return html;
}
@ -299,14 +299,20 @@ namespace MediaBrowser.WebDashboard.Api
private string ReplaceBetween(string html, string startToken, string endToken, string newHtml)
{
var start = html.IndexOf(startToken, StringComparison.OrdinalIgnoreCase);
var end = html.IndexOf(endToken, StringComparison.OrdinalIgnoreCase);
if (start == -1 || end == -1)
if (start == -1)
{
return html;
}
string result = html.Substring(start + 1, end - start - 1);
var end = html.IndexOf(endToken, start, StringComparison.OrdinalIgnoreCase);
if (end == -1)
{
return html;
}
string result = html.Substring(start, end - start);
html = html.Replace(result, newHtml);
return ReplaceBetween(html, startToken, endToken, newHtml);

View File

@ -33,7 +33,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
{
var path = item.ContainingFolderPath;
list.Add(Path.Combine(path, "VIDEO_TS.nfo"));
list.Add(Path.Combine(path, "VIDEO_TS", "VIDEO_TS.nfo"));
}
if (item.VideoType == VideoType.Dvd || item.VideoType == VideoType.BluRay || item.VideoType == VideoType.HdDvd)