hls updates

pull/702/head
Luke Pulverenti 10 years ago
parent a100effdb6
commit 11aa20a7b8

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

@ -675,7 +675,7 @@ namespace MediaBrowser.Api.Playback.Hls
builder.AppendLine("#EXTM3U"); builder.AppendLine("#EXTM3U");
builder.AppendLine("#EXT-X-VERSION:3"); 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"); builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
var queryStringIndex = Request.RawUrl.IndexOf('?'); 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})", 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; var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
args += " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg; 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 // Add resolution params, if specified
if (!hasGraphicalSubs) if (!hasGraphicalSubs)
{ {
@ -783,7 +785,7 @@ namespace MediaBrowser.Api.Playback.Hls
{ {
var threads = GetNumberOfThreads(state, false); var threads = GetNumberOfThreads(state, false);
var inputModifier = GetInputModifier(state); var inputModifier = GetInputModifier(state, false);
// If isEncoding is true we're actually starting ffmpeg // If isEncoding is true we're actually starting ffmpeg
var startNumberParam = isEncoding ? GetStartNumber(state).ToString(UsCulture) : "0"; var startNumberParam = isEncoding ? GetStartNumber(state).ToString(UsCulture) : "0";
@ -799,7 +801,8 @@ namespace MediaBrowser.Api.Playback.Hls
if (endTime < state.RunTimeTicks.Value) 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; slowSeekParam = " " + slowSeekParam;
} }
//state.EnableGenericHlsSegmenter = true;
if (state.EnableGenericHlsSegmenter) if (state.EnableGenericHlsSegmenter)
{ {
var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d.ts"; 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, inputModifier,
GetInputArgument(state), GetInputArgument(state),
threads, threads,
@ -829,7 +834,7 @@ namespace MediaBrowser.Api.Playback.Hls
).Trim(); ).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, inputModifier,
GetInputArgument(state), GetInputArgument(state),
threads, threads,

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

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

@ -320,6 +320,19 @@ namespace MediaBrowser.WebDashboard.Api
await DumpFile(filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false); 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) private async Task DumpJs(string source, string mode, string destination, string culture, string appVersion)

@ -291,7 +291,7 @@ namespace MediaBrowser.WebDashboard.Api
html = ReplaceBetween(html, "<!--CORDOVA_EXCLUDE_START-->", "<!--CORDOVA_EXCLUDE_END-->", string.Empty); html = ReplaceBetween(html, "<!--CORDOVA_EXCLUDE_START-->", "<!--CORDOVA_EXCLUDE_END-->", string.Empty);
// Replace CORDOVA_REPLACE_SUPPORTER_SUBMIT_START // 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; return html;
} }
@ -299,14 +299,20 @@ namespace MediaBrowser.WebDashboard.Api
private string ReplaceBetween(string html, string startToken, string endToken, string newHtml) private string ReplaceBetween(string html, string startToken, string endToken, string newHtml)
{ {
var start = html.IndexOf(startToken, StringComparison.OrdinalIgnoreCase); var start = html.IndexOf(startToken, StringComparison.OrdinalIgnoreCase);
var end = html.IndexOf(endToken, StringComparison.OrdinalIgnoreCase);
if (start == -1 || end == -1) if (start == -1)
{ {
return html; 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); html = html.Replace(result, newHtml);
return ReplaceBetween(html, startToken, endToken, newHtml); return ReplaceBetween(html, startToken, endToken, newHtml);

@ -33,7 +33,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
{ {
var path = item.ContainingFolderPath; 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) if (item.VideoType == VideoType.Dvd || item.VideoType == VideoType.BluRay || item.VideoType == VideoType.HdDvd)

Loading…
Cancel
Save