Struct SDPAudioVideoMediaFormat
Represents a single media format within a media announcement. Often the whole media format can
be represented and described by a single character, e.g. "0" without additional info represents
standard "PCMU", "8" represents "PCMA" etc. For other media types that have variable parameters
additional attributes can be provided.
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: SIPSorcery.dll
public struct SDPAudioVideoMediaFormat
Constructors
|
Improve this Doc
View Source
Creates a new SDP media format for a dynamic media type. Dynamic media types are those that use
ID's between 96 and 127 inclusive and require an rtpmap attribute and optionally an fmtp attribute.
Declaration
public SDPAudioVideoMediaFormat(SDPMediaTypesEnum kind, int id, string name, int clockRate, int channels = 1, string fmtp = null)
Parameters
Type |
Name |
Description |
SDPMediaTypesEnum |
kind |
|
System.Int32 |
id |
|
System.String |
name |
|
System.Int32 |
clockRate |
|
System.Int32 |
channels |
|
System.String |
fmtp |
|
|
Improve this Doc
View Source
Creates a new SDP media format for a dynamic media type. Dynamic media types are those that use
ID's between 96 and 127 inclusive and require an rtpmap attribute and optionally an fmtp attribute.
Declaration
public SDPAudioVideoMediaFormat(SDPMediaTypesEnum kind, int id, string rtpmap, string fmtp = null)
Parameters
Type |
Name |
Description |
SDPMediaTypesEnum |
kind |
|
System.Int32 |
id |
|
System.String |
rtpmap |
|
System.String |
fmtp |
|
|
Improve this Doc
View Source
Creates a new SDP media format from a Audio Format instance. The Audio Format contains the
equivalent information to the SDP format object but has well defined audio properties separate
from the SDP serialisation.
Declaration
public SDPAudioVideoMediaFormat(AudioFormat audioFormat)
Parameters
Type |
Name |
Description |
SIPSorceryMedia.Abstractions.AudioFormat |
audioFormat |
The Audio Format to map to an SDP format.
|
|
Improve this Doc
View Source
Creates a new SDP media format for a well known media type. Well known type are those that use
ID's less than 96 and don't require rtpmap or fmtp attributes.
Declaration
public SDPAudioVideoMediaFormat(SDPWellKnownMediaFormatsEnum knownFormat)
Parameters
Type |
Name |
Description |
SIPSorceryMedia.Abstractions.SDPWellKnownMediaFormatsEnum |
knownFormat |
|
|
Improve this Doc
View Source
Creates a new SDP media format from a Video Format instance. The Video Format contains the
equivalent information to the SDP format object but has well defined video properties separate
from the SDP serialisation.
Declaration
public SDPAudioVideoMediaFormat(VideoFormat videoFormat)
Parameters
Type |
Name |
Description |
SIPSorceryMedia.Abstractions.VideoFormat |
videoFormat |
The Video Format to map to an SDP format.
|
Fields
|
Improve this Doc
View Source
Declaration
public const int DEFAULT_AUDIO_CHANNEL_COUNT = 1
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public const int DYNAMIC_ID_MAX = 127
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public const int DYNAMIC_ID_MIN = 96
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
public static SDPAudioVideoMediaFormat Empty
Field Value
Properties
|
Improve this Doc
View Source
The optional format parameter attribute for the media format. For standard media types this is not necessary.
// Example
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16 ← "101 0-16" is the fmtp attribute.
Declaration
public readonly string Fmtp { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
The mandatory ID for the media format. Warning, even though some ID's are normally used to represent
a standard media type, e.g "0" for "PCMU" etc, there is no guarantee that's the case. "0" can be used
for any media format if there is a format attribute describing it. In the absence of a format attribute
then it is required that it represents a standard media type.
Note (rj2): FormatID MUST be string (not int), in case ID is 't38' and type is 'image'
Note to above: The FormatID is always numeric for profile "RTP/AVP" and "RTP/SAVP", see
https://tools.ietf.org/html/rfc4566#section-5.14 and section on "fmt":
"If the [proto] sub-field is "RTP/AVP" or "RTP/SAVP" the [fmt]
sub-fields contain RTP payload type numbers"
In the case of T38 the format name is "t38" but the formatID must be set as a dynamic ID.
// Example
// Note in this example "0" is representing a standard format so the format attribute is optional.
m=audio 12228 RTP/AVP 0 101 // "0" and "101" are media format ID's.
a=rtpmap:0 PCMU/8000 // "0" is the media format ID.
a=rtpmap:101 telephone-event/8000 // "101" is the media format ID.
a=fmtp:101 0-16
// t38 example from https://tools.ietf.org/html/rfc4612.
m=audio 6800 RTP/AVP 0 98
a=rtpmap:98 t38/8000
a=fmtp:98 T38FaxVersion=2;T38FaxRateManagement=transferredTCF
Declaration
public readonly int ID { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Indicates whether the format is for audio or video.
Declaration
public readonly SDPMediaTypesEnum Kind { get; }
Property Value
|
Improve this Doc
View Source
The optional rtpmap attribute properties for the media format. For standard media types this is not necessary.
// Example
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000 ← "101 telephone-event/8000" is the rtpmap properties.
a=fmtp:101 0-16
Declaration
public readonly string Rtpmap { get; }
Property Value
Type |
Description |
System.String |
|
Methods
|
Improve this Doc
View Source
For two formats to be a match only the codec and rtpmap parameters need to match. The
fmtp parameter does not matter.
Declaration
public static bool AreMatch(SDPAudioVideoMediaFormat format1, SDPAudioVideoMediaFormat format2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Declaration
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Declaration
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Attempts to get a common SDP media format that supports telephone events.
If compatible an RTP event format will be returned that matches the local format with the remote format.
Declaration
public static SDPAudioVideoMediaFormat GetCommonRtpEventFormat(List<SDPAudioVideoMediaFormat> a, List<SDPAudioVideoMediaFormat> b)
Parameters
Returns
|
Improve this Doc
View Source
Attempts to get the compatible formats between two lists. Formats for
"RTP Events" are not included.
Declaration
public static List<SDPAudioVideoMediaFormat> GetCompatibleFormats(List<SDPAudioVideoMediaFormat> a, List<SDPAudioVideoMediaFormat> b)
Parameters
Returns
Type |
Description |
System.Collections.Generic.List<SDPAudioVideoMediaFormat> |
A list of media formats that are compatible for BOTH lists.
|
|
Improve this Doc
View Source
Declaration
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Declaration
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Sort capabilities array based on another capability array
Declaration
public static void SortMediaCapability(List<SDPAudioVideoMediaFormat> capabilities, List<SDPAudioVideoMediaFormat> priorityOrder)
Parameters
|
Improve this Doc
View Source
Maps an audio SDP media type to a media abstraction layer audio format.
Declaration
public AudioFormat ToAudioFormat()
Returns
Type |
Description |
SIPSorceryMedia.Abstractions.AudioFormat |
An audio format value.
|
|
Improve this Doc
View Source
Maps a video SDP media type to a media abstraction layer video format.
Declaration
public VideoFormat ToVideoFormat()
Returns
Type |
Description |
SIPSorceryMedia.Abstractions.VideoFormat |
A video format value.
|
|
Improve this Doc
View Source
Parses an rtpmap attribute in the form "name/clock" or "name/clock/channels".
Declaration
public static bool TryParseRtpmap(string rtpmap, out string name, out int clockRate, out int channels)
Parameters
Type |
Name |
Description |
System.String |
rtpmap |
|
System.String |
name |
|
System.Int32 |
clockRate |
|
System.Int32 |
channels |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Declaration
public SDPAudioVideoMediaFormat WithUpdatedFmtp(string fmtp)
Parameters
Type |
Name |
Description |
System.String |
fmtp |
|
Returns
|
Improve this Doc
View Source
Creates a new media format based on an existing format but with a different ID.
The typical case for this is during the SDP offer/answer exchange the dynamic format ID's for the
equivalent type need to be adjusted by one party.
Declaration
public SDPAudioVideoMediaFormat WithUpdatedID(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
The ID to set on the new format.
|
Returns
|
Improve this Doc
View Source
Declaration
public SDPAudioVideoMediaFormat WithUpdatedRtpmap(string rtpmap)
Parameters
Type |
Name |
Description |
System.String |
rtpmap |
|
Returns
Extension Methods