Merge pull request #2 from ShareX/master

Merge Latest Updates
This commit is contained in:
Amir Pourmand 2019-08-10 14:04:47 +04:30 committed by GitHub
commit 37123fa25c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 3085 additions and 1048 deletions

View file

@ -101,39 +101,13 @@ public bool EncodeVideo(string input, string output)
return Run(Options.FFmpeg.FFmpegPath, Options.GetFFmpegCommands()); return Run(Options.FFmpeg.FFmpegPath, Options.GetFFmpegCommands());
} }
public bool EncodeGIF(string input, string output, string tempFolder) public bool EncodeGIF(string input, string output)
{
bool result;
string palettePath = Path.Combine(tempFolder, "FFmpeg-palette.png");
try
{ {
// https://ffmpeg.org/ffmpeg-filters.html#palettegen-1 // https://ffmpeg.org/ffmpeg-filters.html#palettegen-1
result = Run(Options.FFmpeg.FFmpegPath, string.Format("-y -i \"{0}\" -vf \"palettegen=stats_mode={2}\" \"{1}\"", input, palettePath, Options.FFmpeg.GIFStatsMode));
if (result)
{
if (File.Exists(palettePath))
{
// https://ffmpeg.org/ffmpeg-filters.html#paletteuse // https://ffmpeg.org/ffmpeg-filters.html#paletteuse
result = Run(Options.FFmpeg.FFmpegPath, string.Format("-y -i \"{0}\" -i \"{1}\" -lavfi \"paletteuse=dither={3}\" \"{2}\"", input, palettePath, output, Options.FFmpeg.GIFDither)); return Run(Options.FFmpeg.FFmpegPath,
} $"-y -i \"{input}\" -lavfi \"palettegen=stats_mode={Options.FFmpeg.GIFStatsMode}[palette]," +
else $"[0:v][palette]paletteuse=dither={Options.FFmpeg.GIFDither}\" \"{output}\"");
{
result = false;
}
}
}
finally
{
if (File.Exists(palettePath))
{
File.Delete(palettePath);
}
}
return result;
} }
private bool Run(string path, string args = null) private bool Run(string path, string args = null)

View file

@ -233,16 +233,13 @@ public void SaveAsGIF(string path, GIFQuality quality)
public bool FFmpegEncodeVideo(string input, string output) public bool FFmpegEncodeVideo(string input, string output)
{ {
Helpers.CreateDirectoryFromFilePath(output); Helpers.CreateDirectoryFromFilePath(output);
bool result = ffmpegCli.EncodeVideo(input, output); return ffmpegCli.EncodeVideo(input, output);
//DebugHelper.WriteLine("Video encoding result:\nInput file size: {0}\nOutput file size: {1}", new FileInfo(input).Length.ToSizeString(), new FileInfo(output).Length.ToSizeString());
return result;
} }
public bool FFmpegEncodeAsGIF(string sourceFilePath, string targetFilePath, string tempFolder) public bool FFmpegEncodeAsGIF(string input, string output)
{ {
Helpers.CreateDirectoryFromFilePath(targetFilePath); Helpers.CreateDirectoryFromFilePath(output);
Helpers.CreateDirectoryFromDirectoryPath(tempFolder); return ffmpegCli.EncodeGIF(input, output);
return ffmpegCli.EncodeGIF(sourceFilePath, targetFilePath, tempFolder);
} }
protected void OnRecordingStarted() protected void OnRecordingStarted()

View file

@ -591,10 +591,6 @@ private void form_KeyDown(object sender, KeyEventArgs e)
case Keys.PageDown: case Keys.PageDown:
MoveCurrentShapeDown(); MoveCurrentShapeDown();
break; break;
case Keys.Q:
Options.QuickCrop = !Options.QuickCrop;
tsmiQuickCrop.Checked = !Options.QuickCrop;
break;
case Keys.M: case Keys.M:
CurrentTool = ShapeType.ToolSelect; CurrentTool = ShapeType.ToolSelect;
break; break;
@ -625,6 +621,16 @@ private void form_KeyDown(object sender, KeyEventArgs e)
break; break;
} }
} }
else
{
switch (e.KeyData)
{
case Keys.Q:
Options.QuickCrop = !Options.QuickCrop;
tsmiQuickCrop.Checked = !Options.QuickCrop;
break;
}
}
} }
int speed; int speed;

View file

