Small changes in unused code, for cleanup.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2363 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-07 13:37:55 +00:00
commit 69754804a0
2 changed files with 1108 additions and 881 deletions

File diff suppressed because it is too large Load diff

View file

@ -93,6 +93,11 @@ namespace Greenshot.Helpers {
return exceptionToThrow; return exceptionToThrow;
} }
/// <summary>
/// Start the recording
/// </summary>
/// <param name="framesPerSecond"></param>
/// <returns></returns>
public bool Start(int framesPerSecond) { public bool Start(int framesPerSecond) {
if (recordingWindow != null) { if (recordingWindow != null) {
string windowTitle = Regex.Replace(recordingWindow.Text, @"[^\x20\d\w]", ""); string windowTitle = Regex.Replace(recordingWindow.Text, @"[^\x20\d\w]", "");
@ -176,8 +181,8 @@ namespace Greenshot.Helpers {
aviWriter = new AVIWriter(); aviWriter = new AVIWriter();
// Comment the following 2 lines to make the user select it's own codec // Comment the following 2 lines to make the user select it's own codec
//aviWriter.Codec = "msvc"; aviWriter.Codec = "msvc";
//aviWriter.Quality = 99; aviWriter.Quality = 10000;
aviWriter.FrameRate = framesPerSecond; aviWriter.FrameRate = framesPerSecond;
if (aviWriter.Open(filename, recordingSize.Width, recordingSize.Height)) { if (aviWriter.Open(filename, recordingSize.Width, recordingSize.Height)) {
@ -195,6 +200,9 @@ namespace Greenshot.Helpers {
return false; return false;
} }
/// <summary>
/// Do the actual frame capture
/// </summary>
private void CaptureFrame() { private void CaptureFrame() {
int MSBETWEENCAPTURES = 1000/framesPerSecond; int MSBETWEENCAPTURES = 1000/framesPerSecond;
int msToNextCapture = MSBETWEENCAPTURES; int msToNextCapture = MSBETWEENCAPTURES;
@ -262,6 +270,9 @@ namespace Greenshot.Helpers {
Cleanup(); Cleanup();
} }
/// <summary>
/// Stop the recording, after the next frame
/// </summary>
public void Stop() { public void Stop() {
stop = true; stop = true;
if (backgroundTask != null) { if (backgroundTask != null) {
@ -269,6 +280,7 @@ namespace Greenshot.Helpers {
} }
Cleanup(); Cleanup();
} }
/// <summary> /// <summary>
/// Free resources /// Free resources
/// </summary> /// </summary>
@ -297,7 +309,9 @@ namespace Greenshot.Helpers {
if (ffmpegexe != null) { if (ffmpegexe != null) {
try { try {
string webMFile = filename.Replace(".avi", ".webm"); string webMFile = filename.Replace(".avi", ".webm");
ProcessStartInfo processStartInfo = new ProcessStartInfo(ffmpegexe, "-i \"" + filename + "\" -vcodec libvpx \"" + webMFile + "\""); string arguments = "-i \"" + filename + "\" -codec:v libvpx -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 42 -maxrate 1000k -bufsize 4000k -threads 4 \"" + webMFile + "\"";
LOG.DebugFormat("Starting {0} with arguments {1}", ffmpegexe, arguments);
ProcessStartInfo processStartInfo = new ProcessStartInfo(ffmpegexe, arguments);
processStartInfo.CreateNoWindow = false; processStartInfo.CreateNoWindow = false;
processStartInfo.RedirectStandardOutput = false; processStartInfo.RedirectStandardOutput = false;
processStartInfo.UseShellExecute = false; processStartInfo.UseShellExecute = false;