Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol.media
Class AbstractOperationSetVideoTelephony<T extends OperationSetBasicTelephony<U>,U extends ProtocolProviderService,V extends MediaAwareCall<W,T,U>,W extends MediaAwareCallPeer<V,?,U>>

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.media.AbstractOperationSetVideoTelephony<T,U,V,W>
Type Parameters:
T - the implementation specific telephony operation set class like for example OperationSetBasicTelephonySipImpl.
U - the implementation specific provider class like for example ProtocolProviderServiceSipImpl.
V - the MediaAwareCall implementation like CallSipImpl or CallJabberImpl.
W - the MediaAwarePeerCall implementation like CallPeerSipImpl or CallPeerJabberImpl.
All Implemented Interfaces:
OperationSet, OperationSetVideoTelephony
Direct Known Subclasses:
OperationSetVideoTelephonyJabberImpl, OperationSetVideoTelephonySipImpl

public abstract class AbstractOperationSetVideoTelephony<T extends OperationSetBasicTelephony<U>,U extends ProtocolProviderService,V extends MediaAwareCall<W,T,U>,W extends MediaAwareCallPeer<V,?,U>>
extends Object
implements OperationSetVideoTelephony

Represents a default implementation of OperationSetVideoTelephony in order to make it easier for implementers to provide complete solutions while focusing on implementation-specific details.

Author:
Emil Ivov, Sebastien Vincent

Field Summary
protected  T basicTelephony
          The telephony-related functionality this extension builds upon.
protected  U parentProvider
          The SIP ProtocolProviderService implementation which created this instance and for which telephony conferencing services are being provided by this instance.
 
Fields inherited from interface net.java.sip.communicator.service.protocol.OperationSetVideoTelephony
LOCAL_VIDEO_STREAMING
 
Constructor Summary
AbstractOperationSetVideoTelephony(T basicTelephony)
          Initializes a new AbstractOperationSetVideoTelephony instance which builds upon the telephony-related functionality of a specific OperationSetBasicTelephony implementation.
 
