Package org.jitsi.impl.neomedia
Class MediaUtils
- java.lang.Object
-
- org.jitsi.impl.neomedia.MediaUtils
-
public class MediaUtils extends Object
Implements static utility methods used by media classes.- Author:
- Emil Ivov, Lyubomir Marinov, Boris Grozev, George Politis
-
-
Field Summary
Fields Modifier and Type Field Description static MediaFormat[]EMPTY_MEDIA_FORMATSAn empty array with MediaFormat element type.static intMAX_AUDIO_CHANNELSThe maximum number of channels for audio that is available through MediaUtils.static doubleMAX_AUDIO_SAMPLE_RATEThe maximum sample rate for audio that is available through MediaUtils.static intMAX_AUDIO_SAMPLE_SIZE_IN_BITSThe maximum sample size in bits for audio that is available through MediaUtils.
-
Constructor Summary
Constructors Constructor Description MediaUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcreateImageAttr(Dimension sendSize, Dimension maxRecvSize)Creates value of an imgattr.static MediaFormatgetMediaFormat(String encoding, double clockRate)Gets the MediaFormat known to MediaUtils and having the specified well-known encoding (name) and clockRate.static MediaFormatgetMediaFormat(String encoding, double clockRate, Map<String,String> fmtps)Gets the MediaFormat known to MediaUtils and having the specified well-known encoding (name), clockRate and matching format parameters.static MediaFormatgetMediaFormat(javax.media.Format format)Gets a MediaFormat predefined in MediaUtils which represents a specific JMF Format.static intgetMediaFormatIndex(MediaFormat mediaFormat)Gets the index of a specific MediaFormat instance within the internal storage of MediaUtils.static MediaFormat[]getMediaFormats(byte rtpPayloadType)Gets the MediaFormats (expressed as an array) corresponding to a specific RTP payload type.static List<MediaFormat>getMediaFormats(String encoding)Gets the MediaFormats predefined in MediaUtils with a specific well-known encoding (name) as defined by RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control".static MediaFormat[]getMediaFormats(org.jitsi.utils.MediaType mediaType)Gets the MediaFormats known to MediaUtils and being of the specified MediaType.static bytegetRTPPayloadType(String jmfEncoding, double clockRate)Gets the RTP payload type corresponding to a specific JMF encoding and clock rate.static StringjmfEncodingToEncoding(String jmfEncoding)Gets the well-known encoding (name) as defined in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control" corresponding to a given JMF-specific encoding.
-
-
-
Field Detail
-
EMPTY_MEDIA_FORMATS
public static final MediaFormat[] EMPTY_MEDIA_FORMATS
An empty array with MediaFormat element type. Explicitly defined in order to reduce unnecessary allocations, garbage collection.
-
MAX_AUDIO_CHANNELS
public static final int MAX_AUDIO_CHANNELS
The maximum number of channels for audio that is available through MediaUtils.
-
MAX_AUDIO_SAMPLE_RATE
public static final double MAX_AUDIO_SAMPLE_RATE
The maximum sample rate for audio that is available through MediaUtils.
-
MAX_AUDIO_SAMPLE_SIZE_IN_BITS
public static final int MAX_AUDIO_SAMPLE_SIZE_IN_BITS
The maximum sample size in bits for audio that is available through MediaUtils.
-
-
Method Detail
-
createImageAttr
public static String createImageAttr(Dimension sendSize, Dimension maxRecvSize)
Creates value of an imgattr. https://tools.ietf.org/html/rfc6236- Parameters:
sendSize- maximum size peer can sendmaxRecvSize- maximum size peer can display- Returns:
- string that represent imgattr that can be encoded via SIP/SDP or XMPP/Jingle
-
getMediaFormat
public static MediaFormat getMediaFormat(javax.media.Format format)
Gets a MediaFormat predefined in MediaUtils which represents a specific JMF Format. If there is no such representing MediaFormat in MediaUtils, returns null.- Parameters:
format- the JMF Format to get the MediaFormat representation for- Returns:
- a MediaFormat predefined in MediaUtils which represents format if any; null if there is no such representing MediaFormat in MediaUtils
-
getMediaFormat
public static MediaFormat getMediaFormat(String encoding, double clockRate)
Gets the MediaFormat known to MediaUtils and having the specified well-known encoding (name) and clockRate.- Parameters:
encoding- the well-known encoding (name) of the MediaFormat to getclockRate- the clock rate of the MediaFormat to get- Returns:
- the MediaFormat known to MediaUtils and having the specified encoding and clockRate
-
getMediaFormat
public static MediaFormat getMediaFormat(String encoding, double clockRate, Map<String,String> fmtps)
Gets the MediaFormat known to MediaUtils and having the specified well-known encoding (name), clockRate and matching format parameters.- Parameters:
encoding- the well-known encoding (name) of the MediaFormat to getclockRate- the clock rate of the MediaFormat to getfmtps- the format parameters of the MediaFormat to get- Returns:
- the MediaFormat known to MediaUtils and having the specified encoding (name), clockRate and matching format parameters
-
getMediaFormatIndex
public static int getMediaFormatIndex(MediaFormat mediaFormat)
Gets the index of a specific MediaFormat instance within the internal storage of MediaUtils. Since the index is in the internal storage which may or may not be one and the same for the various MediaFormat instances and which may or may not be searched for the purposes of determining the index, the index is not to be used as a way to determine whether MediaUtils knows the specified mediaFormat- Parameters:
mediaFormat- the MediaFormat to determine the index of- Returns:
- the index of the specified mediaFormat in the internal storage of MediaUtils
-
getMediaFormats
public static MediaFormat[] getMediaFormats(byte rtpPayloadType)
Gets the MediaFormats (expressed as an array) corresponding to a specific RTP payload type.- Parameters:
rtpPayloadType- the RTP payload type to retrieve the corresponding MediaFormats for- Returns:
- an array of MediaFormats corresponding to the specified RTP payload type
-
getMediaFormats
public static MediaFormat[] getMediaFormats(org.jitsi.utils.MediaType mediaType)
Gets the MediaFormats known to MediaUtils and being of the specified MediaType.- Parameters:
mediaType- the MediaType of the MediaFormats to get- Returns:
- the MediaFormats known to MediaUtils and being of the specified mediaType
-
getMediaFormats
public static List<MediaFormat> getMediaFormats(String encoding)
Gets the MediaFormats predefined in MediaUtils with a specific well-known encoding (name) as defined by RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control".- Parameters:
encoding- the well-known encoding (name) to get the corresponding MediaFormats of- Returns:
- a List of MediaFormats corresponding to the specified encoding (name)
-
getRTPPayloadType
public static byte getRTPPayloadType(String jmfEncoding, double clockRate)
Gets the RTP payload type corresponding to a specific JMF encoding and clock rate.- Parameters:
jmfEncoding- the JMF encoding as returned byFormat.getEncoding()or the respective AudioFormat and VideoFormat encoding constants to get the corresponding RTP payload type ofclockRate- the clock rate to be taken into account in the search for the RTP payload type if the JMF encoding does not uniquely identify it- Returns:
- the RTP payload type corresponding to the specified JMF encoding
and clock rate if known in RFC 3551 "RTP Profile for Audio and Video
Conferences with Minimal Control"; otherwise,
MediaFormat.RTP_PAYLOAD_TYPE_UNKNOWN
-
jmfEncodingToEncoding
public static String jmfEncodingToEncoding(String jmfEncoding)
Gets the well-known encoding (name) as defined in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control" corresponding to a given JMF-specific encoding.- Parameters:
jmfEncoding- the JMF encoding to get the corresponding well-known encoding of- Returns:
- the well-known encoding (name) as defined in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control" corresponding to jmfEncoding if any; otherwise, null
-
-