public class JingleUtils
extends java.lang.Object
Constructor and Description |
---|
JingleUtils() |
Modifier and Type | Method and Description |
---|---|
static ContentPacketExtension |
createDescription(ContentPacketExtension.CreatorEnum creator,
java.lang.String contentName,
ContentPacketExtension.SendersEnum senders,
java.util.List<org.jitsi.service.neomedia.format.MediaFormat> formats,
java.util.List<org.jitsi.service.neomedia.RTPExtension> rtpExtensions,
DynamicPayloadTypeRegistry dynamicPayloadTypes,
DynamicRTPExtensionsRegistry rtpExtensionsRegistry)
Creates a new
ContentPacketExtension instance according to the
specified formats, connector and direction,
and using the dynamicPayloadTypes registry to handle dynamic
payload type registrations. |
static org.jitsi.service.neomedia.MediaStreamTarget |
extractDefaultTarget(ContentPacketExtension content)
Returns the default candidate for the specified content content.
|
static org.jitsi.service.neomedia.MediaStreamTarget |
extractDefaultTarget(IceUdpTransportPacketExtension transport) |
static java.util.List<org.jitsi.service.neomedia.format.MediaFormat> |
extractFormats(RtpDescriptionPacketExtension description,
DynamicPayloadTypeRegistry ptRegistry)
Extracts and returns the list of MediaFormats advertised in
description preserving their oder and registering dynamic payload
type numbers in the specified ptRegistry.
|
static java.util.List<org.jitsi.service.neomedia.RTPExtension> |
extractRTPExtensions(RtpDescriptionPacketExtension desc,
DynamicRTPExtensionsRegistry extMap)
Extracts and returns the list of RTPExtensions advertised in
desc and registers newly encountered ones into the specified
extMap.
|
static PayloadTypePacketExtension |
formatToPayloadType(org.jitsi.service.neomedia.format.MediaFormat format,
DynamicPayloadTypeRegistry ptRegistry)
Converts a specific
MediaFormat into a new
PayloadTypePacketExtension instance. |
static org.jitsi.service.neomedia.MediaDirection |
getDirection(ContentPacketExtension.SendersEnum senders,
boolean initiatorPerspective)
Determines the direction of the media stream that content
describes and returns the corresponding MediaDirection enum
entry.
|
static org.jitsi.service.neomedia.MediaDirection |
getDirection(ContentPacketExtension content,
boolean initiatorPerspective)
Determines the direction of the media stream that content
describes and returns the corresponding MediaDirection enum
entry.
|
static CandidatePacketExtension |
getFirstCandidate(ContentPacketExtension content,
int componentID)
Returns the first candidate for the specified componentID or
null if no such component exists.
|
static CandidatePacketExtension |
getFirstCandidate(IceUdpTransportPacketExtension transport,
int componentID) |
static org.jitsi.service.neomedia.MediaType |
getMediaType(ContentPacketExtension content)
Returns the MediaType for content by looking for it
in the content's description, if any.
|
static RtpDescriptionPacketExtension |
getRtpDescription(ContentPacketExtension content)
Extracts and returns an
RtpDescriptionPacketExtension provided
with content or null if there is none. |
static ContentPacketExtension.SendersEnum |
getSenders(org.jitsi.service.neomedia.MediaDirection direction,
boolean initiatorPerspective)
Converts the specified media direction into the corresponding
ContentPacketExtension.SendersEnum value so that we could add it to a content element. |
static org.jitsi.service.neomedia.format.MediaFormat |
payloadTypeToMediaFormat(PayloadTypePacketExtension payloadType,
DynamicPayloadTypeRegistry ptRegistry)
Returns the
MediaFormat described in the payloadType
extension or null if we don't recognize the format. |
static org.jitsi.service.neomedia.format.MediaFormat |
payloadTypeToMediaFormat(PayloadTypePacketExtension payloadType,
org.jitsi.service.neomedia.MediaService mediaService,
DynamicPayloadTypeRegistry ptRegistry)
Returns the
MediaFormat described in the payloadType
extension or null if we don't recognize the format. |
public static RtpDescriptionPacketExtension getRtpDescription(ContentPacketExtension content)
RtpDescriptionPacketExtension
provided
with content or null if there is none.content
- the media content that we'd like to extract the
RtpDescriptionPacketExtension
from.RtpDescriptionPacketExtension
provided with
content or null if there is none.public static java.util.List<org.jitsi.service.neomedia.format.MediaFormat> extractFormats(RtpDescriptionPacketExtension description, DynamicPayloadTypeRegistry ptRegistry)
description
- the MediaDescription that we'd like to probe
for a list of MediaFormatsptRegistry
- a reference to the DynamycPayloadTypeRegistry
where we should be registering newly added payload type number to format
mappings.public static org.jitsi.service.neomedia.format.MediaFormat payloadTypeToMediaFormat(PayloadTypePacketExtension payloadType, DynamicPayloadTypeRegistry ptRegistry)
MediaFormat
described in the payloadType
extension or null if we don't recognize the format.payloadType
- the PayloadTypePacketExtension
which is to be
parsed into a MediaFormat
.ptRegistry
- the DynamicPayloadTypeRegistry
that we would
use for the registration of possible dynamic payload types or
null the returned MediaFormat is to not be registered
into a DynamicPayloadTypeRegistry.MediaFormat
described in the payloadType
extension or null if we don't recognize the format.public static org.jitsi.service.neomedia.format.MediaFormat payloadTypeToMediaFormat(PayloadTypePacketExtension payloadType, org.jitsi.service.neomedia.MediaService mediaService, DynamicPayloadTypeRegistry ptRegistry)
MediaFormat
described in the payloadType
extension or null if we don't recognize the format.payloadType
- the PayloadTypePacketExtension
which is to be
parsed into a MediaFormat
.mediaService
- the MediaService implementation which is to
be used for MediaFormat-related factory methodsptRegistry
- the DynamicPayloadTypeRegistry
that we would
use for the registration of possible dynamic payload types or
null the returned MediaFormat is to not be registered
into a DynamicPayloadTypeRegistry.MediaFormat
described in the payloadType
extension or null if we don't recognize the format.public static java.util.List<org.jitsi.service.neomedia.RTPExtension> extractRTPExtensions(RtpDescriptionPacketExtension desc, DynamicRTPExtensionsRegistry extMap)
desc
- the RtpDescriptionPacketExtension
that we'd like to
probe for a list of RTPExtension
sextMap
- a reference to the DynamicRTPExtensionsRegistry
where we should be registering newly added extension mappings.RTPExtension
s advertised in the
mediaDesc description.public static ContentPacketExtension.SendersEnum getSenders(org.jitsi.service.neomedia.MediaDirection direction, boolean initiatorPerspective)
ContentPacketExtension.SendersEnum
value so that we could add it to a content element.
The initiatorPerspectice allows callers to specify whether the
direction is to be considered from the session initator's perspective
or that of the responder.
Example: A MediaDirection.SENDONLY
value would be translated to
ContentPacketExtension.SendersEnum.initiator
from the initiator's perspective and to
ContentPacketExtension.SendersEnum.responder
otherwise.
direction
- the MediaDirection
that we'd like to translate.initiatorPerspective
- true if the direction param
is to be considered from the initiator's perspective and false
otherwise.public static org.jitsi.service.neomedia.MediaDirection getDirection(ContentPacketExtension content, boolean initiatorPerspective)
Example: An initiator value would be translated to
MediaDirection.SENDONLY
from the initiator's perspective and to
MediaDirection.RECVONLY
from the responder's.
content
- the description of the media stream whose direction
we are trying to determine.initiatorPerspective
- true if the senders argument is to
be translated into a direction from the initiator's perspective and
false for the sender's.public static org.jitsi.service.neomedia.MediaDirection getDirection(ContentPacketExtension.SendersEnum senders, boolean initiatorPerspective)
senders
- senders directioninitiatorPerspective
- true if the senders argument is to
be translated into a direction from the initiator's perspective and
false for the sender's.public static org.jitsi.service.neomedia.MediaStreamTarget extractDefaultTarget(ContentPacketExtension content)
content
- the stream whose default candidate we are looking for.MediaStreamTarget
containing the default
candidates for the stream described in content or
null, if for some reason, the packet does not contain any
candidates.public static org.jitsi.service.neomedia.MediaStreamTarget extractDefaultTarget(IceUdpTransportPacketExtension transport)
public static CandidatePacketExtension getFirstCandidate(ContentPacketExtension content, int componentID)
content
- the ContentPacketExtension
that we'll be searching
for a component.componentID
- the id of the component that we are looking for
(e.g. 1 for RTP, 2 for RTCP);public static CandidatePacketExtension getFirstCandidate(IceUdpTransportPacketExtension transport, int componentID)
public static ContentPacketExtension createDescription(ContentPacketExtension.CreatorEnum creator, java.lang.String contentName, ContentPacketExtension.SendersEnum senders, java.util.List<org.jitsi.service.neomedia.format.MediaFormat> formats, java.util.List<org.jitsi.service.neomedia.RTPExtension> rtpExtensions, DynamicPayloadTypeRegistry dynamicPayloadTypes, DynamicRTPExtensionsRegistry rtpExtensionsRegistry)
ContentPacketExtension
instance according to the
specified formats, connector and direction,
and using the dynamicPayloadTypes registry to handle dynamic
payload type registrations. The type (e.g. audio/video) of the media
description is determined via from the type of the first
MediaFormat
in the formats list.creator
- indicates whether the person who originally created this
content was the initiator or the responder of the jingle sessioncontentName
- the name of the content element as indicator by the
creator or, in case we are the creators: as we'd like it to be.formats
- the list of formats that should be advertised in the newly
created content extension.senders
- indicates the direction of the media in this stream.rtpExtensions
- a list of RTPExtensions supported by the
MediaDevice that we will be advertising.dynamicPayloadTypes
- a reference to the
DynamicPayloadTypeRegistry that we should be using to lookup
and register dynamic RTP mappings.rtpExtensionsRegistry
- a reference to the
DynamicRTPExtensionRegistry that we should be using to lookup
and register URN to ID mappings.public static PayloadTypePacketExtension formatToPayloadType(org.jitsi.service.neomedia.format.MediaFormat format, DynamicPayloadTypeRegistry ptRegistry)
MediaFormat
into a new
PayloadTypePacketExtension
instance.format
- the MediaFormat we'd like to convert.ptRegistry
- the DynamicPayloadTypeRegistry
to use for
formats that don't have a static pt number.public static org.jitsi.service.neomedia.MediaType getMediaType(ContentPacketExtension content)
content
- the content to return the MediaType of
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.