Even more play rate (toggle) - thx matmaggi :)

Fix #5839
This commit is contained in:
niksedk 2022-09-08 17:28:39 +02:00
parent aabc5f3248
commit d963cc2889
8 changed files with 59 additions and 19 deletions

View File

@ -2485,12 +2485,13 @@ can edit in same subtitle file (collaboration)</Information>
<WaveformGoToNextChapter>Go to next chapter</WaveformGoToNextChapter>
<WaveformSelectNextSubtitle>Select next subtitle (from video position, keep video pos)</WaveformSelectNextSubtitle>
<TogglePlayPause>Toggle play/pause</TogglePlayPause>
<Play150Speed>Play video with 1.5x speed</Play150Speed>
<Play200Speed>Play video with 2.0x speed</Play200Speed>
<Pause>Pause</Pause>
<Fullscreen>Fullscreen</Fullscreen>
<PlayRateSlower>Play rate slower</PlayRateSlower>
<PlayRateFaster>Play rate faster</PlayRateFaster>
<Play150Speed>Play rate 1.5x speed</Play150Speed>
<Play200Speed>Play rate 2.0x speed</Play200Speed>
<PlayRateSlower>Play rate slower (speed)</PlayRateSlower>
<PlayRateFaster>Play rate faster (speed)</PlayRateFaster>
<PlayRateToggle>Play rate (speed) toggle (05.x, 1x, 1.5x, 2x)</PlayRateToggle>
<VideoResetSpeedAndZoom>Reset speed/zoom</VideoResetSpeedAndZoom>
<MainToggleVideoControls>Toggle video controls</MainToggleVideoControls>
<VideoToggleContrast>Toggle contrast (mpv only)</VideoToggleContrast>

View File

