Class VideoBuffer
A video buffer.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class VideoBuffer : MediaBuffer<VideoFormat, VideoBuffer>, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable
Constructors
VideoBuffer()
Initializes a new instance of the VideoBuffer class.
Declaration
protected VideoBuffer()
VideoBuffer(Int32, Int32, DataBuffer, VideoFormat)
Initializes a new instance of the VideoBuffer class.
Declaration
public VideoBuffer(int width, int height, DataBuffer dataBuffer, VideoFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
DataBuffer | dataBuffer | The data buffer. |
VideoFormat | format | The format. |
VideoBuffer(Int32, Int32, DataBuffer[], VideoFormat)
Initializes a new instance of the VideoBuffer class.
Declaration
public VideoBuffer(int width, int height, DataBuffer[] dataBuffers, VideoFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
DataBuffer[] | dataBuffers | The data buffers. |
VideoFormat | format | The format. |
VideoBuffer(Int32, Int32, Int32, DataBuffer, VideoFormat)
Initializes a new instance of the VideoBuffer class.
Declaration
public VideoBuffer(int width, int height, int stride, DataBuffer dataBuffer, VideoFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.Int32 | stride | The stride. |
DataBuffer | dataBuffer | The data buffer. |
VideoFormat | format | The format. |
VideoBuffer(Int32, Int32, Int32[], DataBuffer[], VideoFormat)
Initializes a new instance of the VideoBuffer class.
Declaration
public VideoBuffer(int width, int height, int[] strides, DataBuffer[] dataBuffers, VideoFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.Int32[] | strides | The strides. |
DataBuffer[] | dataBuffers | The data buffers. |
VideoFormat | format | The format. |
Properties
Height
Gets or sets the height.
Declaration
public int Height { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
HorizontallyMirrored
Gets or sets whether this buffer should be mirrored over the X axis.
Declaration
public bool HorizontallyMirrored { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
InversionRequired
Gets whether inversion is required to reset the mirroring of this buffer.
Declaration
public bool InversionRequired { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsAbgr
Gets a value indicating whether this buffer has ABGR video.
Declaration
public bool IsAbgr { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsArgb
Gets a value indicating whether this buffer has ARGB video.
Declaration
public bool IsArgb { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsBgr
Gets a value indicating whether this buffer has BGR video.
Declaration
public bool IsBgr { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsBgra
Gets a value indicating whether this buffer has BGRA video.
Declaration
public bool IsBgra { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsH264
Gets a value indicating whether this buffer has H.264 video.
Declaration
public bool IsH264 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsH265
Gets a value indicating whether this buffer has H.265 video.
Declaration
public bool IsH265 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsI420
Gets a value indicating whether this buffer has I420 video.
Declaration
public bool IsI420 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsKeyFrame
Gets a value indicating whether this buffer contains a keyframe.
Declaration
public virtual bool IsKeyFrame { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsMuted
Gets a value indicating whether this instance has been muted.
Declaration
public override bool IsMuted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsNv12
Gets a value indicating whether this buffer has NV12 video.
Declaration
public bool IsNv12 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNv21
Gets a value indicating whether this buffer has NV21 video.
Declaration
public bool IsNv21 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPacked
Gets a value indicating whether the data is packed into a single data buffer.
Declaration
public bool IsPacked { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPlanar
Gets a value indicating whether the data is spread across multiple data buffers (planes).
Declaration
public bool IsPlanar { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRaw
Gets a value indicating whether this buffer has raw video.
Declaration
public bool IsRaw { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgb
Gets a value indicating whether this buffer has RGB video.
Declaration
public bool IsRgb { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgba
Gets a value indicating whether this buffer has RGBA video.
Declaration
public bool IsRgba { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgbaType
Gets a value indicating whether this buffer has raw RGBA, BGRA, ARGB, or ABGR video.
Declaration
public bool IsRgbaType { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgbType
Gets a value indicating whether this buffer has raw RGB or BGR video.
Declaration
public bool IsRgbType { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVp8
Gets a value indicating whether this buffer has VP8 video.
Declaration
public bool IsVp8 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVp9
Gets a value indicating whether this buffer has VP9 video.
Declaration
public bool IsVp9 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsYuvType
Gets a value indicating whether this buffer has raw I420, YV12, NV12, or NV21 video.
Declaration
public bool IsYuvType { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsYv12
Gets a value indicating whether this buffer has YV12 video.
Declaration
public bool IsYv12 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Orientation
Gets or sets the desired orientation of the buffer.
Declaration
public int Orientation { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
RotationRequired
Gets whether rotation is required to reset the mirroring and orientation of this buffer.
Declaration
public int RotationRequired { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Stride
Gets or sets the stride.
Declaration
public int Stride { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Strides
Gets or sets the strides.
Declaration
public int[] Strides { get; set; }
Property Value
Type | Description |
---|---|
System.Int32[] |
TransformRequired
Gets a boolean value on whether the buffer needs to be transformed.
Declaration
public bool TransformRequired { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
VerticallyMirrored
Gets or sets whether this buffer should be mirrored over the Y axis.
Declaration
public bool VerticallyMirrored { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Width
Gets or sets the width.
Declaration
public int Width { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clone()
Clones this instance.
Declaration
public override VideoBuffer Clone()
Returns
Type | Description |
---|---|
VideoBuffer |
Overrides
Convert(VideoFormat)
Creates a new video buffer using the specified format.
Declaration
public VideoBuffer Convert(VideoFormat format)
Parameters
Type | Name | Description |
---|---|---|
VideoFormat | format | The format. |
Returns
Type | Description |
---|---|
VideoBuffer |
Convert(VideoFormat, DataBuffer)
Creates a new video buffer using the specified format.
Declaration
public VideoBuffer Convert(VideoFormat format, DataBuffer dataBuffer)
Parameters
Type | Name | Description |
---|---|---|
VideoFormat | format | The format. |
DataBuffer | dataBuffer | The data buffer. |
Returns
Type | Description |
---|---|
VideoBuffer |
Convert(VideoFormat, Boolean)
Creates a new video buffer using the specified format.
Declaration
public VideoBuffer Convert(VideoFormat format, bool usePool)
Parameters
Type | Name | Description |
---|---|---|
VideoFormat | format | The format. |
System.Boolean | usePool | Whether to use the DataBufferPool. |
Returns
Type | Description |
---|---|
VideoBuffer |
CopyTransformationAttributes(VideoBuffer)
Copy the transformation attributes from another video buffer.
Declaration
public void CopyTransformationAttributes(VideoBuffer sourceBuffer)
Parameters
Type | Name | Description |
---|---|---|
VideoBuffer | sourceBuffer |
CreateBlack(Int32, Int32, String)
Creates a black (0, 0, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateBlack(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateBlue(Int32, Int32, String)
Creates a blue (0, 0, 255) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateBlue(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateCustom(Int32, Int32, Int32, Int32, Int32, String)
Creates a custom video buffer with the specified width/height and red/green/blue values for the specified format name. If the format is not supported, returns null.
Declaration
public static VideoBuffer CreateCustom(int width, int height, int red, int green, int blue, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.Int32 | red | The red value. |
System.Int32 | green | The green value. |
System.Int32 | blue | The blue value. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateCustom(Int32, Int32, Int32, Int32, Int32, String, DataBuffer)
Creates a custom video buffer with the specified width/height and red/green/blue values for the specified format name. If the format is not supported, returns null.
Declaration
public static VideoBuffer CreateCustom(int width, int height, int red, int green, int blue, string formatName, DataBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.Int32 | red | The red value. |
System.Int32 | green | The green value. |
System.Int32 | blue | The blue value. |
System.String | formatName | Name of the format. |
DataBuffer | buffer | The output data buffer. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateCyan(Int32, Int32, String)
Creates a cyan (0, 255, 255) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateCyan(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateDarkBlue(Int32, Int32, String)
Creates a dark blue (0, 0, 128) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateDarkBlue(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateDarkGreen(Int32, Int32, String)
Creates a dark green (0, 128, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateDarkGreen(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateDarkRed(Int32, Int32, String)
Creates a dark red (128, 0, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateDarkRed(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateGray(Int32, Int32, String)
Creates a gray (255, 255, 255) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateGray(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateGreen(Int32, Int32, String)
Creates a green (0, 255, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateGreen(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateInstance()
Creates a new instance.
Declaration
protected override VideoBuffer CreateInstance()
Returns
Type | Description |
---|---|
VideoBuffer |
Overrides
CreateMagenta(Int32, Int32, String)
Creates a magenta (255, 0, 255) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateMagenta(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateOlive(Int32, Int32, String)
Creates an olive (128, 128, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateOlive(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreatePurple(Int32, Int32, String)
Creates a purple (128, 0, 128) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreatePurple(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateRed(Int32, Int32, String)
Creates a red (255, 0, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateRed(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateTeal(Int32, Int32, String)
Creates a teal (0, 128, 128) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateTeal(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateWhite(Int32, Int32, String)
Creates a white (255, 255, 255) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateWhite(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
CreateYellow(Int32, Int32, String)
Creates a yellow (255, 255, 0) video buffer with the specified width/height.
Declaration
public static VideoBuffer CreateYellow(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
VideoBuffer |
FromJson(String)
Deserializes an instance from JSON.
Declaration
public static VideoBuffer FromJson(string videoBufferJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | videoBufferJson | The video buffer JSON. |
Returns
Type | Description |
---|---|
VideoBuffer |
FromJsonArray(String)
Deserializes an array of instances from JSON.
Declaration
public static VideoBuffer[] FromJsonArray(string videoBuffersJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | videoBuffersJson | The video buffers JSON. |
Returns
Type | Description |
---|---|
VideoBuffer[] |
GetAValue(Int32)
Gets the A value at a given index. If the video buffer is not RGBA-type, then this will return 255.
Declaration
public int GetAValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The A value. |
GetBValue(Int32)
Gets the B value at a given index.
Declaration
public int GetBValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The B value, or -1 if the video buffer is not RGB/RGBA-type. |
GetGValue(Int32)
Gets the G value at a given index.
Declaration
public int GetGValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The G value, or -1 if the video buffer is not RGB/RGBA-type. |
GetMinimumBufferLength(Int32, Int32, String)
Gets the minimum data buffer length for a given width, height, and format.
Declaration
public static int GetMinimumBufferLength(int width, int height, string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width. |
System.Int32 | height | The height. |
System.String | formatName | Name of the format. |
Returns
Type | Description |
---|---|
System.Int32 |
GetRValue(Int32)
Gets the R value at a given index.
Declaration
public int GetRValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The R value, or -1 if the video buffer is not RGB/RGBA-type. |
GetUValue(Int32)
Gets the U value at a given index.
Declaration
public int GetUValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The U value, or -1 if the video buffer is not YUV-type. |
GetVValue(Int32)
Gets the V value at a given index.
Declaration
public int GetVValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The V value, or -1 if the video buffer is not YUV-type. |
GetYValue(Int32)
Gets the Y value at a given index.
Declaration
public int GetYValue(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Int32 | The Y value, or -1 if the video buffer is not YUV-type. |
Mute()
Mutes this instance. This is a one-way operation that clears the underlying data buffer.
Declaration
public override bool Mute()
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
ResetTransformationAttributes()
Resets the transformation attributes back to default values.
Declaration
public void ResetTransformationAttributes()
SetAValue(Int32, Int32)
Gets the A value at a given index. If the video buffer is not RGBA-type, then this will return false.
Declaration
public bool SetAValue(int aValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | aValue | The A value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetBValue(Int32, Int32)
Gets the B value at a given index.
Declaration
public bool SetBValue(int bValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | bValue | The B value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetGValue(Int32, Int32)
Sets the G value at a given index.
Declaration
public bool SetGValue(int gValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | gValue | The G value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetRValue(Int32, Int32)
Sets the R value at a given index.
Declaration
public bool SetRValue(int rValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rValue | The R value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetUValue(Int32, Int32)
Sets the U value at a given index.
Declaration
public bool SetUValue(int uValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | uValue | The U value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetVValue(Int32, Int32)
Sets the V value at a given index.
Declaration
public bool SetVValue(int vValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | vValue | The V value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetYValue(Int32, Int32)
Sets the Y value at a given index.
Declaration
public bool SetYValue(int yValue, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | yValue | The Y value. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
ToJson()
Serializes this instance to JSON.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System.String |
ToJson(VideoBuffer)
Serializes an instance to JSON.
Declaration
public static string ToJson(VideoBuffer videoBuffer)
Parameters
Type | Name | Description |
---|---|---|
VideoBuffer | videoBuffer | The video buffer. |
Returns
Type | Description |
---|---|
System.String |
ToJsonArray(VideoBuffer[])
Serializes an array of instances to JSON.
Declaration
public static string ToJsonArray(VideoBuffer[] videoBuffers)
Parameters
Type | Name | Description |
---|---|---|
VideoBuffer[] | videoBuffers | The video buffers. |
Returns
Type | Description |
---|---|
System.String |
ToPacked()
Creates a packed representation of this planar buffer, if in YUV-planar format. Otherwise, returns the current buffer. If the planar data is not contiguous in memory, new memory will be allocated for the packed representation.
Declaration
public VideoBuffer ToPacked()
Returns
Type | Description |
---|---|
VideoBuffer |
ToPacked(Boolean)
Creates a packed representation of this planar buffer, if in YUV-planar format. Otherwise, returns the current buffer. If the planar data is not contiguous in memory, new memory will be allocated or taken from the data buffer pool for the packed representation.
Declaration
public VideoBuffer ToPacked(bool usePool)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | usePool | Whether to use the data buffer pool for any required memory allocations. |
Returns
Type | Description |
---|---|
VideoBuffer |
ToPlanar()
Creates a planar representation of this packed buffer, if in YUV-packed format. Otherwise, returns the current buffer.
Declaration
public VideoBuffer ToPlanar()
Returns
Type | Description |
---|---|
VideoBuffer |