mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Interim work for screen recording pause support
This commit is contained in:
parent
1d599b02a6
commit
930d8a9e1b
7 changed files with 169 additions and 51 deletions
|
@ -131,6 +131,21 @@ public static string ChangeFileNameExtension(string fileName, string extension)
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string AppendTextToFileName(string filePath, string text)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
|
{
|
||||||
|
int pos = filePath.LastIndexOf('.');
|
||||||
|
|
||||||
|
if (pos >= 0)
|
||||||
|
{
|
||||||
|
return filePath.Substring(0, pos) + text + filePath.Substring(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePath + text;
|
||||||
|
}
|
||||||
|
|
||||||
public static string AppendExtension(string filePath, string extension)
|
public static string AppendExtension(string filePath, string extension)
|
||||||
{
|
{
|
||||||
return filePath.TrimEnd('.') + '.' + extension.TrimStart('.');
|
return filePath.TrimEnd('.') + '.' + extension.TrimStart('.');
|
||||||
|
|
|
@ -291,7 +291,7 @@ public void ConcatenateVideos(string[] inputFiles, string outputFile, bool autoD
|
||||||
{
|
{
|
||||||
foreach (string inputFile in inputFiles)
|
foreach (string inputFile in inputFiles)
|
||||||
{
|
{
|
||||||
if (!inputFile.Equals(outputFile, StringComparison.OrdinalIgnoreCase) && File.Exists(inputFile))
|
if (File.Exists(inputFile))
|
||||||
{
|
{
|
||||||
File.Delete(inputFile);
|
File.Delete(inputFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,6 +339,6 @@ public enum BorderStyle // Localized
|
||||||
|
|
||||||
public enum ScreenRecordState
|
public enum ScreenRecordState
|
||||||
{
|
{
|
||||||
Waiting, BeforeStart, AfterStart, AfterRecordingStart, Encoding
|
Waiting, BeforeStart, AfterStart, AfterRecordingStart, RecordingEnd, Encoding
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,6 +26,7 @@ private void InitializeComponent()
|
||||||
this.tsmiStart = new System.Windows.Forms.ToolStripMenuItem();
|
this.tsmiStart = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.tsmiAbort = new System.Windows.Forms.ToolStripMenuItem();
|
this.tsmiAbort = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.niTray = new System.Windows.Forms.NotifyIcon(this.components);
|
this.niTray = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
|
this.btnPause = new ShareX.HelpersLib.NoFocusBorderButton();
|
||||||
this.pInfo.SuspendLayout();
|
this.pInfo.SuspendLayout();
|
||||||
this.cmsMain.SuspendLayout();
|
this.cmsMain.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
@ -54,6 +55,7 @@ private void InitializeComponent()
|
||||||
// pInfo
|
// pInfo
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.pInfo, "pInfo");
|
resources.ApplyResources(this.pInfo, "pInfo");
|
||||||
|
this.pInfo.Controls.Add(this.btnPause);
|
||||||
this.pInfo.Controls.Add(this.btnAbort);
|
this.pInfo.Controls.Add(this.btnAbort);
|
||||||
this.pInfo.Controls.Add(this.btnStart);
|
this.pInfo.Controls.Add(this.btnStart);
|
||||||
this.pInfo.Controls.Add(this.lblTimer);
|
this.pInfo.Controls.Add(this.lblTimer);
|
||||||
|
@ -87,6 +89,12 @@ private void InitializeComponent()
|
||||||
resources.ApplyResources(this.niTray, "niTray");
|
resources.ApplyResources(this.niTray, "niTray");
|
||||||
this.niTray.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnStart_MouseClick);
|
this.niTray.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnStart_MouseClick);
|
||||||
//
|
//
|
||||||
|
// btnPause
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.btnPause, "btnPause");
|
||||||
|
this.btnPause.Name = "btnPause";
|
||||||
|
this.btnPause.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnPause_MouseClick);
|
||||||
|
//
|
||||||
// ScreenRecordForm
|
// ScreenRecordForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
|
@ -116,5 +124,6 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsmiStart;
|
private System.Windows.Forms.ToolStripMenuItem tsmiStart;
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsmiAbort;
|
private System.Windows.Forms.ToolStripMenuItem tsmiAbort;
|
||||||
private System.Windows.Forms.NotifyIcon niTray;
|
private System.Windows.Forms.NotifyIcon niTray;
|
||||||
|
private HelpersLib.NoFocusBorderButton btnPause;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,6 +44,7 @@ public partial class ScreenRecordForm : Form
|
||||||
public Stopwatch Timer { get; private set; }
|
public Stopwatch Timer { get; private set; }
|
||||||
public ManualResetEvent RecordResetEvent { get; set; }
|
public ManualResetEvent RecordResetEvent { get; set; }
|
||||||
public bool IsStopRequested { get; private set; }
|
public bool IsStopRequested { get; private set; }
|
||||||
|
public bool IsPauseRequested { get; private set; }
|
||||||
public bool IsAbortRequested { get; private set; }
|
public bool IsAbortRequested { get; private set; }
|
||||||
|
|
||||||
public bool ActivateWindow { get; set; } = true;
|
public bool ActivateWindow { get; set; } = true;
|
||||||
|
@ -171,6 +172,13 @@ public void StartRecordingTimer()
|
||||||
UpdateTimer();
|
UpdateTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StopRecordingTimer()
|
||||||
|
{
|
||||||
|
Timer.Stop();
|
||||||
|
timerRefresh.Stop();
|
||||||
|
UpdateTimer();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateTimer()
|
private void UpdateTimer()
|
||||||
{
|
{
|
||||||
if (!IsDisposed)
|
if (!IsDisposed)
|
||||||
|
@ -216,6 +224,14 @@ private void btnStart_MouseClick(object sender, MouseEventArgs e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnPause_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
StartStopRecording(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void btnAbort_MouseClick(object sender, MouseEventArgs e)
|
private void btnAbort_MouseClick(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
|
@ -228,12 +244,18 @@ private void btnAbort_MouseClick(object sender, MouseEventArgs e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartStopRecording()
|
public void StartStopRecording(bool isPause = false)
|
||||||
{
|
{
|
||||||
if (IsWorking)
|
if (IsWorking)
|
||||||
{
|
{
|
||||||
IsStopRequested = true;
|
IsStopRequested = true;
|
||||||
|
|
||||||
|
if (isPause)
|
||||||
|
{
|
||||||
|
RecordResetEvent.Reset();
|
||||||
|
IsPauseRequested = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsRecording)
|
if (!IsRecording)
|
||||||
{
|
{
|
||||||
IsAbortRequested = true;
|
IsAbortRequested = true;
|
||||||
|
@ -274,6 +296,7 @@ public void ChangeState(ScreenRecordState state)
|
||||||
break;
|
break;
|
||||||
case ScreenRecordState.AfterStart:
|
case ScreenRecordState.AfterStart:
|
||||||
IsWorking = true;
|
IsWorking = true;
|
||||||
|
IsPauseRequested = false;
|
||||||
string trayTextAfterStart = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_;
|
string trayTextAfterStart = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_;
|
||||||
niTray.Text = trayTextAfterStart.Truncate(63);
|
niTray.Text = trayTextAfterStart.Truncate(63);
|
||||||
niTray.Icon = Resources.control_record.ToIcon();
|
niTray.Icon = Resources.control_record.ToIcon();
|
||||||
|
@ -284,6 +307,11 @@ public void ChangeState(ScreenRecordState state)
|
||||||
IsRecording = true;
|
IsRecording = true;
|
||||||
StartRecordingTimer();
|
StartRecordingTimer();
|
||||||
break;
|
break;
|
||||||
|
case ScreenRecordState.RecordingEnd:
|
||||||
|
IsWorking = false;
|
||||||
|
IsRecording = false;
|
||||||
|
StopRecordingTimer();
|
||||||
|
break;
|
||||||
case ScreenRecordState.Encoding:
|
case ScreenRecordState.Encoding:
|
||||||
Hide();
|
Hide();
|
||||||
string trayTextAfterStop = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Encoding___;
|
string trayTextAfterStop = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Encoding___;
|
||||||
|
|
|
@ -151,19 +151,19 @@
|
||||||
<value>pInfo</value>
|
<value>pInfo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnStart.ZOrder" xml:space="preserve">
|
<data name=">>btnStart.ZOrder" xml:space="preserve">
|
||||||
<value>1</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lblTimer.Font" type="System.Drawing.Font, System.Drawing">
|
<data name="lblTimer.Font" type="System.Drawing.Font, System.Drawing">
|
||||||
<value>Arial, 12pt</value>
|
<value>Arial, 12pt</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lblTimer.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="lblTimer.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>190, 0</value>
|
<value>285, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lblTimer.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="lblTimer.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 0, 0, 0</value>
|
<value>0, 0, 0, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lblTimer.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="lblTimer.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>90, 36</value>
|
<value>92, 36</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="lblTimer.TabIndex" type="System.Int32, mscorlib">
|
<data name="lblTimer.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>2</value>
|
<value>2</value>
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
<value>pInfo</value>
|
<value>pInfo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>lblTimer.ZOrder" xml:space="preserve">
|
<data name=">>lblTimer.ZOrder" xml:space="preserve">
|
||||||
<value>2</value>
|
<value>3</value>
|
||||||
</data>
|
</data>
|
||||||
<metadata name="timerRefresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="timerRefresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
<value>Arial, 12pt</value>
|
<value>Arial, 12pt</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnAbort.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="btnAbort.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>95, 0</value>
|
<value>190, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btnAbort.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="btnAbort.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 0, 0, 0</value>
|
<value>0, 0, 0, 0</value>
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
<value>pInfo</value>
|
<value>pInfo</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>btnAbort.ZOrder" xml:space="preserve">
|
<data name=">>btnAbort.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>1</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="pInfo.AutoSize" type="System.Boolean, mscorlib">
|
<data name="pInfo.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
|
@ -228,11 +228,47 @@
|
||||||
<data name="pInfo.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
<data name="pInfo.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||||
<value>GrowAndShrink</value>
|
<value>GrowAndShrink</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="btnPause.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||||
|
<value>Flat</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.Font" type="System.Drawing.Font, System.Drawing">
|
||||||
|
<value>Arial, 12pt</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>95, 0</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
|
<value>0, 0, 0, 0</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>96, 36</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>3</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnPause.Text" xml:space="preserve">
|
||||||
|
<value>Pause</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPause.Name" xml:space="preserve">
|
||||||
|
<value>btnPause</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPause.Type" xml:space="preserve">
|
||||||
|
<value>ShareX.HelpersLib.NoFocusBorderButton, ShareX.HelpersLib, Version=14.1.2.0, Culture=neutral, PublicKeyToken=null</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPause.Parent" xml:space="preserve">
|
||||||
|
<value>pInfo</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>btnPause.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
<data name="pInfo.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="pInfo.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>8, 8</value>
|
<value>8, 8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="pInfo.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="pInfo.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>280, 36</value>
|
<value>377, 36</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="pInfo.TabIndex" type="System.Int32, mscorlib">
|
<data name="pInfo.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
|
|
|
@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
|
||||||
#endregion License Information (GPL v3)
|
#endregion License Information (GPL v3)
|
||||||
|
|
||||||
using ShareX.HelpersLib;
|
using ShareX.HelpersLib;
|
||||||
|
using ShareX.MediaLib;
|
||||||
using ShareX.Properties;
|
using ShareX.Properties;
|
||||||
using ShareX.ScreenCaptureLib;
|
using ShareX.ScreenCaptureLib;
|
||||||
using System;
|
using System;
|
||||||
|
@ -167,6 +168,8 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
|
||||||
IsRecording = true;
|
IsRecording = true;
|
||||||
|
|
||||||
string path = "";
|
string path = "";
|
||||||
|
string concatPath = "";
|
||||||
|
string tempPath = "";
|
||||||
bool abortRequested = false;
|
bool abortRequested = false;
|
||||||
|
|
||||||
float duration = taskSettings.CaptureSettings.ScreenRecordFixedDuration ? taskSettings.CaptureSettings.ScreenRecordDuration : 0;
|
float duration = taskSettings.CaptureSettings.ScreenRecordFixedDuration ? taskSettings.CaptureSettings.ScreenRecordDuration : 0;
|
||||||
|
@ -202,61 +205,88 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
|
||||||
{
|
{
|
||||||
abortRequested = true;
|
abortRequested = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (!abortRequested)
|
|
||||||
{
|
{
|
||||||
recordForm.ChangeState(ScreenRecordState.BeforeStart);
|
concatPath = FileHelpers.AppendTextToFileName(path, "-concat");
|
||||||
|
FileHelpers.DeleteFile(concatPath);
|
||||||
if (taskSettings.CaptureSettings.ScreenRecordAutoStart)
|
tempPath = FileHelpers.AppendTextToFileName(path, "-temp");
|
||||||
{
|
FileHelpers.DeleteFile(tempPath);
|
||||||
int delay = (int)(taskSettings.CaptureSettings.ScreenRecordStartDelay * 1000);
|
}
|
||||||
|
|
||||||
if (delay > 0)
|
|
||||||
{
|
|
||||||
recordForm.InvokeSafe(() => recordForm.StartCountdown(delay));
|
|
||||||
|
|
||||||
recordForm.RecordResetEvent.WaitOne(delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
recordForm.RecordResetEvent.WaitOne();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recordForm.IsAbortRequested)
|
|
||||||
{
|
|
||||||
abortRequested = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
if (!abortRequested)
|
if (!abortRequested)
|
||||||
{
|
{
|
||||||
ScreenRecordingOptions options = new ScreenRecordingOptions()
|
recordForm.ChangeState(ScreenRecordState.BeforeStart);
|
||||||
|
|
||||||
|
if (recordForm.IsPauseRequested || !taskSettings.CaptureSettings.ScreenRecordAutoStart)
|
||||||
{
|
{
|
||||||
IsRecording = true,
|
recordForm.RecordResetEvent.WaitOne();
|
||||||
IsLossless = taskSettings.CaptureSettings.ScreenRecordTwoPassEncoding,
|
}
|
||||||
FFmpeg = taskSettings.CaptureSettings.FFmpegOptions,
|
else
|
||||||
FPS = fps,
|
{
|
||||||
Duration = duration,
|
int delay = (int)(taskSettings.CaptureSettings.ScreenRecordStartDelay * 1000);
|
||||||
OutputPath = path,
|
|
||||||
CaptureArea = captureRectangle,
|
|
||||||
DrawCursor = taskSettings.CaptureSettings.ScreenRecordShowCursor
|
|
||||||
};
|
|
||||||
|
|
||||||
Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings);
|
if (delay > 0)
|
||||||
screenshot.CaptureCursor = taskSettings.CaptureSettings.ScreenRecordShowCursor;
|
{
|
||||||
|
recordForm.InvokeSafe(() => recordForm.StartCountdown(delay));
|
||||||
|
|
||||||
screenRecorder = new ScreenRecorder(ScreenRecordOutput.FFmpeg, options, screenshot, captureRectangle);
|
recordForm.RecordResetEvent.WaitOne(delay);
|
||||||
screenRecorder.RecordingStarted += ScreenRecorder_RecordingStarted;
|
}
|
||||||
screenRecorder.EncodingProgressChanged += ScreenRecorder_EncodingProgressChanged;
|
}
|
||||||
recordForm.ChangeState(ScreenRecordState.AfterStart);
|
|
||||||
screenRecorder.StartRecording();
|
|
||||||
|
|
||||||
if (recordForm.IsAbortRequested)
|
if (recordForm.IsAbortRequested)
|
||||||
{
|
{
|
||||||
abortRequested = true;
|
abortRequested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recordForm.IsPauseRequested && File.Exists(path))
|
||||||
|
{
|
||||||
|
FileHelpers.RenameFile(path, concatPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!abortRequested)
|
||||||
|
{
|
||||||
|
ScreenRecordingOptions options = new ScreenRecordingOptions()
|
||||||
|
{
|
||||||
|
IsRecording = true,
|
||||||
|
IsLossless = taskSettings.CaptureSettings.ScreenRecordTwoPassEncoding,
|
||||||
|
FFmpeg = taskSettings.CaptureSettings.FFmpegOptions,
|
||||||
|
FPS = fps,
|
||||||
|
Duration = duration,
|
||||||
|
OutputPath = path,
|
||||||
|
CaptureArea = captureRectangle,
|
||||||
|
DrawCursor = taskSettings.CaptureSettings.ScreenRecordShowCursor
|
||||||
|
};
|
||||||
|
|
||||||
|
Screenshot screenshot = TaskHelpers.GetScreenshot(taskSettings);
|
||||||
|
screenshot.CaptureCursor = taskSettings.CaptureSettings.ScreenRecordShowCursor;
|
||||||
|
|
||||||
|
screenRecorder = new ScreenRecorder(ScreenRecordOutput.FFmpeg, options, screenshot, captureRectangle);
|
||||||
|
screenRecorder.RecordingStarted += ScreenRecorder_RecordingStarted;
|
||||||
|
screenRecorder.EncodingProgressChanged += ScreenRecorder_EncodingProgressChanged;
|
||||||
|
recordForm.ChangeState(ScreenRecordState.AfterStart);
|
||||||
|
screenRecorder.StartRecording();
|
||||||
|
recordForm.ChangeState(ScreenRecordState.RecordingEnd);
|
||||||
|
|
||||||
|
if (recordForm.IsAbortRequested)
|
||||||
|
{
|
||||||
|
abortRequested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(concatPath))
|
||||||
|
{
|
||||||
|
using (FFmpegCLIManager ffmpeg = new FFmpegCLIManager(taskSettings.CaptureSettings.FFmpegOptions.FFmpegPath))
|
||||||
|
{
|
||||||
|
ffmpeg.ShowError = true;
|
||||||
|
ffmpeg.ConcatenateVideos(new string[] { concatPath, path }, tempPath, true);
|
||||||
|
FileHelpers.RenameFile(tempPath, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (recordForm.IsPauseRequested);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue