Files
clipforge/ClipForge/EncoderService.cs
Blade / SCOPEDD c1a425a7ad Add project files.
2026-02-22 11:31:35 -05:00

39 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Windows.Graphics.Capture;
using Windows.Graphics.DirectX.Direct3D11;
namespace ClipForge
{
public class EncoderService
{
private string _ffmpegPath;
public EncoderService()
{
// FFmpeg binary will sit next to our app executable
_ffmpegPath = Path.Combine(
AppContext.BaseDirectory, "ffmpeg.exe");
}
public async Task SaveClipAsync(
List<Direct3D11CaptureFrame> frames,
string outputPath)
{
if (frames == null || frames.Count == 0) return;
// Create the output directory if it doesn't exist
var directory = Path.GetDirectoryName(outputPath);
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory!);
// For now we'll save a placeholder file confirming
// the frame count — full encoding comes next session
await File.WriteAllTextAsync(outputPath,
$"Clip captured: {frames.Count} frames at {DateTime.Now}");
}
}
}