Add project files.
This commit is contained in:
39
ClipForge/EncoderService.cs
Normal file
39
ClipForge/EncoderService.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user