@ -2320,6 +2320,7 @@ $HorzAlign = Center
public string MainVideoFullscreen { get; set; }
public string MainVideoSlower { get; set; }
public string MainVideoFaster { get; set; }
public string MainVideoSpeedToggle { get; set; }
public string MainVideoReset { get; set; }
public string MainVideoToggleBrightness { get; set; }
public string MainVideoToggleContrast { get; set; }
@ -8578,6 +8579,12 @@ $HorzAlign = Center
shortcuts.MainVideoFaster = subNode.InnerText;
}
subNode = node.SelectSingleNode("MainVideoSpeedToggle");
if (subNode != null)
{
shortcuts.MainVideoSpeedToggle = subNode.InnerText;
}
subNode = node.SelectSingleNode("MainVideoReset");
if (subNode != null)
{
@ -10870,6 +10877,7 @@ $HorzAlign = Center
textWriter.WriteElementString("MainVideoFullscreen", shortcuts.MainVideoFullscreen);
textWriter.WriteElementString("MainVideoSlower", shortcuts.MainVideoSlower);
textWriter.WriteElementString("MainVideoFaster", shortcuts.MainVideoFaster);
textWriter.WriteElementString("MainVideoSpeedToggle", shortcuts.MainVideoSpeedToggle);
textWriter.WriteElementString("MainVideoReset", shortcuts.MainVideoReset);
textWriter.WriteElementString("MainVideoToggleBrightness", shortcuts.MainVideoToggleBrightness);
textWriter.WriteElementString("MainVideoToggleContrast", shortcuts.MainVideoToggleContrast);

View File

@ -17252,6 +17252,29 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
else if (e.KeyData == _shortcuts.MainVideoSpeedToggle)
{
e.SuppressKeyPress = true;
if (!string.IsNullOrEmpty(_videoFileName) && mediaPlayer.VideoPlayer != null)
{
if (Math.Abs(mediaPlayer.VideoPlayer.PlayRate - 2) < 0.1)
{
SetPlayRateAndPlay(50, false);
}
else if (Math.Abs(mediaPlayer.VideoPlayer.PlayRate - 1) < 0.1)
{
SetPlayRateAndPlay(150, false);
}
else if (Math.Abs(mediaPlayer.VideoPlayer.PlayRate - 1.5) < 0.1)
{
SetPlayRateAndPlay(200, false);
}
else
{
SetPlayRateAndPlay(100, false);
}
}
}
else if (e.KeyData == _shortcuts.MainVideoReset)
{
e.SuppressKeyPress = true;

View File

@ -1349,8 +1349,6 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(videoNode, LanguageSettings.Current.Main.Menu.Video.OpenVideo, nameof(Configuration.Settings.Shortcuts.MainVideoOpen), true);
AddNode(videoNode, LanguageSettings.Current.Main.Menu.Video.CloseVideo, nameof(Configuration.Settings.Shortcuts.MainVideoClose), true);
AddNode(videoNode, language.TogglePlayPause, nameof(Configuration.Settings.Shortcuts.MainVideoPlayPauseToggle));
AddNode(videoNode, language.Play150Speed, nameof(Configuration.Settings.Shortcuts.MainVideoPlay150Speed));
AddNode(videoNode, language.Play200Speed, nameof(Configuration.Settings.Shortcuts.MainVideoPlay200Speed));
AddNode(videoNode, language.Pause, nameof(Configuration.Settings.Shortcuts.MainVideoPause));
AddNode(videoNode, LanguageSettings.Current.Main.VideoControls.Stop, nameof(Configuration.Settings.Shortcuts.MainVideoStop));
AddNode(videoNode, LanguageSettings.Current.Main.VideoControls.PlayFromJustBeforeText, nameof(Configuration.Settings.Shortcuts.MainVideoPlayFromJustBefore));
@ -1386,8 +1384,11 @@ namespace Nikse.SubtitleEdit.Forms.Options
AddNode(videoNode, language.WaveformGoToNextChapter, nameof(Configuration.Settings.Shortcuts.MainVideoGoToNextChapter));
AddNode(videoNode, language.WaveformSelectNextSubtitle, nameof(Configuration.Settings.Shortcuts.MainVideoSelectNextSubtitle));
AddNode(videoNode, language.Fullscreen, nameof(Configuration.Settings.Shortcuts.MainVideoFullscreen));
AddNode(videoNode, language.Play150Speed, nameof(Configuration.Settings.Shortcuts.MainVideoPlay150Speed));
AddNode(videoNode, language.Play200Speed, nameof(Configuration.Settings.Shortcuts.MainVideoPlay200Speed));
AddNode(videoNode, language.PlayRateSlower, nameof(Configuration.Settings.Shortcuts.MainVideoSlower));
AddNode(videoNode, language.PlayRateFaster, nameof(Configuration.Settings.Shortcuts.MainVideoFaster));
AddNode(videoNode, language.PlayRateToggle, nameof(Configuration.Settings.Shortcuts.MainVideoSpeedToggle));
AddNode(videoNode, language.VideoResetSpeedAndZoom, nameof(Configuration.Settings.Shortcuts.MainVideoReset));
AddNode(videoNode, language.MainToggleVideoControls, nameof(Configuration.Settings.Shortcuts.MainVideoToggleControls));
AddNode(videoNode, language.VideoAudioToText, nameof(Configuration.Settings.Shortcuts.MainVideoAudioToText));

View File

@ -2821,11 +2821,12 @@ can edit in same subtitle file (collaboration)",
LoopSelectedLines = "Loop selected lines",
Pause = "Pause",
TogglePlayPause = "Toggle play/pause",
Play150Speed = "Play video with 1.5x speed",
Play200Speed = "Play video with 2.0x speed",
Fullscreen = "Fullscreen",
PlayRateSlower = "Play rate slower",
PlayRateFaster = "Play rate faster",
Play150Speed = "Play rate 1.5x speed",
Play200Speed = "Play rate 2.0x speed",
PlayRateSlower = "Play rate slower (speed)",
PlayRateFaster = "Play rate faster (speed)",
PlayRateToggle = "Play rate (speed) toggle (05.x, 1x, 1.5x, 2x)",
VideoResetSpeedAndZoom = "Reset speed/zoom",
MainToggleVideoControls = "Toggle video controls",
VideoToggleContrast = "Toggle contrast (mpv only)",

View File

@ -6808,24 +6808,27 @@ namespace Nikse.SubtitleEdit.Logic
case "Settings/TogglePlayPause":
language.Settings.TogglePlayPause = reader.Value;
break;
case "Settings/Play150Speed":
language.Settings.Play150Speed = reader.Value;
break;
case "Settings/Play200Speed":
language.Settings.Play200Speed = reader.Value;
break;
case "Settings/Pause":
language.Settings.Pause = reader.Value;
break;
case "Settings/Fullscreen":
language.Settings.Fullscreen = reader.Value;
break;
case "Settings/Play150Speed":
language.Settings.Play150Speed = reader.Value;
break;
case "Settings/Play200Speed":
language.Settings.Play200Speed = reader.Value;
break;
case "Settings/PlayRateSlower":
language.Settings.PlayRateSlower = reader.Value;
break;
case "Settings/PlayRateFaster":
language.Settings.PlayRateFaster = reader.Value;
break;
case "Settings/PlayRateToggle":
language.Settings.PlayRateToggle = reader.Value;
break;
case "Settings/VideoResetSpeedAndZoom":
language.Settings.VideoResetSpeedAndZoom = reader.Value;
break;

View File

@ -2671,12 +2671,13 @@
public string WaveformGoToNextChapter { get; set; }
public string WaveformSelectNextSubtitle { get; set; }
public string TogglePlayPause { get; set; }
public string Play150Speed { get; set; }
public string Play200Speed { get; set; }
public string Pause { get; set; }
public string Fullscreen { get; set; }
public string Play150Speed { get; set; }
public string Play200Speed { get; set; }
public string PlayRateSlower { get; set; }
public string PlayRateFaster { get; set; }
public string PlayRateToggle { get; set; }
public string VideoResetSpeedAndZoom { get; set; }
public string MainToggleVideoControls { get; set; }
public string VideoToggleContrast { get; set; }

View File

@ -73,6 +73,7 @@ namespace Nikse.SubtitleEdit.Logic
public Keys MainVideoFullscreen { get; set; }
public Keys MainVideoSlower { get; set; }
public Keys MainVideoFaster { get; set; }
public Keys MainVideoSpeedToggle { get; set; }
public Keys MainVideoReset { get; set; }
public Keys MainVideoToggleBrightness { get; set; }
public Keys MainVideoAudioToText { get; set; }
@ -327,7 +328,8 @@ namespace Nikse.SubtitleEdit.Logic
MainVideoFullscreen = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoFullscreen);
MainVideoSlower = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoSlower);
MainVideoFaster = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoFaster);
MainVideoReset = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoReset);
MainVideoSpeedToggle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoReset);
MainVideoReset = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoSpeedToggle);
MainVideoAudioToText = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToText);
MainVideoToggleBrightness = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleBrightness);
MainVideoToggleContrast = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleContrast);