[file-diet] Split FfmpegVideoRecorder into focused partial files#9465
Draft
Copilot wants to merge 2 commits into
Draft
[file-diet] Split FfmpegVideoRecorder into focused partial files#9465Copilot wants to merge 2 commits into
FfmpegVideoRecorder into focused partial files#9465Copilot wants to merge 2 commits into
Conversation
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor FfmpegVideoRecorder.cs into smaller files
[file-diet] Split Jun 26, 2026
FfmpegVideoRecorder into focused partial files
Comment on lines
+130
to
+131
| { | ||
| } |
Comment on lines
+154
to
+155
| { | ||
| } |
Comment on lines
+40
to
+55
| foreach (string line in lines) | ||
| { | ||
| string[] parts = line.Split(','); | ||
| if (parts.Length < 3 | ||
| || !double.TryParse(parts[1], NumberStyles.Float, CultureInfo.InvariantCulture, out double start) | ||
| || !double.TryParse(parts[2], NumberStyles.Float, CultureInfo.InvariantCulture, out double end)) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| string path = Path.IsPathRooted(parts[0]) ? parts[0] : Path.Combine(directory, parts[0]); | ||
| if (File.Exists(path) && new FileInfo(path).Length > 0) | ||
| { | ||
| segments.Add(new VideoSegment(path, start, end)); | ||
| } | ||
| } |
| public static readonly IntPtr DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = new(-4); | ||
|
|
||
| [DllImport("kernel32.dll")] | ||
| public static extern IntPtr GetConsoleWindow(); |
| public static extern IntPtr GetConsoleWindow(); | ||
|
|
||
| [DllImport("user32.dll")] | ||
| public static extern IntPtr GetForegroundWindow(); |
| public static extern IntPtr GetForegroundWindow(); | ||
|
|
||
| [DllImport("user32.dll")] | ||
| public static extern int GetSystemMetrics(int nIndex); |
| public static extern int GetSystemMetrics(int nIndex); | ||
|
|
||
| [DllImport("user32.dll")] | ||
| public static extern IntPtr SetThreadDpiAwarenessContext(IntPtr dpiContext); |
|
|
||
| [DllImport("user32.dll")] | ||
| [return: MarshalAs(UnmanagedType.Bool)] | ||
| public static extern bool IsWindowVisible(IntPtr hWnd); |
|
|
||
| [DllImport("user32.dll", SetLastError = true)] | ||
| [return: MarshalAs(UnmanagedType.Bool)] | ||
| public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect); |
| IntPtr previousDpiContext = TrySetPerMonitorDpiAwareThread(); | ||
| try | ||
| { | ||
| int screenWidth = NativeMethods.GetSystemMetrics(NativeMethods.SM_CXSCREEN); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FfmpegVideoRecorder.cshad grown to 723 lines, mixing lifecycle orchestration, ffmpeg process handling, and Windows window-capture interop. This change refactors the type into focused files with partial classes while preserving behavior and internal API usage.File-diet refactor
VideoSegmentintoVideoSegment.csas a standalone data model.FfmpegVideoRecordertopartialand split concerns across files.Lifecycle/API surface kept in main file
FfmpegVideoRecorder.csnow holds core fields/properties and lifecycle orchestration (Start,StopAsync,PruneSegments,ConcatAsync).Process management extracted
FfmpegVideoRecorder.ProcessManagement.csfor ffmpeg invocation/output handling and argument construction:RunFfmpegAsync,WaitForExitAsync,TryKill,DetachAndDispose,OnFfmpegOutput,ClearRecentFfmpegOutput,FindFfmpeg,BuildSegmentArguments,BuildDefaultInputWindows capture/interop isolated
FfmpegVideoRecorder.WindowCapture.csfor DPI-aware window region detection and P/Invoke:TryGetCurrentProcessWindowRegion,TrySetPerMonitorDpiAwareThread,EnumerateCandidateWindows, nestedNativeMethods