TextureSource
namespace VideoKit.Sources {
/// <summary>
/// Media source for generating pixel buffers from textures.
/// </summary>
class TextureSource : IDisposable { ... }
}
INCOMPLETE
Creating a Texture Source
INCOMPLETE
With a Media Recorder
/// <summary>
/// Create a texture source.
/// </summary>
/// <param name="recorder">Media recorder to receive images.</param>
/// <param name="clock">Clock for generating image timestamps.</param>
TextureSource (
MediaRecorder recorder,
IClock? clock = null
);
INCOMPLETE
With a Pixel Buffer Handler
/// <summary>
/// Create a texture source.
/// </summary>
/// <param name="width">Image width.</param>
/// <param name="height">Image height.</param>
/// <param name="handler">Handler to receive images.</param>
/// <param name="clock">Clock for generating image timestamps.</param>
TextureSource (
int width,
int height,
Action<PixelBuffer> handler,
IClock? clock = null
);
INCOMPLETE
Generating Pixel Buffers
INCOMPLETE
Automatically from a Texture
/// <summary>
/// Texture to automatically capture images from.
/// When this is set, the source will generate images in the application update loop.
/// To manually capture images, set this to `null` and use the `Append` method.
/// </summary>
Texture? texture { get; set; }
INCOMPLETE
Manually by Appending Frames
/// <summary>
/// Append a pixel buffer from a texture.
/// </summary>
/// <param name="texture">Texture to readback from.</param>
/// <param name="timestamp">Pixel buffer timestamp in nanoseconds.</param>
void Append (
Texture texture,
long timestamp = 0L
);
INCOMPLETE
Skipping Successive Frames
/// <summary>
/// Control number of successive frames to skip while recording.
/// This is very useful for GIF recording, which typically has a lower framerate appearance.
/// </summary>
int frameSkip { get; set; } = 0;
INCOMPLETE
Adding a Watermark
INCOMPLETE
Specifying the Watermark Texture
/// <summary>
/// Watermark image.
/// If `null`, no watermark will be rendered.
/// </summary>
Texture? watermark { get; set; }
INCOMPLETE
Specifying the Watermark Rect
/// <summary>
/// Watermark display rect in pixel coordinates.
/// </summary>
RectInt watermarkRect { get; set; }
INCOMPLETE
Capturing a Region of Interest
/// <summary>
/// Region of interest to capture in pixel coordinates.
/// </summary>
RectInt regionOfInterest { get; set; }
INCOMPLETE
Disposing the Source
/// <summary>
/// Stop the texture source and release resources.
/// </summary>
void Dispose ();
INCOMPLETE