Show / Hide Table of Contents

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)
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public struct SDPAudioVideoMediaFormat
Remarks

This struct is designed to be immutable. If new information becomes available for a media format, such as when parsing further into an SDP payload, a new media format should be created. TODO: With C#9 the struct could become a "record" type.

Constructors

| Improve this Doc View Source

SDPAudioVideoMediaFormat(SDPMediaTypesEnum, Int32, String, Int32, Int32, String)

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

SDPAudioVideoMediaFormat(SDPMediaTypesEnum, Int32, String, String)

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

SDPAudioVideoMediaFormat(AudioFormat)

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

SDPAudioVideoMediaFormat(SDPWellKnownMediaFormatsEnum)

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

SDPAudioVideoMediaFormat(VideoFormat)

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

DEFAULT_AUDIO_CHANNEL_COUNT

Declaration
public const int DEFAULT_AUDIO_CHANNEL_COUNT = 1
Field Value
Type Description
System.Int32
| Improve this Doc View Source

DYNAMIC_ID_MAX

Declaration
public const int DYNAMIC_ID_MAX = 127
Field Value
Type Description
System.Int32
| Improve this Doc View Source

DYNAMIC_ID_MIN

Declaration
public const int DYNAMIC_ID_MIN = 96
Field Value
Type Description
System.Int32
| Improve this Doc View Source

Empty

Declaration
public static SDPAudioVideoMediaFormat Empty
Field Value
Type Description
SDPAudioVideoMediaFormat

Properties

| Improve this Doc View Source

Fmtp

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

ID

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

Kind

Indicates whether the format is for audio or video.

Declaration
public readonly SDPMediaTypesEnum Kind { get; }
Property Value
Type Description
SDPMediaTypesEnum
| Improve this Doc View Source

Rtpmap

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

AreMatch(SDPAudioVideoMediaFormat, SDPAudioVideoMediaFormat)

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
Type Name Description
SDPAudioVideoMediaFormat format1
SDPAudioVideoMediaFormat format2
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Channels()

Declaration
public int Channels()
Returns
Type Description
System.Int32
| Improve this Doc View Source

ClockRate()

Declaration
public int ClockRate()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetCommonRtpEventFormat(List<SDPAudioVideoMediaFormat>, List<SDPAudioVideoMediaFormat>)

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
Type Name Description
System.Collections.Generic.List<SDPAudioVideoMediaFormat> a

The first of supported media formats.

System.Collections.Generic.List<SDPAudioVideoMediaFormat> b

The second of supported media formats.

Returns
Type Description
SDPAudioVideoMediaFormat

An SDP media format with a compatible RTP event format.

| Improve this Doc View Source

GetCompatibleFormats(List<SDPAudioVideoMediaFormat>, List<SDPAudioVideoMediaFormat>)

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
Type Name Description
System.Collections.Generic.List<SDPAudioVideoMediaFormat> a

The first list to match the media formats for.

System.Collections.Generic.List<SDPAudioVideoMediaFormat> b

The second list to match the media formats for.

Returns
Type Description
System.Collections.Generic.List<SDPAudioVideoMediaFormat>

A list of media formats that are compatible for BOTH lists.

| Improve this Doc View Source

IsEmpty()

Declaration
public bool IsEmpty()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Name()

Declaration
public string Name()
Returns
Type Description
System.String
| Improve this Doc View Source

SortMediaCapability(List<SDPAudioVideoMediaFormat>, List<SDPAudioVideoMediaFormat>)

Sort capabilities array based on another capability array

Declaration
public static void SortMediaCapability(List<SDPAudioVideoMediaFormat> capabilities, List<SDPAudioVideoMediaFormat> priorityOrder)
Parameters
Type Name Description
System.Collections.Generic.List<SDPAudioVideoMediaFormat> capabilities
System.Collections.Generic.List<SDPAudioVideoMediaFormat> priorityOrder
| Improve this Doc View Source

ToAudioFormat()

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

ToVideoFormat()

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

TryParseRtpmap(String, out String, out Int32, out Int32)

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

WithUpdatedFmtp(String)

Declaration
public SDPAudioVideoMediaFormat WithUpdatedFmtp(string fmtp)
Parameters
Type Name Description
System.String fmtp
Returns
Type Description
SDPAudioVideoMediaFormat
| Improve this Doc View Source

WithUpdatedID(Int32)

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
Type Description
SDPAudioVideoMediaFormat

A new format.

| Improve this Doc View Source

WithUpdatedRtpmap(String)

Declaration
public SDPAudioVideoMediaFormat WithUpdatedRtpmap(string rtpmap)
Parameters
Type Name Description
System.String rtpmap
Returns
Type Description
SDPAudioVideoMediaFormat

Extension Methods

JSONWriter.ToJson(Object)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX