Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.neomedia
Enum MediaDirection

java.lang.Object
  extended by java.lang.Enum<MediaDirection>
      extended by net.java.sip.communicator.service.neomedia.MediaDirection
All Implemented Interfaces:
Serializable, Comparable<MediaDirection>

public enum MediaDirection
extends Enum<MediaDirection>

The MediaDirections enumeration contains a list of media directions that indicate read/write capabilities of different entities in this MediaService such as for example devices.

Author:
Emil Ivov

Enum Constant Summary
INACTIVE
          Indicates that the related entity does not support neither input nor output (i.e.
RECVONLY
          Represents a direction pointing to the entity that this object pertains to and from the outside.
SENDONLY
          Represents a direction from the entity that this direction pertains to to the outside.
SENDRECV
          Indicates that the related entity supports both input and output (send and receive) operations.
 
Method Summary
 boolean allowsReceiving()
          Determines whether the directions specified by this MediaDirection instance allow for incoming (i.e.
 boolean allowsSending()
          Determines whether the directions specified by this MediaDirection instance allow for outgoing (i.e.
 MediaDirection and(MediaDirection direction)
          Applies an extra direction constraint to this MediaDirection or in other words performs an and operation.
 MediaDirection getDirectionForAnswer(MediaDirection remotePartyDir)
          Returns the MediaDirection value corresponding to a remote party's perspective of this MediaDirection applying a remote party constraint.
 MediaDirection getReverseDirection()
          Returns the MediaDirection value corresponding to a remote party's perspective of this MediaDirection.
 MediaDirection or(MediaDirection direction)
          Reverses a direction constraint on this MediaDirection or in other words performs an or operation.
static MediaDirection parseString(String mediaDirectionStr)
          Returns a MediaDirection value corresponding to the specified mediaDirectionStr or in other words SENDONLY for "sendonly", RECVONLY for "recvonly", SENDRECV for "sendrecv", and INACTIVE for "inactive".
 String toString()
          Returns the name of this MediaDirection (e.g.
static MediaDirection valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MediaDirection[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INACTIVE

public static final MediaDirection INACTIVE
Indicates that the related entity does not support neither input nor output (i.e. neither send nor receive) operations.


SENDONLY

public static final MediaDirection SENDONLY
Represents a direction from the entity that this direction pertains to to the outside. When applied to a MediaDevice the direction indicates that the device is a read-only one. In the case of a stream a SENDONLY direction indicates that the stream is only sending data to the remote party without receiving.


RECVONLY

public static final MediaDirection RECVONLY
Represents a direction pointing to the entity that this object pertains to and from the outside. When applied to a MediaDevice the direction indicates that the device is a write-only one. In the case of a MediaStream a RECVONLY direction indicates that the stream is only receiving data from the remote party without sending any.


SENDRECV

public static final MediaDirection SENDRECV
Indicates that the related entity supports both input and output (send and receive) operations.

Method Detail

values

public static MediaDirection[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MediaDirection c : MediaDirection.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MediaDirection valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toString

public String toString()
Returns the name of this MediaDirection (e.g. "sendonly" or "sendrecv"). The name returned by this method is meant for use by session description mechanisms such as SIP/SDP or XMPP/Jingle.

Overrides:
toString in class Enum<MediaDirection>
Returns:
the name of this MediaDirection (e.g. "sendonly", "recvonly", "sendrecv").

and

public MediaDirection and(MediaDirection direction)
Applies an extra direction constraint to this MediaDirection or in other words performs an and operation. This method is primarily meant for use by the getReverseMediaDirection(MediaDirection) method while working on Offer/Answer media negotiation..

Parameters:
direction - that direction constraint that we'd like to apply to this MediaDirection
Returns:
the new MediaDirection obtained after applying the direction constraint to this MediaDirection.

or

public MediaDirection or(MediaDirection direction)
Reverses a direction constraint on this MediaDirection or in other words performs an or operation. This method is meant for use in cases like putting a stream off hold or in other words reversing the SENDONLY constraint.

Parameters:
direction - the direction that we'd like to enable (i.e. add) to this MediaDirection
Returns:
the new MediaDirection obtained after adding the specified direction this MediaDirection.

getReverseDirection

public MediaDirection getReverseDirection()
Returns the MediaDirection value corresponding to a remote party's perspective of this MediaDirection. In other words, if I say I'll be sending only, for you this means that you'll be receiving only. If however, I say I'll be both sending and receiving (i.e. SENDRECV) then it means you'll be doing the same (i.e. again SENDRECV).

Returns:
the MediaDirection value corresponding to a remote party's perspective of this MediaDirection.

getDirectionForAnswer

public MediaDirection getDirectionForAnswer(MediaDirection remotePartyDir)
Returns the MediaDirection value corresponding to a remote party's perspective of this MediaDirection applying a remote party constraint. In other words, if I say I'll only be sending media (i.e. SENDONLY) and you know that you can both send and receive (i.e. SENDRECV) then to you this mean that you'll be only receiving media (i.e. RECVONLY). If however I say that I can only receive a particular media type (i.e. RECVONLY) and you are in the same situation then this means that neither of us would be sending nor receiving and the stream would appear INACTIVE to you (and me for that matter). The method is meant for use during Offer/Answer SDP negotiation.

Parameters:
remotePartyDir - the remote party MediaDirection constraint that we'd have to consider when trying to obtain a MediaDirection corresponding to remoteParty's constraint.
Returns:
the MediaDirection value corresponding to a remote party's perspective of this MediaDirection applying a remote party constraint.

allowsSending

public boolean allowsSending()
Determines whether the directions specified by this MediaDirection instance allow for outgoing (i.e. sending) streams or in other words whether this is a SENDONLY or a SENDRECV instance

Returns:
true if this MediaDirection instance includes the possibility of sending and false otherwise.

allowsReceiving

public boolean allowsReceiving()
Determines whether the directions specified by this MediaDirection instance allow for incoming (i.e. receiving) streams or in other words whether this is a RECVONLY or a SENDRECV instance

Returns:
true if this MediaDirection instance includes the possibility of receiving and false otherwise.

parseString

public static MediaDirection parseString(String mediaDirectionStr)
                                  throws IllegalArgumentException
Returns a MediaDirection value corresponding to the specified mediaDirectionStr or in other words SENDONLY for "sendonly", RECVONLY for "recvonly", SENDRECV for "sendrecv", and INACTIVE for "inactive".

Parameters:
mediaDirectionStr - the direction String that we'd like to parse.
Returns:
a MediaDirection value corresponding to the specified mediaDirectionStr.
Throws:
IllegalArgumentException - in case mediaDirectionStr is not a valid media direction.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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