@ -213,6 +213,12 @@ public override UploadResult Upload(Stream stream, string fileName)
DebugHelper.WriteLine("B2 uploader: Too Many Requests, trying with same URL."); DebugHelper.WriteLine("B2 uploader: Too Many Requests, trying with same URL.");
continue; continue;
} }
else if (uploadResult.RC == 503)
{
DebugHelper.WriteLine("B2 uploader: Service Unavailable, trying with new URL.");
url = null;
continue;
}
else if (uploadResult.RC != 200) else if (uploadResult.RC != 200)
{ {
// something else happened that wasn't a success, so bail out // something else happened that wasn't a success, so bail out

View file

@ -247,6 +247,7 @@ private void InitializeComponent()
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid(); this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
this.chkOverrideAdvancedSettings = new System.Windows.Forms.CheckBox(); this.chkOverrideAdvancedSettings = new System.Windows.Forms.CheckBox();
this.tttvMain = new ShareX.HelpersLib.TabToTreeView(); this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
this.lblActionsNote = new System.Windows.Forms.Label();
this.tcTaskSettings.SuspendLayout(); this.tcTaskSettings.SuspendLayout();
this.tpTask.SuspendLayout(); this.tpTask.SuspendLayout();
this.cmsDestinations.SuspendLayout(); this.cmsDestinations.SuspendLayout();
@ -1895,6 +1896,7 @@ private void InitializeComponent()
// //
// pActions // pActions
// //
this.pActions.Controls.Add(this.lblActionsNote);
this.pActions.Controls.Add(this.btnActionsDuplicate); this.pActions.Controls.Add(this.btnActionsDuplicate);
this.pActions.Controls.Add(this.btnActionsAdd); this.pActions.Controls.Add(this.btnActionsAdd);
this.pActions.Controls.Add(this.lvActions); this.pActions.Controls.Add(this.lvActions);
@ -1930,6 +1932,7 @@ private void InitializeComponent()
this.chActionsArgs, this.chActionsArgs,
this.chActionsExtensions}); this.chActionsExtensions});
this.lvActions.FullRowSelect = true; this.lvActions.FullRowSelect = true;
this.lvActions.HideSelection = false;
this.lvActions.MultiSelect = false; this.lvActions.MultiSelect = false;
this.lvActions.Name = "lvActions"; this.lvActions.Name = "lvActions";
this.lvActions.UseCompatibleStateImageBehavior = false; this.lvActions.UseCompatibleStateImageBehavior = false;
@ -2010,6 +2013,7 @@ private void InitializeComponent()
this.chWatchFolderFilter, this.chWatchFolderFilter,
this.chWatchFolderIncludeSubdirectories}); this.chWatchFolderIncludeSubdirectories});
this.lvWatchFolderList.FullRowSelect = true; this.lvWatchFolderList.FullRowSelect = true;
this.lvWatchFolderList.HideSelection = false;
this.lvWatchFolderList.Name = "lvWatchFolderList"; this.lvWatchFolderList.Name = "lvWatchFolderList";
this.lvWatchFolderList.UseCompatibleStateImageBehavior = false; this.lvWatchFolderList.UseCompatibleStateImageBehavior = false;
this.lvWatchFolderList.View = System.Windows.Forms.View.Details; this.lvWatchFolderList.View = System.Windows.Forms.View.Details;
@ -2110,6 +2114,11 @@ private void InitializeComponent()
this.tttvMain.TreeViewSize = 190; this.tttvMain.TreeViewSize = 190;
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged); this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
// //
// lblActionsNote
//
resources.ApplyResources(this.lblActionsNote, "lblActionsNote");
this.lblActionsNote.Name = "lblActionsNote";
//
// TaskSettingsForm // TaskSettingsForm
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@ -2188,6 +2197,7 @@ private void InitializeComponent()
this.tpActions.ResumeLayout(false); this.tpActions.ResumeLayout(false);
this.tpActions.PerformLayout(); this.tpActions.PerformLayout();
this.pActions.ResumeLayout(false); this.pActions.ResumeLayout(false);
this.pActions.PerformLayout();
this.tpWatchFolders.ResumeLayout(false); this.tpWatchFolders.ResumeLayout(false);
this.tpWatchFolders.PerformLayout(); this.tpWatchFolders.PerformLayout();
this.tpTools.ResumeLayout(false); this.tpTools.ResumeLayout(false);
@ -2419,5 +2429,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblAutoIncrementNumber; private System.Windows.Forms.Label lblAutoIncrementNumber;
private System.Windows.Forms.NumericUpDown nudAutoIncrementNumber; private System.Windows.Forms.NumericUpDown nudAutoIncrementNumber;
private System.Windows.Forms.Button btnAutoIncrementNumber; private System.Windows.Forms.Button btnAutoIncrementNumber;
private System.Windows.Forms.Label lblActionsNote;
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -303,7 +303,7 @@ private static string ProcessTwoPassEncoding(string input, TaskSettings taskSett
{ {
if (taskSettings.CaptureSettings.FFmpegOptions.VideoCodec == FFmpegVideoCodec.gif) if (taskSettings.CaptureSettings.FFmpegOptions.VideoCodec == FFmpegVideoCodec.gif)
{ {
screenRecorder.FFmpegEncodeAsGIF(input, output, Program.ToolsFolder); screenRecorder.FFmpegEncodeAsGIF(input, output);
} }
else else
{ {