Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.format
Class VideoMediaFormatImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.format.MediaFormatImpl<javax.media.format.VideoFormat>
      extended by net.java.sip.communicator.impl.neomedia.format.VideoMediaFormatImpl
All Implemented Interfaces:
MediaFormat, VideoMediaFormat

public class VideoMediaFormatImpl
extends MediaFormatImpl<javax.media.format.VideoFormat>
implements VideoMediaFormat

Implements VideoMediaFormat for the JMF VideoFormat.

Author:
Lyubomir Marinov

Field Summary
static double DEFAULT_CLOCK_RATE
          The default value of the clockRate property of VideoMediaFormatImpl.
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.format.MediaFormatImpl
CLOCK_RATE_PNAME, EMPTY_CODEC_SETTINGS, EMPTY_FORMAT_PARAMETERS, ENCODING_PNAME, format, FORMAT_PARAMETERS_PNAME
 
Fields inherited from interface net.java.sip.communicator.service.neomedia.format.MediaFormat
MAX_DYNAMIC_PAYLOAD_TYPE, MIN_DYNAMIC_PAYLOAD_TYPE, RTP_PAYLOAD_TYPE_UNKNOWN
 
Constructor Summary
VideoMediaFormatImpl(String encoding)
          Initializes a new VideoMediaFormatImpl instance with a specific encoding.
VideoMediaFormatImpl(String encoding, double clockRate)
          Initializes a new VideoMediaFormatImpl instance with a specific encoding and a specific clock rate.
VideoMediaFormatImpl(javax.media.format.VideoFormat format)
          Initializes a new VideoMediaFormatImpl instance which is to provide an implementation of VideoMediaFormat for a specific JMF VideoFormat.
VideoMediaFormatImpl(javax.media.format.VideoFormat format, double clockRate)
          Initializes a new VideoMediaFormatImpl instance which is to provide an implementation of VideoMediaFormat for a specific JMF VideoFormat and to have a specific clock rate.
VideoMediaFormatImpl(javax.media.format.VideoFormat format, double clockRate, float frameRate, Map<String,String> formatParameters, Map<String,String> advancedParameters)
          Initializes a new VideoMediaFormatImpl instance which is to provide an implementation of VideoMediaFormat for a specific JMF VideoFormat and to have specific clock rate and set of format-specific parameters.
 
Method Summary
 boolean equals(Object mediaFormat)
          Implements MediaFormat#equals(Object) and actually compares the encapsulated JMF Format instances.
protected  boolean formatParametersAreEqual(Map<String,String> fmtps1, Map<String,String> fmtps2)
          Determines whether a specific set of format parameters is equal to another set of format parameters in the sense that they define an equal number of parameters and assign them equal values.
static boolean formatParametersAreEqual(String encoding, Map<String,String> fmtps1, Map<String,String> fmtps2)
          Determines whether a specific set of format parameters is equal to another set of format parameters in the sense that they define an equal number of parameters and assign them equal values.
 boolean formatParametersMatch(Map<String,String> fmtps)
          Determines whether the format parameters of this MediaFormat match a specific set of format parameters.
static boolean formatParametersMatch(String encoding, Map<String,String> fmtps1, Map<String,String> fmtps2)
          Determines whether two sets of format parameters match in the context of a specific encoding.
 double getClockRate()
          Gets the clock rate associated with this MediaFormat.
 float getFrameRate()
          Gets the frame rate associated with this MediaFormat.
 MediaType getMediaType()
          Gets the type of this MediaFormat which is MediaType.VIDEO for AudioMediaFormatImpl instances.
 Dimension getSize()
          Gets the size of the image that this VideoMediaFormat describes.
 int hashCode()
          Overrides MediaFormatImpl#hashCode() because Object#equals(Object) is overridden.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.format.MediaFormatImpl