Method Summary
 void addPropertyChangeListener(Call call, PropertyChangeListener listener)
          Adds a specific PropertyChangeListener to the list of listeners which get notified when the properties (e.g.
 void addVideoListener(CallPeer peer, VideoListener listener)
          Delegates to the CallPeerMediaHandler of the specified CallPeer because the video is provided by it.
 Component createLocalVisualComponent(CallPeer peer, VideoListener listener)
          Implements OperationSetVideoTelephony.createLocalVisualComponent(CallPeer, VideoListener).
 Call createVideoCall(Contact callee, QualityPreset qualityPreferences)
          Create a new video call and invite the specified CallPeer to it with initial video setting.
 Call createVideoCall(String uri, QualityPreset qualityPreferences)
          Create a new video call and invite the specified CallPeer to it with initial video setting.
 void disposeLocalVisualComponent(CallPeer peer, Component component)
          Implements OperationSetVideoTelephony.disposeLocalVisualComponent(CallPeer, Component).
 MediaUseCase getMediaUseCase()
          Get the MediaUseCase of a video telephony operation set.
 QualityControl getQualityControl(CallPeer peer)
          Returns the quality control for video calls if any.
 Component getVisualComponent(CallPeer peer)
          Deprecated. 
 List<Component> getVisualComponents(CallPeer peer)
          Gets the visual/video Components available in this telephony for a specific CallPeer.
 boolean isLocalVideoAllowed(Call call)
          Determines whether the streaming of local video in a specific Call is currently allowed.
 boolean isLocalVideoStreaming(Call call)
          Determines whether a specific Call is currently streaming the local video (to a remote destination).
 void removePropertyChangeListener(Call call, PropertyChangeListener listener)
          Removes a specific PropertyChangeListener from the list of listeners which get notified when the properties (e.g.
 void removeVideoListener(CallPeer peer, VideoListener listener)
          Delegates to the CallPeerMediaHandler of the specified CallPeer because the video is provided by it.
 void setLocalVideoAllowed(Call call, boolean allowed)
          Implements OperationSetVideoTelephony#setLocalVideoAllowed(Call, boolean).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.OperationSetVideoTelephony
answerVideoCallPeer, createVideoCall, createVideoCall
 

Field Detail

parentProvider

protected final U extends ProtocolProviderService parentProvider
The SIP ProtocolProviderService implementation which created this instance and for which telephony conferencing services are being provided by this instance.


basicTelephony

protected final T extends OperationSetBasicTelephony<U> basicTelephony
The telephony-related functionality this extension builds upon.

Constructor Detail

AbstractOperationSetVideoTelephony

public AbstractOperationSetVideoTelephony(T basicTelephony)
Initializes a new AbstractOperationSetVideoTelephony instance which builds upon the telephony-related functionality of a specific OperationSetBasicTelephony implementation.

Parameters:
basicTelephony - the OperationSetBasicTelephony the new extension should build upon
Method Detail

addVideoListener

public void addVideoListener(CallPeer peer,
                             VideoListener listener)
Delegates to the CallPeerMediaHandler of the specified CallPeer because the video is provided by it. Because other OperationSetVideoTelephony implementations may not provide their video through the CallPeerMediaHandler, this implementation promotes itself as the provider of the video by replacing the CallPeerMediaHandler in the VideoEvents it fires.

Specified by:
addVideoListener in interface OperationSetVideoTelephony
Parameters:
peer - the CallPeer that we will be registering listener with.
listener - the VideoListener that we'd like to register.

createLocalVisualComponent

public Component createLocalVisualComponent(CallPeer peer,
                                            VideoListener listener)
                                     throws OperationFailedException
Implements OperationSetVideoTelephony.createLocalVisualComponent(CallPeer, VideoListener).

Specified by:
createLocalVisualComponent in interface OperationSetVideoTelephony
Parameters:
peer - the CallPeer that we are sending our local video to.
listener - the VideoListener where we'd like to retrieve the Component containing the local video.
Returns:
the Component containing the local video.
Throws:
OperationFailedException - if we fail extracting the local video.

disposeLocalVisualComponent

public void disposeLocalVisualComponent(CallPeer peer,
                                        Component component)
Implements OperationSetVideoTelephony.disposeLocalVisualComponent(CallPeer, Component).

Specified by:
disposeLocalVisualComponent in interface OperationSetVideoTelephony
Parameters:
peer - the CallPeer whose local video component we'd like to dispose of.
component - the Component that we'll be disposing of.

getVisualComponent

@Deprecated
public Component getVisualComponent(CallPeer peer)
Deprecated. 

Gets the visual/video Component available in this telephony for a specific CallPeer.

Specified by:
getVisualComponent in interface OperationSetVideoTelephony
Parameters:
peer - the CallPeer whose video is to be retrieved
Returns:
the visual/video Component available in this telephony for the specified peer if any; otherwise, null

getVisualComponents

public List<Component> getVisualComponents(CallPeer peer)
Gets the visual/video Components available in this telephony for a specific CallPeer.

Specified by:
getVisualComponents in interface OperationSetVideoTelephony
Parameters:
peer - the CallPeer whose videos are to be retrieved
Returns:
the visual/video Components available in this telephony for the specified peer

removeVideoListener

public void removeVideoListener(CallPeer peer,
                                VideoListener listener)
Delegates to the CallPeerMediaHandler of the specified CallPeer because the video is provided by it.

Specified by:
removeVideoListener in interface OperationSetVideoTelephony
Parameters:
peer - the CallPeer that we'd like to unregister our VideoListener from.
listener - the VideoListener that we'd like to unregister.

setLocalVideoAllowed

public void setLocalVideoAllowed(Call call,
                                 boolean allowed)
                          throws OperationFailedException
Implements OperationSetVideoTelephony#setLocalVideoAllowed(Call, boolean). Modifies the local media setup to reflect the requested setting for the streaming of the local video and then re-invites all CallPeers to re-negotiate the modified media setup.

Specified by:
setLocalVideoAllowed in interface OperationSetVideoTelephony
Parameters:
call - the call where we'd like to allow sending local video.
allowed - true if local video transmission is allowed and false otherwise.
Throws:
OperationFailedException - if video initialization fails.

isLocalVideoAllowed

public boolean isLocalVideoAllowed(Call call)
Determines whether the streaming of local video in a specific Call is currently allowed. The setting does not reflect the availability of actual video capture devices, it just expresses the desire of the user to have the local video streamed in the case the system is actually able to do so.

Specified by:
isLocalVideoAllowed in interface OperationSetVideoTelephony
Parameters:
call - the Call whose video transmission properties we are interested in.
Returns:
true if the streaming of local video for the specified Call is allowed; otherwise, false

isLocalVideoStreaming

public boolean isLocalVideoStreaming(Call call)
Determines whether a specific Call is currently streaming the local video (to a remote destination).

Specified by:
isLocalVideoStreaming in interface OperationSetVideoTelephony
Parameters:
call - the Call whose video transmission we are interested in.
Returns:
true if the specified Call is currently streaming the local video (to a remote destination); otherwise, false

addPropertyChangeListener

public void addPropertyChangeListener(Call call,
                                      PropertyChangeListener listener)
Adds a specific PropertyChangeListener to the list of listeners which get notified when the properties (e.g. OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING) associated with a specific Call change their values.

Specified by:
addPropertyChangeListener in interface OperationSetVideoTelephony
Parameters:
call - the Call to start listening to the changes of the property values of
listener - the PropertyChangeListener to be notified when the properties associated with the specified Call change their values

removePropertyChangeListener

public void removePropertyChangeListener(Call call,
                                         PropertyChangeListener listener)
Removes a specific PropertyChangeListener from the list of listeners which get notified when the properties (e.g. OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING) associated with a specific Call change their values.

Specified by:
removePropertyChangeListener in interface OperationSetVideoTelephony
Parameters:
call - the Call to stop listening to the changes of the property values of
listener - the PropertyChangeListener to no longer be notified when the properties associated with the specified Call change their values

getMediaUseCase

public MediaUseCase getMediaUseCase()
Get the MediaUseCase of a video telephony operation set.

Returns:
MediaUseCase.CALL

getQualityControl

public QualityControl getQualityControl(CallPeer peer)
Returns the quality control for video calls if any. Return null so protocols who supports it to override it.

Specified by:
getQualityControl in interface OperationSetVideoTelephony
Parameters:
peer - the peer which this control operates on.
Returns:
the implemented quality control.

createVideoCall

public Call createVideoCall(String uri,
                            QualityPreset qualityPreferences)
                     throws OperationFailedException,
                            ParseException
Create a new video call and invite the specified CallPeer to it with initial video setting.

Specified by:
createVideoCall in interface OperationSetVideoTelephony
Parameters:
uri - the address of the callee that we should invite to a new call.
qualityPreferences - the quality preset we will use establishing the video call, and we will expect from the other side. When establishing call we don't have any indications whether remote part supports quality presets, so this setting can be ignored.
Returns:
CallPeer the CallPeer that will represented by the specified uri. All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
Throws:
OperationFailedException - with the corresponding code if we fail to create the video call.
ParseException - if callee is not a valid sip address string.

createVideoCall

public Call createVideoCall(Contact callee,
                            QualityPreset qualityPreferences)
                     throws OperationFailedException
Create a new video call and invite the specified CallPeer to it with initial video setting.

Specified by:
createVideoCall in interface OperationSetVideoTelephony
Parameters:
callee - the address of the callee that we should invite to a new call.
qualityPreferences - the quality preset we will use establishing the video call, and we will expect from the other side. When establishing call we don't have any indications whether remote part supports quality presets, so this setting can be ignored.
Returns:
CallPeer the CallPeer that will represented by the specified uri. All following state change events will be delivered through that call peer. The Call that this peer is a member of could be retrieved from the CallParticipatn instance with the use of the corresponding method.
Throws:
OperationFailedException - with the corresponding code if we fail to create the video call.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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