Interface MediaFormat
-
- All Known Subinterfaces:
AudioMediaFormat,VideoMediaFormat
- All Known Implementing Classes:
AudioMediaFormatImpl,MediaFormatImpl,VideoMediaFormatImpl
public interface MediaFormatThe MediaFormat interface represents a generic (i.e. audio/video or other) format used to represent media represent a media stream.The interface contains utility methods for extracting common media format properties such as the name of the underlying encoding, or clock rate or in order comparing to compare formats. Extending interfaces representing audio or video formats are likely to add other methods.
- Author:
- Emil Ivov, Lyubomir Marinov
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_DYNAMIC_PAYLOAD_TYPEThe maximum integer that is allowed for use in dynamic payload type assignment.static intMIN_DYNAMIC_PAYLOAD_TYPEThe minimum integer that is allowed for use in dynamic payload type assignment.static byteRTP_PAYLOAD_TYPE_UNKNOWNThe constant returned bygetRTPPayloadType()when the MediaFormat instance describes a format without an RTP payload type (number) known in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control".
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanequals(Object mediaFormat)Determines whether this MediaFormat is equal to mediaFormat i.e.booleanformatParametersMatch(Map<String,String> fmtps)Determines whether the format parameters of this MediaFormat match a specific set of format parameters.Map<String,String>getAdditionalCodecSettings()Returns additional codec settings.Map<String,String>getAdvancedAttributes()Returns a Map containing advanced parameters specific to this particular MediaFormat.doublegetClockRate()Returns the clock rate associated with this MediaFormat.StringgetClockRateString()Returns a String representation of the clock rate associated with this MediaFormat making sure that the value appears as an integer (i.e.StringgetEncoding()Returns the name of the encoding (i.e.Map<String,String>getFormatParameters()Returns a Map containing parameters specific to this particular MediaFormat.org.jitsi.utils.MediaTypegetMediaType()Returns the type of this MediaFormat (e.g.StringgetRealUsedClockRateString()Returns a String representation of the real used clock rate associated with this MediaFormat making sure that the value appears as an integer (i.e.bytegetRTPPayloadType()Gets the RTP payload type (number) of this MediaFormat as it is known in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control".booleanmatches(MediaFormat format)Determines whether this MediaFormat matches properties of a specific MediaFormat, such as mediaType, encoding, clockRate and channels for MediaFormats with mediaType equal toMediaType.AUDIO.booleanmatches(org.jitsi.utils.MediaType mediaType, String encoding, double clockRate, int channels, Map<String,String> formatParameters)Determines whether this MediaFormat has specific values for its properties mediaType, encoding, clockRate and channels for MediaFormats with mediaType equal toMediaType.AUDIO.voidsetAdditionalCodecSettings(Map<String,String> settings)Sets additional codec settings.StringtoString()Returns a String representation of this MediaFormat containing important format attributes such as the encoding for example.
-
-
-
Field Detail
-
RTP_PAYLOAD_TYPE_UNKNOWN
static final byte RTP_PAYLOAD_TYPE_UNKNOWN
The constant returned bygetRTPPayloadType()when the MediaFormat instance describes a format without an RTP payload type (number) known in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control".- See Also:
- Constant Field Values
-
MIN_DYNAMIC_PAYLOAD_TYPE
static final int MIN_DYNAMIC_PAYLOAD_TYPE
The minimum integer that is allowed for use in dynamic payload type assignment.- See Also:
- Constant Field Values
-
MAX_DYNAMIC_PAYLOAD_TYPE
static final int MAX_DYNAMIC_PAYLOAD_TYPE
The maximum integer that is allowed for use in dynamic payload type assignment.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMediaType
org.jitsi.utils.MediaType getMediaType()
Returns the type of this MediaFormat (e.g. audio or video).- Returns:
- the MediaType that this format represents (e.g. audio or video).
-
getEncoding
String getEncoding()
Returns the name of the encoding (i.e. codec) used by this MediaFormat.- Returns:
- The name of the encoding that this MediaFormat is using.
-
getClockRate
double getClockRate()
Returns the clock rate associated with this MediaFormat.- Returns:
- The clock rate associated with this format.
-
getClockRateString
String getClockRateString()
Returns a String representation of the clock rate associated with this MediaFormat making sure that the value appears as an integer (i.e. contains no decimal point) unless it is actually a non integer.- Returns:
- a String representation of the clock rate associated with this MediaFormat.
-
getRealUsedClockRateString
String getRealUsedClockRateString()
Returns a String representation of the real used clock rate associated with this MediaFormat making sure that the value appears as an integer (i.e. contains no decimal point) unless it is actually a non integer. This function corrects the problem of the G.722 codec which advertises its clock rate to be 8 kHz while 16 kHz is really used to encode the stream (that's an error noted in the respective RFC and kept for the sake of compatibility.).- Returns:
- a String representation of the real used clock rate associated with this MediaFormat.
-
equals
boolean equals(Object mediaFormat)
Determines whether this MediaFormat is equal to mediaFormat i.e. they have the same encoding, clock rate, format parameters, advanced attributes, etc.
-
formatParametersMatch
boolean formatParametersMatch(Map<String,String> fmtps)
Determines whether the format parameters of this MediaFormat match a specific set of format parameters.- Parameters:
fmtps- the set of format parameters to match to the format parameters of this MediaFormat- Returns:
- true if this MediaFormat considers fmtps matching its format parameters; otherwise, false
-
getAdvancedAttributes
Map<String,String> getAdvancedAttributes()
Returns a Map containing advanced parameters specific to this particular MediaFormat. The parameters returned here are meant for use in SIP/SDP or XMPP session descriptions.- Returns:
- a Map containing advanced parameters specific to this particular MediaFormat
-
getFormatParameters
Map<String,String> getFormatParameters()
Returns a Map containing parameters specific to this particular MediaFormat. The parameters returned here are meant for use in SIP/SDP or XMPP session descriptions where they get transported through the "fmtp:" attribute or <parameter/> tag respectively.- Returns:
- a Map containing parameters specific to this particular MediaFormat.
-
getRTPPayloadType
byte getRTPPayloadType()
Gets the RTP payload type (number) of this MediaFormat as it is known in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal Control".- Returns:
- the RTP payload type of this MediaFormat if it is known
in RFC 3551 "RTP Profile for Audio and Video Conferences with Minimal
Control"; otherwise,
RTP_PAYLOAD_TYPE_UNKNOWN
-
setAdditionalCodecSettings
void setAdditionalCodecSettings(Map<String,String> settings)
Sets additional codec settings.- Parameters:
settings- additional settings represented by a map.
-
getAdditionalCodecSettings
Map<String,String> getAdditionalCodecSettings()
Returns additional codec settings.- Returns:
- additional settings represented by a map.
-
toString
String toString()
Returns a String representation of this MediaFormat containing important format attributes such as the encoding for example.
-
matches
boolean matches(MediaFormat format)
Determines whether this MediaFormat matches properties of a specific MediaFormat, such as mediaType, encoding, clockRate and channels for MediaFormats with mediaType equal toMediaType.AUDIO.- Parameters:
format- theMediaFormatwhose properties we'd like to examine- Returns:
- true if the specified format has specific values for its properties mediaType, encoding, clockRate and channels; otherwise, false
-
matches
boolean matches(org.jitsi.utils.MediaType mediaType, String encoding, double clockRate, int channels, Map<String,String> formatParameters)Determines whether this MediaFormat has specific values for its properties mediaType, encoding, clockRate and channels for MediaFormats with mediaType equal toMediaType.AUDIO.- Parameters:
mediaType- the type we expectMediaFormatto haveencoding- the encoding we are looking for.clockRate- the clock rate that we'd like the format to have.channels- the number of channels that expect to find in this formatformatParameters- the format parameters expected to match these of the specified format- Returns:
- true if the specified format has specific values for its properties mediaType, encoding, clockRate and channels; otherwise, false
-
-