Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.device
Class MediaDeviceImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.device.AbstractMediaDevice
      extended by net.java.sip.communicator.impl.neomedia.device.MediaDeviceImpl
All Implemented Interfaces:
MediaDevice
Direct Known Subclasses:
AudioMediaDeviceImpl

public class MediaDeviceImpl
extends AbstractMediaDevice

Implements MediaDevice for the JMF CaptureDevice.

Author:
Lyubomir Marinov, Emil Ivov

Constructor Summary
MediaDeviceImpl(javax.media.CaptureDeviceInfo captureDeviceInfo, MediaType mediaType)
          Initializes a new MediaDeviceImpl instance which is to provide an implementation of MediaDevice for a CaptureDevice with a specific CaptureDeviceInfo and which is of a specific MediaType.
MediaDeviceImpl(MediaType mediaType)
          Initializes a new MediaDeviceImpl instance with a specific MediaType and with MediaDirection which does not allow sending.
 
Method Summary
(package private)  javax.media.protocol.CaptureDevice createCaptureDevice()
          Creates the JMF CaptureDevice this instance represents and provides an implementation of MediaDevice for.
(package private)  javax.media.protocol.DataSource createOutputDataSource()
          Creates a DataSource instance for this MediaDevice which gives access to the captured media.
static javax.media.protocol.CaptureDevice createTracingCaptureDevice(javax.media.protocol.CaptureDevice captureDevice, Logger logger)
          Creates a new CaptureDevice which traces calls to a specific CaptureDevice for debugging purposes.
 javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
          Gets the CaptureDeviceInfo of the JMF CaptureDevice represented by this instance.
 MediaDirection getDirection()
          Returns the MediaDirection supported by this device.
 MediaFormat getFormat()
          Gets the MediaFormat in which this MediaDevice captures media.
 MediaType getMediaType()
          Gets the MediaType that this device supports.
 List<MediaFormat> getSupportedFormats(QualityPreset sendPreset, QualityPreset receivePreset)
          Gets the list of MediaFormats supported by this MediaDevice.
 String toString()
          Gets a human-readable String representation of this instance.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.device.AbstractMediaDevice
close, connect, createSession, getSession, getSupportedExtensions, getSupportedFormats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MediaDeviceImpl

public MediaDeviceImpl(MediaType mediaType)
Initializes a new MediaDeviceImpl instance with a specific MediaType and with MediaDirection which does not allow sending.

Parameters:
mediaType - the MediaType of the new instance

MediaDeviceImpl

public MediaDeviceImpl(javax.media.CaptureDeviceInfo captureDeviceInfo,
                       MediaType mediaType)
Initializes a new MediaDeviceImpl instance which is to provide an implementation of MediaDevice for a CaptureDevice with a specific CaptureDeviceInfo and which is of a specific MediaType.

Parameters:
captureDeviceInfo - the CaptureDeviceInfo of the JMF CaptureDevice the new instance is to provide an implementation of MediaDevice for
mediaType - the MediaType of the new instance
Method Detail

createCaptureDevice

javax.media.protocol.CaptureDevice createCaptureDevice()
Creates the JMF CaptureDevice this instance represents and provides an implementation of MediaDevice for.

Returns:
the JMF CaptureDevice this instance represents and provides an implementation of MediaDevice for; null if the creation fails

createOutputDataSource

javax.media.protocol.DataSource createOutputDataSource()
Creates a DataSource instance for this MediaDevice which gives access to the captured media.

Specified by:
createOutputDataSource in class AbstractMediaDevice
Returns:
a DataSource instance which gives access to the media captured by this MediaDevice
See Also:
AbstractMediaDevice.createOutputDataSource()

createTracingCaptureDevice

public static javax.media.protocol.CaptureDevice createTracingCaptureDevice(javax.media.protocol.CaptureDevice captureDevice,
                                                                            Logger logger)
Creates a new CaptureDevice which traces calls to a specific CaptureDevice for debugging purposes.

Parameters:
captureDevice - the CaptureDevice which is to have its calls traced for debugging output
logger - the Logger to be used for logging the trace messages
Returns:
a new CaptureDevice which traces the calls to the specified captureDevice

getCaptureDeviceInfo

public javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
Gets the CaptureDeviceInfo of the JMF CaptureDevice represented by this instance.

Returns:
the CaptureDeviceInfo of the CaptureDevice represented by this instance

getDirection

public MediaDirection getDirection()
Returns the MediaDirection supported by this device.

Returns:
MediaDirection.SENDONLY if this is a read-only device, MediaDirection.RECVONLY if this is a write-only device or MediaDirection.SENDRECV if this MediaDevice can both capture and render media
See Also:
MediaDevice.getDirection()

getFormat

public MediaFormat getFormat()
Gets the MediaFormat in which this MediaDevice captures media.

Returns:
the MediaFormat in which this MediaDevice captures media
See Also:
MediaDevice.getFormat()

getMediaType

public MediaType getMediaType()
Gets the MediaType that this device supports.

Returns:
MediaType.AUDIO if this is an audio device or MediaType.VIDEO if this is a video device
See Also:
MediaDevice.getMediaType()

getSupportedFormats

public List<MediaFormat> getSupportedFormats(QualityPreset sendPreset,
                                             QualityPreset receivePreset)
Gets the list of MediaFormats supported by this MediaDevice.

Parameters:
sendPreset - the preset used to set some of the format parameters, used for video and settings.
receivePreset - the preset used to set the receive format parameters, used for video and settings.
Returns:
the list of MediaFormats supported by this device
See Also:
MediaDevice.getSupportedFormats()

toString

public String toString()
Gets a human-readable String representation of this instance.

Overrides:
toString in class Object
Returns:
a String providing a human-readable representation of this instance

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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