diff options
Diffstat (limited to 'src/net/java/sip/communicator/service')
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/OperationSetDesktopStreaming.java | 60 | ||||
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/media/MediaAwareCall.java | 58 |
2 files changed, 115 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetDesktopStreaming.java b/src/net/java/sip/communicator/service/protocol/OperationSetDesktopStreaming.java index 9177176..2597e22 100644 --- a/src/net/java/sip/communicator/service/protocol/OperationSetDesktopStreaming.java +++ b/src/net/java/sip/communicator/service/protocol/OperationSetDesktopStreaming.java @@ -6,13 +6,73 @@ */ package net.java.sip.communicator.service.protocol; +import java.text.*; + +import net.java.sip.communicator.service.neomedia.device.*; + /** * Represents an <tt>OperationSet</tt> giving access to desktop streaming * specific functionality. * * @author Sebastien Vincent + * @author Yana Stamcheva */ public interface OperationSetDesktopStreaming extends OperationSetVideoTelephony { + /** + * Create a new video call and invite the specified CallPeer to it. + * + * @param uri the address of the callee that we should invite to a new + * call. + * @param mediaDevice the media device to use for the desktop streaming + * @return 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 CallParticipatnt instance with the use + * of the corresponding method. + * @throws OperationFailedException with the corresponding code if we fail + * to create the video call. + * @throws ParseException if <tt>callee</tt> is not a valid address + * string. + */ + public Call createVideoCall(String uri, MediaDevice mediaDevice) + throws OperationFailedException, ParseException; + + /** + * Create a new video call and invite the specified CallPeer to it. + * + * @param callee the address of the callee that we should invite to a new + * call. + * @param mediaDevice the media device to use for the desktop streaming + * @return 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 CallParticipant instance with the use + * of the corresponding method. + * @throws OperationFailedException with the corresponding code if we fail + * to create the video call. + */ + public Call createVideoCall(Contact callee, MediaDevice mediaDevice) + throws OperationFailedException; + + /** + * Sets the indicator which determines whether the streaming of local video + * in a specific <tt>Call</tt> is 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. + * + * @param call the <tt>Call</tt> to allow/disallow the streaming of local + * video for + * @param mediaDevice the media device to use for the desktop streaming + * @param allowed <tt>true</tt> to allow the streaming of local video for + * the specified <tt>Call</tt>; <tt>false</tt> to disallow it + * + * @throws OperationFailedException if initializing local video fails. + */ + public void setLocalVideoAllowed( Call call, + MediaDevice mediaDevice, + boolean allowed) + throws OperationFailedException; } diff --git a/src/net/java/sip/communicator/service/protocol/media/MediaAwareCall.java b/src/net/java/sip/communicator/service/protocol/media/MediaAwareCall.java index 49999c6..c495d9a 100644 --- a/src/net/java/sip/communicator/service/protocol/media/MediaAwareCall.java +++ b/src/net/java/sip/communicator/service/protocol/media/MediaAwareCall.java @@ -84,6 +84,20 @@ public abstract class MediaAwareCall< protected MediaUseCase mediaUseCase = MediaUseCase.ANY; /** + * The <tt>MediaDevice</tt> for video we should use in the call. + * In case this member is null, a lookup corresponding to MediaType.VIDEO is + * performed to the <tt>MediaService</tt>. + */ + private MediaDevice videoDevice = null; + + /** + * The <tt>MediaDevice</tt> for audio we should use in the call. + * In case this member is null, a lookup corresponding to MediaType.AUDIO is + * performed to the <tt>MediaService</tt>. + */ + private MediaDevice audioDevice = null; + + /** * The listener that would actually subscribe for level events from the * media handler if there's at least one listener in * <tt>localUserAudioLevelListeners</tt>. @@ -234,7 +248,6 @@ public abstract class MediaAwareCall< * @param evt The <tt>CallPeerChangeEvent</tt> instance containing * the source event as well as its previous and its new status. */ - @SuppressWarnings("unchecked") // should refactor at some point public void peerStateChanged(CallPeerChangeEvent evt) { CallPeerState newState = (CallPeerState) evt.getNewValue(); @@ -331,9 +344,27 @@ public abstract class MediaAwareCall< */ public MediaDevice getDefaultDevice(MediaType mediaType) { + MediaDevice device = null; MediaService mediaService = ProtocolMediaActivator.getMediaService(); - MediaDevice device = mediaService.getDefaultDevice(mediaType, - mediaUseCase); + + switch(mediaType) + { + case AUDIO: + device = audioDevice; + break; + case VIDEO: + device = videoDevice; + break; + default: + /* no other type supported */ + return null; + } + + if(device == null) + { + device = mediaService.getDefaultDevice(mediaType, + mediaUseCase); + } if (MediaType.AUDIO.equals(mediaType)) { @@ -611,4 +642,25 @@ public abstract class MediaAwareCall< } return recorder; } + + + /** + * Set the <tt>MediaDevice</tt> used for the video. + * + * @param dev video <tt>MediaDevice</tt> + */ + public void setVideoDevice(MediaDevice dev) + { + videoDevice = dev; + } + + /** + * Set the <tt>MediaDevice</tt> used for the audio. + * + * @param dev audio <tt>MediaDevice</tt> + */ + public void setAudioDevice(MediaDevice dev) + { + this.audioDevice = dev; + } } |