Class VideoFormat
A video format.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class VideoFormat : MediaFormat<VideoFormat>
Constructors
VideoFormat()
Initializes a new instance of the VideoFormat class.
Declaration
protected VideoFormat()
VideoFormat(String)
Initializes a new instance of the VideoFormat class.
Declaration
public VideoFormat(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
VideoFormat(String, Int32)
Initializes a new instance of the VideoFormat class.
Declaration
public VideoFormat(string name, int clockRate)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.Int32 | clockRate | The clock rate. |
VideoFormat(String, Int32, String)
Initializes a new instance of the VideoFormat class.
Declaration
public VideoFormat(string name, int clockRate, string packetizationMode)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.Int32 | clockRate | The clock rate. |
System.String | packetizationMode | The packetization mode. |
VideoFormat(String, Int32, String, String)
Initializes a new instance of the VideoFormat class.
Declaration
public VideoFormat(string name, int clockRate, string profile, string level)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.Int32 | clockRate | The clock rate. |
System.String | profile | The media format profile. |
System.String | level | The media format level. |
VideoFormat(String, Int32, String, String, String)
Initializes a new instance of the VideoFormat class.
Declaration
public VideoFormat(string name, int clockRate, string profile, string level, string packetizationMode)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.Int32 | clockRate | The clock rate. |
System.String | profile | The media format profile. |
System.String | level | The media format level. |
System.String | packetizationMode | The packetization mode. |
VideoFormat(String, Int32, String, String, String, String)
Initializes a new instance of the VideoFormat class.
Declaration
public VideoFormat(string name, int clockRate, string profile, string level, string packetizationMode, string tier)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.Int32 | clockRate | The clock rate. |
System.String | profile | The media format profile. |
System.String | level | The media format level. |
System.String | packetizationMode | The packetization mode. |
System.String | tier | The media format tier. |
Properties
Abgr
Gets an ABGR video format.
Declaration
public static VideoFormat Abgr { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
AbgrName
Gets the name of the ABGR video format ("ABGR"). Indicates that each pixel occupies 32 bits (8 bits for alpha, then 8 bits for blue, then8 bits for green, then 8 bits for red).
Declaration
public static string AbgrName { get; }
Property Value
Type | Description |
---|---|
System.String |
Argb
Gets an ARGB video format.
Declaration
public static VideoFormat Argb { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
ArgbName
Gets the name of the ARGB video format ("ARGB"). Indicates that each pixel occupies 32 bits (8 bits for alpha, then 8 bits for red, then 8 bits for green, then 8 bits for blue).
Declaration
public static string ArgbName { get; }
Property Value
Type | Description |
---|---|
System.String |
Bgr
Gets a BGR video format.
Declaration
public static VideoFormat Bgr { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Bgra
Gets an BGRA video format.
Declaration
public static VideoFormat Bgra { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
BgraName
Gets the name of the BGRA video format ("BGRA"). Indicates that each pixel occupies 32 bits (8 bits for blue, then8 bits for green, then 8 bits for red, then 8 bits for alpha).
Declaration
public static string BgraName { get; }
Property Value
Type | Description |
---|---|
System.String |
BgrName
Gets the name of the BGR video format ("BGR"). Indicates that each pixel occupies 24 bits (8 bits for blue, then8 bits for green, then 8 bits for red).
Declaration
public static string BgrName { get; }
Property Value
Type | Description |
---|---|
System.String |
DefaultClockRate
Gets the default clock rate.
Declaration
public static int DefaultClockRate { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FourCC
Gets or sets the FourCC value for this format.
Declaration
public int FourCC { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
H264
Gets an H.264 video format.
Declaration
public static VideoFormat H264 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
H264Name
Gets the name of the H.264 video format ("H264").
Declaration
public static string H264Name { get; }
Property Value
Type | Description |
---|---|
System.String |
H265
Gets an H.265 video format.
Declaration
public static VideoFormat H265 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
H265Name
Gets the name of the H.265 video format ("H265").
Declaration
public static string H265Name { get; }
Property Value
Type | Description |
---|---|
System.String |
I420
Gets an I420 video format.
Declaration
public static VideoFormat I420 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
I420Name
Gets the name of the I420 video format ("I420"). Indicates that each pixel occupies 12 bits (8 bits for Y, 2 bits for U, and 2 bits for V). Y plane is followed by U plane and then V plane.
Declaration
public static string I420Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Info
Gets this format as an info object.
Declaration
public override FormatInfo Info { get; }
Property Value
Type | Description |
---|---|
FormatInfo |
Overrides
IsAbgr
Gets a value indicating whether this format is ABGR.
Declaration
public bool IsAbgr { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsArgb
Gets a value indicating whether this format is ARGB.
Declaration
public bool IsArgb { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsBgr
Gets a value indicating whether this format is BGR.
Declaration
public bool IsBgr { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsBgra
Gets a value indicating whether this format is BGRA.
Declaration
public bool IsBgra { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsCompressed
Gets whether this is a compressed format.
Declaration
public override bool IsCompressed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsH264
Gets a value indicating whether this format is H.264.
Declaration
public bool IsH264 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsH265
Gets a value indicating whether this format is H.265.
Declaration
public bool IsH265 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsI420
Gets a value indicating whether this format is I420.
Declaration
public bool IsI420 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNv12
Gets a value indicating whether this format is NV12.
Declaration
public bool IsNv12 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNv21
Gets a value indicating whether this format is NV21.
Declaration
public bool IsNv21 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRaw
Gets a value indicating whether this format is RGB, BGR, I420, YV12, NV12, NV21, RGBA, BGRA, ARGB, or ABGR.
Declaration
public bool IsRaw { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgb
Gets a value indicating whether this format is RGB.
Declaration
public bool IsRgb { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgba
Gets a value indicating whether this format is RGBA.
Declaration
public bool IsRgba { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgbaType
Gets a value indicating whether this format is RGBA, BGRA, ARGB, or ABGR.
Declaration
public bool IsRgbaType { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRgbType
Gets a value indicating whether this format is RGB or BGR.
Declaration
public bool IsRgbType { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVp8
Gets a value indicating whether this format is VP8.
Declaration
public bool IsVp8 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVp9
Gets a value indicating whether this format is VP9.
Declaration
public bool IsVp9 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsYuvType
Gets a value indicating whether this format is I420, YV12, NV12, or NV21.
Declaration
public bool IsYuvType { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsYv12
Gets a value indicating whether this format is YV12.
Declaration
public bool IsYv12 { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Nv12
Gets an NV12 video format.
Declaration
public static VideoFormat Nv12 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Nv12Name
Gets the name of the NV12 video format ("NV12"). Indicates that each pixel occupies 12 bits (8 bits for Y, 2 bits for U, and 2 bits for V). Y plane is followed by interleaved U/V plane.
Declaration
public static string Nv12Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Nv21
Gets an NV21 video format.
Declaration
public static VideoFormat Nv21 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Nv21Name
Gets the name of the NV21 video format ("NV21"). Indicates that each pixel occupies 12 bits (8 bits for Y, 2 bits for U, and 2 bits for V). Y plane is followed by interleaved V/U plane.
Declaration
public static string Nv21Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Parameters
Gets the parameters.
Declaration
public override string Parameters { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Rgb
Gets an RGB video format.
Declaration
public static VideoFormat Rgb { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Rgba
Gets an RGBA video format.
Declaration
public static VideoFormat Rgba { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
RgbaName
Gets the name of the RGBA video format ("RGBA"). Indicates that each pixel occupies 32 bits (8 bits for red, then 8 bits for green, then 8 bits for blue, then 8 bits for alpha).
Declaration
public static string RgbaName { get; }
Property Value
Type | Description |
---|---|
System.String |
RgbName
Gets the name of the RGB video format ("RGB"). Indicates that each pixel occupies 24 bits (8 bits for red, then 8 bits for green, then 8 bits for blue).
Declaration
public static string RgbName { get; }
Property Value
Type | Description |
---|---|
System.String |
Vp8
Gets a VP8 video format.
Declaration
public static VideoFormat Vp8 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Vp8Name
Gets the name of the VP8 video format ("VP8").
Declaration
public static string Vp8Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Vp9
Gets a VP9 video format.
Declaration
public static VideoFormat Vp9 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Vp9Name
Gets the name of the VP9 video format ("VP9").
Declaration
public static string Vp9Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Yv12
Gets a YV12 video format.
Declaration
public static VideoFormat Yv12 { get; }
Property Value
Type | Description |
---|---|
VideoFormat |
Yv12Name
Gets the name of the YV12 video format ("YV12"). Indicates that each pixel occupies 12 bits (8 bits for Y, 2 bits for U, and 2 bits for V). Y plane is followed by V plane and then U plane.
Declaration
public static string Yv12Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Clone()
Clones this instance.
Declaration
public override VideoFormat Clone()
Returns
Type | Description |
---|---|
VideoFormat |
Overrides
CreateInstance()
Creates a new instance.
Declaration
protected override VideoFormat CreateInstance()
Returns
Type | Description |
---|---|
VideoFormat |
Overrides
FormatNameToFourCC(String)
Converts a format name to its FourCC value.
Declaration
public static int FormatNameToFourCC(string formatName)
Parameters
Type | Name | Description |
---|---|---|
System.String | formatName | The format name. |
Returns
Type | Description |
---|---|
System.Int32 | The FourCC value, or 0 if the format name is not recognized. |
FourCCToFormatName(Int32)
Converts a FourCC value to its format name.
Declaration
public string FourCCToFormatName(int fourcc)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | fourcc | The FourCC value. |
Returns
Type | Description |
---|---|
System.String | The format name, or an empty string if the FourCC value is not recognized. |
FromFormatInfo(FormatInfo)
Transforms a FormatInfo into an VideoFormat.
Declaration
public static VideoFormat FromFormatInfo(FormatInfo info)
Parameters
Type | Name | Description |
---|---|---|
FormatInfo | info | The format info. |
Returns
Type | Description |
---|---|
VideoFormat |
FromJson(String)
Deserializes an instance from JSON.
Declaration
public static VideoFormat FromJson(string videoFormatJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | videoFormatJson | The video format JSON. |
Returns
Type | Description |
---|---|
VideoFormat |
GetMaxLevel(String, String)
Gets the maximum level.
Declaration
protected override string GetMaxLevel(string level1, string level2)
Parameters
Type | Name | Description |
---|---|---|
System.String | level1 | The first level. |
System.String | level2 | The second level. |
Returns
Type | Description |
---|---|
System.String | The maximum level. |
Overrides
GetMinLevel(String, String)
Gets the minimum level.
Declaration
protected override string GetMinLevel(string level1, string level2)
Parameters
Type | Name | Description |
---|---|---|
System.String | level1 | The first level. |
System.String | level2 | The second level. |
Returns
Type | Description |
---|---|
System.String | The minimum level. |
Overrides
IsLevelCompatible(String)
Gets whether a level is compatible.
Declaration
protected override bool IsLevelCompatible(string level)
Parameters
Type | Name | Description |
---|---|---|
System.String | level | The level. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
IsProfileCompatible(String)
Gets whether a profile is compatible.
Declaration
protected override bool IsProfileCompatible(string profile)
Parameters
Type | Name | Description |
---|---|---|
System.String | profile | The profile. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
ToFourCC(Char, Char, Char, Char)
Converts 4 FourCC characters to an int.
Declaration
public static int ToFourCC(char a, char b, char c, char d)
Parameters
Type | Name | Description |
---|---|---|
System.Char | a | |
System.Char | b | |
System.Char | c | |
System.Char | d |
Returns
Type | Description |
---|---|
System.Int32 |
ToFourCC(String)
Converts a FourCC string to a int.
Declaration
public static int ToFourCC(string fourcc)
Parameters
Type | Name | Description |
---|---|---|
System.String | fourcc | The fourcc. |
Returns
Type | Description |
---|---|
System.Int32 |
ToJson()
Serializes this instance to JSON.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System.String |
ToJson(VideoFormat)
Serializes an instance to JSON.
Declaration
public static string ToJson(VideoFormat videoFormat)
Parameters
Type | Name | Description |
---|---|---|
VideoFormat | videoFormat | The video format. |
Returns
Type | Description |
---|---|
System.String |
UpdateProfileToCompatible(VideoFormat)
Updates the profile to a compatible value.
Declaration
protected override void UpdateProfileToCompatible(VideoFormat format)
Parameters
Type | Name | Description |
---|---|---|
VideoFormat | format | The format. |