CropTextureInput

class VideoKit.Inputs.CropTextureInput : TextureInput

The CropTextureInput class provides a simple primitive for recording video frames from Texture objects while cropping the frame so that only a region of interest is encoded to the output 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 crop texture input.
/// </summary>
/// <param name="recorder">Media recorder to receive watermarked frames.</param>
CropTextureInput (IMediaRecorder recorder);

The crop texture input can be created to send cropped frames to an IMediaRecorder.

With a Texture Input

/// <summary>
/// Create a crop texture input.
/// </summary>
/// <param name="input">Texture input to receive cropped frames.</param>
CropTextureInput (TextureInput input);

The crop texture input can be created to send cropped 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 Crop Rectangle

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

The crop rectangle is specified by the rect field.

The rect is always initialized to the frame size of the recorder, thereby corresponding to no cropping.

The crop texture input always performs aspect filling when the crop rectangle does not have the same aspect ratio as the recorder frame size.

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