FFmpeg download and setup now works properly

This commit is contained in:
mcored 2014-05-11 22:37:27 +08:00
parent 794168f54e
commit 8e6bd56043
11 changed files with 32 additions and 31 deletions

View file

@ -221,16 +221,6 @@ public enum BorderType
Inside
}
public enum ScreenRecordOutput
{
[Description("FFmpeg")]
FFmpeg,
[Description("Video Compression Manager (VCM)")]
AVI,
[Description("Animated GIF")]
GIF
}
public enum DownloaderFormStatus
{
Waiting,

View file

@ -47,6 +47,16 @@ public enum NodePosition
Left
}
public enum ScreenRecordOutput
{
[Description("FFmpeg")]
FFmpeg,
[Description("Video Compression Manager (VCM)")]
AVI,
[Description("Animated GIF")]
GIF
}
public enum FFmpegVideoCodec
{
[Description("x264")]

View file

@ -45,9 +45,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\AsyncBridge.Net35.0.2.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
</Reference>
<Reference Include="SevenZipSharp">
<HintPath>..\packages\SevenZipSharp.0.64\lib\SevenZipSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@ -62,12 +59,6 @@
<ItemGroup>
<Compile Include="Enums.cs" />
<Compile Include="Screencast\FFmpegHelper.cs" />
<Compile Include="Screencast\FFmpegOptionsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Screencast\FFmpegOptionsForm.Designer.cs">
<DependentUpon>FFmpegOptionsForm.cs</DependentUpon>
</Compile>
<Compile Include="Screencast\ScreencastOptions.cs" />
<Compile Include="Screencast\AviWriter.cs" />
<Compile Include="Forms\RectangleLight.cs">
@ -145,9 +136,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Screencast\FFmpegOptionsForm.resx">
<DependentUpon>FFmpegOptionsForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AsyncBridge.Net35" version="0.2.0" targetFramework="net35" />
<package id="SevenZipSharp" version="0.64" targetFramework="net35" />
<package id="TaskParallelLibrary" version="1.0.2856.0" targetFramework="net35" />
</packages>

View file

@ -73,6 +73,7 @@ public ApplicationConfig()
public bool UseCustomScreenshotsPath = false;
public string CustomScreenshotsPath = string.Empty;
public string SaveImageSubFolderPattern = "%y-%mo";
public string FFmpegPath = "ffmpeg.exe";
#endregion Paths

View file

@ -1,4 +1,4 @@
namespace ScreenCaptureLib
namespace ShareX
{
partial class FFmpegOptionsForm
{

View file

@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using HelpersLib;
using ScreenCaptureLib;
using SevenZip;
using System;
using System.Collections.Generic;
@ -36,7 +37,7 @@ You should have received a copy of the GNU General Public License
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace ScreenCaptureLib
namespace ShareX
{
public partial class FFmpegOptionsForm : Form
{
@ -86,10 +87,9 @@ private void LoadSettings()
textBoxUserArgs.Text = Options.FFmpeg.UserArgs;
textBoxUserArgs.TextChanged += (sender, e) => UpdateUI();
string cli = "ffmpeg.exe";
if (string.IsNullOrEmpty(Options.FFmpeg.CLIPath) && File.Exists(cli))
if (!File.Exists(Options.FFmpeg.CLIPath) && File.Exists(Program.Settings.FFmpegPath))
{
Options.FFmpeg.CLIPath = cli;
Options.FFmpeg.CLIPath = Program.Settings.FFmpegPath;
}
textBoxFFmpegPath.Text = Options.FFmpeg.CLIPath;
@ -171,12 +171,13 @@ public static string FFmpegDownloadLink
private void form_InstallRequested(string filePath)
{
string extractPath = Options.FFmpeg.CLIPath;
string extractPath = Path.Combine(Program.ToolsFolder, "ffmpeg.exe");
bool result = ExtractFFmpeg(filePath, extractPath);
if (result)
{
this.InvokeSafe(() => textBoxFFmpegPath.Text = extractPath);
Options.FFmpeg.CLIPath = extractPath;
MessageBox.Show("FFmpeg successfully downloaded.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else

View file

@ -104,8 +104,6 @@ public async void StartRecording(TaskSettings TaskSettings)
if (MessageBox.Show(TaskSettings.CaptureSettings.FFmpegOptions.CLIPath + " does not exist." + Environment.NewLine + Environment.NewLine + "Would you like to automatically download it?",
Application.ProductName + " - Missing ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
{
TaskSettings.CaptureSettings.FFmpegOptions.CLIPath = Path.Combine(Program.ToolsFolder, "ffmpeg.exe");
using (FFmpegOptionsForm form = new FFmpegOptionsForm(TaskSettings.CaptureSettings.FFmpegOptions))
{
if (form.DownloadFFmpeg(false) == System.Windows.Forms.DialogResult.Cancel)

View file

@ -77,6 +77,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SevenZipSharp, Version=0.64.3890.29348, Culture=neutral, PublicKeyToken=20de82c62b055c88, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SevenZipSharp.0.64\lib\SevenZipSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -94,6 +98,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Forms\FFmpegOptionsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\FFmpegOptionsForm.Designer.cs">
<DependentUpon>FFmpegOptionsForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ClipboardFormatForm.cs">
<SubType>Form</SubType>
</Compile>
@ -240,6 +250,9 @@
<Compile Include="WatchFolder.cs" />
<Compile Include="WatchFolderManager.cs" />
<Compile Include="WatchFolderSettings.cs" />
<EmbeddedResource Include="Forms\FFmpegOptionsForm.resx">
<DependentUpon>FFmpegOptionsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\AboutForm.resx">
<DependentUpon>AboutForm.cs</DependentUpon>
<SubType>Designer</SubType>

View file

@ -3,5 +3,6 @@
<package id="AsyncBridge.Net35" version="0.2.0" targetFramework="net35" />
<package id="MegaApiClient" version="1.0.4" targetFramework="net35" />
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net35" />
<package id="SevenZipSharp" version="0.64" targetFramework="net35" />
<package id="TaskParallelLibrary" version="1.0.2856.0" targetFramework="net35" />
</packages>