mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Workaround for have avi options button
This commit is contained in:
parent
45a08f4350
commit
2d7840e08e
5 changed files with 28 additions and 5 deletions
|
@ -39,5 +39,6 @@ public class AVIOptions
|
||||||
public int FPS;
|
public int FPS;
|
||||||
public Size Size;
|
public Size Size;
|
||||||
public bool ShowOptionsDialog;
|
public bool ShowOptionsDialog;
|
||||||
|
public IntPtr ParentWindow;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -206,7 +206,15 @@ public void Open()
|
||||||
|
|
||||||
if (Options.ShowOptionsDialog)
|
if (Options.ShowOptionsDialog)
|
||||||
{
|
{
|
||||||
NativeMethods.AVISaveOptions(stream, ref Options.CompressOptions);
|
AVICOMPRESSOPTIONS options = new AVICOMPRESSOPTIONS();
|
||||||
|
options.handler = Options.CompressOptions.handler;
|
||||||
|
options.quality = Options.CompressOptions.quality;
|
||||||
|
options.flags = 8; // AVICOMPRESSF_VALID
|
||||||
|
int result = NativeMethods.AVISaveOptions(stream, ref options, Options.ParentWindow);
|
||||||
|
if (result == 1)
|
||||||
|
{
|
||||||
|
Options.CompressOptions = options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create compressed stream
|
// create compressed stream
|
||||||
|
|
|
@ -379,7 +379,7 @@ public static void RestoreWindow(IntPtr handle)
|
||||||
/// <param name="options">Stream options.</param>
|
/// <param name="options">Stream options.</param>
|
||||||
///
|
///
|
||||||
/// <returns>Returns TRUE if the user pressed OK, FALSE for CANCEL, or an error otherwise.</returns>
|
/// <returns>Returns TRUE if the user pressed OK, FALSE for CANCEL, or an error otherwise.</returns>
|
||||||
public static int AVISaveOptions(IntPtr stream, ref AVICOMPRESSOPTIONS options)
|
public static int AVISaveOptions(IntPtr stream, ref AVICOMPRESSOPTIONS options, IntPtr parentWindow)
|
||||||
{
|
{
|
||||||
IntPtr[] streams = new IntPtr[1];
|
IntPtr[] streams = new IntPtr[1];
|
||||||
IntPtr[] infPtrs = new IntPtr[1];
|
IntPtr[] infPtrs = new IntPtr[1];
|
||||||
|
@ -394,7 +394,7 @@ public static int AVISaveOptions(IntPtr stream, ref AVICOMPRESSOPTIONS options)
|
||||||
infPtrs[0] = mem;
|
infPtrs[0] = mem;
|
||||||
|
|
||||||
// show dialog with a list of available compresors and configuration
|
// show dialog with a list of available compresors and configuration
|
||||||
int ret = AVISaveOptions(IntPtr.Zero, 0, 1, streams, infPtrs);
|
int ret = AVISaveOptions(parentWindow, 0, 1, streams, infPtrs);
|
||||||
|
|
||||||
// copy from unmanaged memory to managed structure
|
// copy from unmanaged memory to managed structure
|
||||||
options = (AVICOMPRESSOPTIONS)Marshal.PtrToStructure(mem, typeof(AVICOMPRESSOPTIONS));
|
options = (AVICOMPRESSOPTIONS)Marshal.PtrToStructure(mem, typeof(AVICOMPRESSOPTIONS));
|
||||||
|
|
|
@ -121,7 +121,6 @@ public ScreenRecorder(int fps, float durationSeconds, Rectangle captureRectangle
|
||||||
CompressOptions = compressOptions,
|
CompressOptions = compressOptions,
|
||||||
FPS = FPS,
|
FPS = FPS,
|
||||||
OutputPath = CachePath,
|
OutputPath = CachePath,
|
||||||
ShowOptionsDialog = OutputType == ScreenRecordOutput.AVI,
|
|
||||||
Size = CaptureRectangle.Size
|
Size = CaptureRectangle.Size
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using ScreenCaptureLib;
|
using ScreenCaptureLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using UploadersLib;
|
using UploadersLib;
|
||||||
|
@ -650,7 +651,21 @@ private void cbScreenRecorderOutput_SelectedIndexChanged(object sender, EventArg
|
||||||
|
|
||||||
private void btnScreenRecorderAVIOptions_Click(object sender, EventArgs e)
|
private void btnScreenRecorderAVIOptions_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//NativeMethods.AVISaveOptions(IntPtr.Zero, ref TaskSettings.CaptureSettings.ScreenRecordAVIOptions);
|
AVIOptions options = new AVIOptions
|
||||||
|
{
|
||||||
|
CompressOptions = TaskSettings.CaptureSettings.ScreenRecordCompressOptions,
|
||||||
|
FPS = 10,
|
||||||
|
OutputPath = Program.ScreenRecorderCacheFilePath,
|
||||||
|
ParentWindow = this.Handle,
|
||||||
|
ShowOptionsDialog = true,
|
||||||
|
Size = new Size(100, 100)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ugly workaround for show AVI compression dialog
|
||||||
|
using (AVICache aviCache = new AVICache(options))
|
||||||
|
{
|
||||||
|
TaskSettings.CaptureSettings.ScreenRecordCompressOptions = options.CompressOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cboEncoder_SelectedIndexChanged(object sender, EventArgs e)
|
private void cboEncoder_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue