WatermarkTextureInput

class VideoKit.Inputs.WatermarkTextureInput : TextureInput

The WatermarkTextureInput class provides a simple primitive for recording video frames from Texture objects while applying a watermark image to the recording.

Creating the Texture Input

The crop texture input can be created with a recorder or a backing texture input:

With a Media Recorder

/// <summary>
/// Create a watermark texture input.
/// </summary>
/// <param name="recorder">Media recorder to receive watermarked frames.</param>
WatermarkTextureInput (IMediaRecorder recorder);

The watermark texture input can be created to send watermarked frames to an IMediaRecorder.

With a Texture Input

/// <summary>
/// Create a watermark texture input.
/// </summary>
/// <param name="input">Texture input to receive watermarked frames.</param>
WatermarkTextureInput (TextureInput input);

The crop texture input can be created to send watermarked frames to a TextureInput. This is useful when chaining multiple texture inputs.

Inspecting the Frame Size

/// <summary>
/// Texture input frame size.
/// </summary>
(int width, int height) frameSize { get; }

Refer to the Inspecting the Frame Size section of the TextureInput class for more information.

Specifying the Watermark Image

/// <summary>
/// Watermark image.
/// If `null`, no watermark will be rendered.
/// </summary>
Texture watermark { get; set; }

The watermark can be any Texture object. If it is null, then no watermark is rendered.

Specifying the Watermark Rectangle

/// <summary>
/// Watermark display rect in pixel coordinates of the recorder.
/// </summary>
RectInt rect { get; set; }

The watermark position and size are specified by the rect field. The rect is always initialized to the frame size of the recorder, thereby filling the screen with the watermark.

Committing Video Frames

/// <summary>
/// Commit a video frame from a texture.
/// </summary>
/// <param name="texture">Source texture.</param>
/// <param name="timestamp">Frame timestamp in nanoseconds.</param>
void CommitFrame (Texture texture, long timestamp);

Refer to the Committing Video Frames section of the TextureInput class for more information.

Disposing the Recorder Input

/// <summary>
/// Stop recorder input and release resources.
/// </summary>
void Dispose ();

Refer to the Disposing the Recorder Input section of the TextureInput class for more information.

Last updated