Files
gramps 8f490102ee TASK 21 Increment B: FFmpeg rawvideo video decoder -> VideoFrame
Adds the codec-agnostic decoder half of the media source. Spawns ffmpeg
with -f rawvideo -pix_fmt bgra (reusing the already-shipped ffmpeg via
IFfmpegLocator) and drains the raw BGRA stdout pipe into VideoFrames.

- Services/RawVideoFrameReader.cs: pure rawvideo BGRA stream -> frames
  (partial reads kept across Feed; no ffmpeg needed to test)
- Services/IDecodeProcess.cs + FfmpegDecodeProcess.cs: binary-stdout
  subprocess seam, mirror of the encoder's IEncoderProcess
- Services/MediaVideoSource.cs: owns the decode, raises FrameReady/Completed
- MediaVideoSourceTests: 3 pure reader + 1 integration (fake decode
  process through the real source loop, frames in order)

Reference (external scan): ffmpeg rawvideo pipe decode is the canonical
codec-agnostic frame feeds pattern (ffmpeg docs -f rawvideo; how OBS/media
pipelines push frames to a compositor). Verified: 4/4 tests, build 0 warnings.
Native-FPS pacing + resolver/compositor wiring are the next slice.
2026-08-31 18:57:29 -07:00

25 lines
840 B
C#

using System.Diagnostics;
using System.IO;
namespace ytLive.Services;
/// <summary>
/// TASK 21: seam around the media decoder's subprocess (ffmpeg <c>rawvideo</c>).
/// Exposes the raw binary stdout (frames) and exit control, so
/// <see cref="MediaVideoSource"/> never touches <c>System.Diagnostics.Process</c>
/// directly and tests can fake the whole decode. Mirrors the encoder's
/// <c>IEncoderProcess</c> but with a binary <see cref="StandardOutput"/>.
/// </summary>
public interface IDecodeProcess : IDisposable
{
void Start(ProcessStartInfo startInfo);
/// <summary>Raw binary stdout — the <c>rawvideo</c> BGRA frame bytes.</summary>
Stream StandardOutput { get; }
bool HasExited { get; }
int ExitCode { get; }
void Kill();
Task WaitForExitAsync(CancellationToken cancellationToken = default);
}