From 3d6b7b0b6baca8df5facd55927210a7d937e71e5 Mon Sep 17 00:00:00 2001 From: Jaex Date: Tue, 4 Aug 2015 14:47:34 +0300 Subject: [PATCH] Added Video Thumbnailer --- .../Forms/VideoThumbnailerForm.Designer.cs | 83 ++ ShareX.MediaLib/Forms/VideoThumbnailerForm.cs | 68 ++ .../Forms/VideoThumbnailerForm.resx | 120 +++ ShareX.MediaLib/ShareX.MediaLib.csproj | 14 +- ...creenshotInfo.cs => VideoThumbnailInfo.cs} | 4 +- ShareX.MediaLib/VideoThumbnailOptions.cs | 8 +- ShareX.MediaLib/VideoThumbnailer.cs | 47 +- ShareX/ApplicationConfig.cs | 2 + ShareX/Forms/MainForm.Designer.cs | 10 + ShareX/Forms/MainForm.cs | 5 + ShareX/Forms/MainForm.resx | 880 +++++++++--------- ShareX/Properties/Resources.Designer.cs | 10 + ShareX/Properties/Resources.resx | 145 +-- ShareX/Resources/images-stack.png | Bin 0 -> 585 bytes ShareX/ShareX.csproj | 5 + ShareX/TaskHelpers.cs | 8 + 16 files changed, 897 insertions(+), 512 deletions(-) create mode 100644 ShareX.MediaLib/Forms/VideoThumbnailerForm.Designer.cs create mode 100644 ShareX.MediaLib/Forms/VideoThumbnailerForm.cs create mode 100644 ShareX.MediaLib/Forms/VideoThumbnailerForm.resx rename ShareX.MediaLib/{ScreenshotInfo.cs => VideoThumbnailInfo.cs} (95%) create mode 100644 ShareX/Resources/images-stack.png diff --git a/ShareX.MediaLib/Forms/VideoThumbnailerForm.Designer.cs b/ShareX.MediaLib/Forms/VideoThumbnailerForm.Designer.cs new file mode 100644 index 000000000..6f9dcb686 --- /dev/null +++ b/ShareX.MediaLib/Forms/VideoThumbnailerForm.Designer.cs @@ -0,0 +1,83 @@ +namespace ShareX.MediaLib +{ + partial class VideoThumbnailerForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtMediaPath = new System.Windows.Forms.TextBox(); + this.btnStart = new System.Windows.Forms.Button(); + this.pgOptions = new System.Windows.Forms.PropertyGrid(); + this.SuspendLayout(); + // + // txtMediaPath + // + this.txtMediaPath.Location = new System.Drawing.Point(8, 8); + this.txtMediaPath.Name = "txtMediaPath"; + this.txtMediaPath.Size = new System.Drawing.Size(624, 20); + this.txtMediaPath.TabIndex = 0; + // + // btnStart + // + this.btnStart.Location = new System.Drawing.Point(640, 8); + this.btnStart.Name = "btnStart"; + this.btnStart.Size = new System.Drawing.Size(75, 23); + this.btnStart.TabIndex = 1; + this.btnStart.Text = "Start"; + this.btnStart.UseVisualStyleBackColor = true; + this.btnStart.Click += new System.EventHandler(this.btnStart_Click); + // + // pgOptions + // + this.pgOptions.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText; + this.pgOptions.Location = new System.Drawing.Point(8, 40); + this.pgOptions.Name = "pgOptions"; + this.pgOptions.Size = new System.Drawing.Size(704, 416); + this.pgOptions.TabIndex = 2; + this.pgOptions.ToolbarVisible = false; + // + // VideoThumbnailerForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(725, 467); + this.Controls.Add(this.pgOptions); + this.Controls.Add(this.btnStart); + this.Controls.Add(this.txtMediaPath); + this.Name = "VideoThumbnailerForm"; + this.Text = "ShareX - Video thumbnailer"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtMediaPath; + private System.Windows.Forms.Button btnStart; + private System.Windows.Forms.PropertyGrid pgOptions; + } +} \ No newline at end of file diff --git a/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs b/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs new file mode 100644 index 000000000..f132a0934 --- /dev/null +++ b/ShareX.MediaLib/Forms/VideoThumbnailerForm.cs @@ -0,0 +1,68 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright © 2007-2015 ShareX Developers + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +using ShareX.HelpersLib; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ShareX.MediaLib +{ + public partial class VideoThumbnailerForm : Form + { + public string FFmpegPath { get; private set; } + public VideoThumbnailOptions Options { get; set; } + + public VideoThumbnailerForm(string ffmpegPath, VideoThumbnailOptions options) + { + FFmpegPath = ffmpegPath; + Options = options; + InitializeComponent(); + Icon = ShareXResources.Icon; + pgOptions.SelectedObject = Options; + } + + private void btnStart_Click(object sender, EventArgs e) + { + string mediaPath = txtMediaPath.Text; + + if (File.Exists(mediaPath)) + { + VideoThumbnailer thumbnailer = new VideoThumbnailer(mediaPath, FFmpegPath, Options); + btnStart.Enabled = false; + BackgroundWorker bw = new BackgroundWorker(); + bw.DoWork += (sender2, e2) => thumbnailer.TakeScreenshots(); + bw.RunWorkerCompleted += (sender3, e3) => btnStart.Enabled = true; + bw.RunWorkerAsync(); + } + } + } +} \ No newline at end of file diff --git a/ShareX.MediaLib/Forms/VideoThumbnailerForm.resx b/ShareX.MediaLib/Forms/VideoThumbnailerForm.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/ShareX.MediaLib/Forms/VideoThumbnailerForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShareX.MediaLib/ShareX.MediaLib.csproj b/ShareX.MediaLib/ShareX.MediaLib.csproj index 56f5a7d04..bc0fd9a42 100644 --- a/ShareX.MediaLib/ShareX.MediaLib.csproj +++ b/ShareX.MediaLib/ShareX.MediaLib.csproj @@ -35,6 +35,7 @@ + @@ -44,7 +45,13 @@ - + + Form + + + VideoThumbnailerForm.cs + + @@ -56,6 +63,11 @@ ShareX.HelpersLib + + + VideoThumbnailerForm.cs + +