mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Align navigating video with frame when in frame-time-code-mode
Related to #7105
This commit is contained in:
parent
dbe07ab735
commit
f667fef5c7
@ -347,5 +347,27 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
|
|
||||||
return ToShortString(true);
|
return ToShortString(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Align time to frame rate.
|
||||||
|
/// </summary>
|
||||||
|
public TimeCode AlignToFrame()
|
||||||
|
{
|
||||||
|
var ts = TimeSpan.FromMilliseconds(Math.Round(TotalMilliseconds, MidpointRounding.AwayFromZero));
|
||||||
|
var frames = Math.Round(ts.Milliseconds / (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate));
|
||||||
|
TimeSpan ts2;
|
||||||
|
if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001)
|
||||||
|
{
|
||||||
|
ts = ts.Add(new TimeSpan(0, 0, 1));
|
||||||
|
ts2 = new TimeSpan(ts.Days, ts.Hours, ts.Minutes, ts.Seconds, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var ms = SubtitleFormat.FramesToMillisecondsMax999(SubtitleFormat.MillisecondsToFramesMaxFrameRate(ts.Milliseconds));
|
||||||
|
ts2 = new TimeSpan(ts.Days, ts.Hours, ts.Minutes, ts.Seconds, ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TimeCode(ts2.TotalMilliseconds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2023,14 +2023,20 @@ namespace Nikse.SubtitleEdit.Controls
|
|||||||
{
|
{
|
||||||
if (VideoPlayer != null)
|
if (VideoPlayer != null)
|
||||||
{
|
{
|
||||||
|
var v = value;
|
||||||
|
|
||||||
if (SmpteMode)
|
if (SmpteMode)
|
||||||
{
|
{
|
||||||
VideoPlayer.CurrentPosition = value * 1.001;
|
v *= 1.001;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (Configuration.Settings.General.UseTimeFormatHHMMSSFF)
|
||||||
{
|
{
|
||||||
VideoPlayer.CurrentPosition = value;
|
var tc = TimeCode.FromSeconds(v);
|
||||||
|
v = tc.AlignToFrame().TotalSeconds; ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VideoPlayer.CurrentPosition = v;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -241,7 +241,7 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
|
|||||||
_pausePosition = value;
|
_pausePosition = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoMpvCommand("seek", value.ToString(CultureInfo.InvariantCulture), "absolute");
|
DoMpvCommand("seek", value.ToString(CultureInfo.InvariantCulture), "absolute", "exact");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,6 +740,7 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
|
|||||||
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("keep-open"), GetUtf8Bytes("always")); // don't auto close video
|
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("keep-open"), GetUtf8Bytes("always")); // don't auto close video
|
||||||
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("no-sub"), GetUtf8Bytes(string.Empty)); // don't load subtitles (does not seem to work anymore)
|
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("no-sub"), GetUtf8Bytes(string.Empty)); // don't load subtitles (does not seem to work anymore)
|
||||||
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("sid"), GetUtf8Bytes("no")); // don't load subtitles
|
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("sid"), GetUtf8Bytes("no")); // don't load subtitles
|
||||||
|
_mpvSetOptionString(_mpvHandle, GetUtf8Bytes("hr-seek"), GetUtf8Bytes("yes")); // don't load subtitles
|
||||||
|
|
||||||
if (videoFileName.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ||
|
if (videoFileName.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ||
|
||||||
videoFileName.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
|
videoFileName.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
|
||||||
|
Loading…
Reference in New Issue
Block a user