advancedAttributesAreEqual, createInstance, createInstance, getAdditionalCodecSettings, getAdvancedAttributes, getClockRateString, getEncoding, getFormat, getFormatParameters, getJMFEncoding, getRealUsedClockRateString, getRTPPayloadType, setAdditionalCodecSettings, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.neomedia.format.MediaFormat
getAdditionalCodecSettings, getAdvancedAttributes, getClockRateString, getEncoding, getFormatParameters, getRealUsedClockRateString, getRTPPayloadType, setAdditionalCodecSettings, toString
 

Field Detail

DEFAULT_CLOCK_RATE

public static final double DEFAULT_CLOCK_RATE
The default value of the clockRate property of VideoMediaFormatImpl.

See Also:
Constant Field Values
Constructor Detail

VideoMediaFormatImpl

VideoMediaFormatImpl(String encoding)
Initializes a new VideoMediaFormatImpl instance with a specific encoding.

Parameters:
encoding - the encoding of the new VideoMediaFormatImpl instance

VideoMediaFormatImpl

VideoMediaFormatImpl(String encoding,
                     double clockRate)
Initializes a new VideoMediaFormatImpl instance with a specific encoding and a specific clock rate.

Parameters:
encoding - the encoding of the new VideoMediaFormatImpl instance
clockRate - the clock rate of the new VideoMediaFormatImpl instance

VideoMediaFormatImpl

VideoMediaFormatImpl(javax.media.format.VideoFormat format)
Initializes a new VideoMediaFormatImpl instance which is to provide an implementation of VideoMediaFormat for a specific JMF VideoFormat.

Parameters:
format - the JMF VideoFormat the new instance is to wrap and provide an implementation of VideoMediaFormat for

VideoMediaFormatImpl

VideoMediaFormatImpl(javax.media.format.VideoFormat format,
                     double clockRate)
Initializes a new VideoMediaFormatImpl instance which is to provide an implementation of VideoMediaFormat for a specific JMF VideoFormat and to have a specific clock rate.

Parameters:
format - the JMF VideoFormat the new instance is to wrap and provide an implementation of VideoMediaFormat for
clockRate - the clock rate of the new VideoMediaFormatImpl instance

VideoMediaFormatImpl

VideoMediaFormatImpl(javax.media.format.VideoFormat format,
                     double clockRate,
                     float frameRate,
                     Map<String,String> formatParameters,
                     Map<String,String> advancedParameters)
Initializes a new VideoMediaFormatImpl instance which is to provide an implementation of VideoMediaFormat for a specific JMF VideoFormat and to have specific clock rate and set of format-specific parameters.

Parameters:
format - the JMF VideoFormat the new instance is to wrap and provide an implementation of VideoMediaFormat for
clockRate - the clock rate of the new VideoMediaFormatImpl instance
frameRate - the frame rate of the new VideoMediaFormatImpl instance
formatParameters - the set of format-specific parameters of the new instance
advancedParameters - set of advanced parameters of the new instance
Method Detail

equals

public boolean equals(Object mediaFormat)
Implements MediaFormat#equals(Object) and actually compares the encapsulated JMF Format instances.

Specified by:
equals in interface MediaFormat
Overrides:
equals in class MediaFormatImpl<javax.media.format.VideoFormat>
Parameters:
mediaFormat - the object that we'd like to compare this one to
Returns:
true if the JMF Format instances encapsulated by this instance and their other characteristics are equal; false, otherwise.
See Also:
MediaFormatImpl.equals(Object)

formatParametersAreEqual

protected boolean formatParametersAreEqual(Map<String,String> fmtps1,
                                           Map<String,String> fmtps2)
Determines whether a specific set of format parameters is equal to another set of format parameters in the sense that they define an equal number of parameters and assign them equal values. Since the values are Strings, presumes that a value of null is equal to the empty String.

The two Map instances of format parameters to be checked for equality are presumed to be modifiable in the sense that if the lack of a format parameter in a given Map is equivalent to it having a specific value, an association of the format parameter to the value in question may be added to or removed from the respective Map instance for the purposes of determining equality.

Takes into account RFC 3984 "RTP Payload Format for H.264 Video" which says that "[w]hen the value of packetization-mode [format parameter] is equal to 0 or packetization-mode is not present, the single NAL mode, as defined in section 6.2 of RFC 3984, MUST be used."

Overrides:
formatParametersAreEqual in class MediaFormatImpl<javax.media.format.VideoFormat>
Parameters:
fmtps1 - the first set of format parameters to be tested for equality
fmtps2 - the second set of format parameters to be tested for equality
Returns:
true if the specified sets of format parameters are equal; false, otherwise
See Also:
MediaFormatImpl.formatParametersAreEqual(Map, Map)

formatParametersAreEqual

public static boolean formatParametersAreEqual(String encoding,
                                               Map<String,String> fmtps1,
                                               Map<String,String> fmtps2)
Determines whether a specific set of format parameters is equal to another set of format parameters in the sense that they define an equal number of parameters and assign them equal values. Since the values are Strings, presumes that a value of null is equal to the empty String.

The two Map instances of format parameters to be checked for equality are presumed to be modifiable in the sense that if the lack of a format parameter in a given Map is equivalent to it having a specific value, an association of the format parameter to the value in question may be added to or removed from the respective Map instance for the purposes of determining equality.

Parameters:
encoding - the encoding (name) related to the two sets of format parameters to be tested for equality
fmtps1 - the first set of format parameters to be tested for equality
fmtps2 - the second set of format parameters to be tested for equality
Returns:
true if the specified sets of format parameters are equal; false, otherwise

formatParametersMatch

public boolean formatParametersMatch(Map<String,String> fmtps)
Determines whether the format parameters of this MediaFormat match a specific set of format parameters.

VideoMediaFormat reflects the fact that the packetization-mode format parameter distinguishes H.264 payload types.

Specified by:
formatParametersMatch in interface MediaFormat
Overrides:
formatParametersMatch in class MediaFormatImpl<javax.media.format.VideoFormat>
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

formatParametersMatch

public static boolean formatParametersMatch(String encoding,
                                            Map<String,String> fmtps1,
                                            Map<String,String> fmtps2)
Determines whether two sets of format parameters match in the context of a specific encoding.

Parameters:
encoding - the encoding (name) related to the two sets of format parameters to be matched.
fmtps1 - the first set of format parameters which is to be matched against fmtps2
fmtps2 - the second set of format parameters which is to be matched against fmtps1
Returns:
true if the two sets of format parameters match in the context of the specified encoding; otherwise, false

getClockRate

public double getClockRate()
Gets the clock rate associated with this MediaFormat.

Specified by:
getClockRate in interface MediaFormat
Returns:
the clock rate associated with this MediaFormat
See Also:
MediaFormat.getClockRate()

getFrameRate

public float getFrameRate()
Gets the frame rate associated with this MediaFormat.

Specified by:
getFrameRate in interface VideoMediaFormat
Returns:
the frame rate associated with this MediaFormat
See Also:
VideoMediaFormat.getFrameRate()

getMediaType

public final MediaType getMediaType()
Gets the type of this MediaFormat which is MediaType.VIDEO for AudioMediaFormatImpl instances.

Specified by:
getMediaType in interface MediaFormat
Returns:
the MediaType that this format represents and which is MediaType.VIDEO for AudioMediaFormatImpl instances
See Also:
MediaFormat.getMediaType()

getSize

public Dimension getSize()
Gets the size of the image that this VideoMediaFormat describes.

Specified by:
getSize in interface VideoMediaFormat
Returns:
a Dimension instance indicating the image size (in pixels) of this VideoMediaFormat
See Also:
VideoMediaFormat.getSize()

hashCode

public int hashCode()
Overrides MediaFormatImpl#hashCode() because Object#equals(Object) is overridden.

Overrides:
hashCode in class MediaFormatImpl<javax.media.format.VideoFormat>
Returns:
a hash code value for this VideoMediaFormatImpl
See Also:
MediaFormatImpl.hashCode()

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.