Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.protocol
Class CaptureDeviceDelegatePushBufferDataSource

java.lang.Object
  extended by javax.media.protocol.DataSource
      extended by javax.media.protocol.PushBufferDataSource
          extended by net.java.sip.communicator.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
All Implemented Interfaces:
javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice
Direct Known Subclasses:
PushBufferDataSourceDelegate

public class CaptureDeviceDelegatePushBufferDataSource
extends javax.media.protocol.PushBufferDataSource
implements javax.media.protocol.CaptureDevice

Represents a PushBufferDataSource which is also a CaptureDevice through delegation to a specific CaptureDevice.

Author:
Lubomir Marinov

Field Summary
protected  javax.media.protocol.CaptureDevice captureDevice
          The CaptureDevice this instance delegates to in order to implement its CaptureDevice functionality.
protected static javax.media.protocol.PushBufferStream[] EMPTY_STREAMS
          The constant which represents an empty array with PushBufferStream element type.
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
CaptureDeviceDelegatePushBufferDataSource(javax.media.protocol.CaptureDevice captureDevice)
          Initializes a new CaptureDeviceDelegatePushBufferDataSource instance which delegates to a specific CaptureDevice in order to implement its CaptureDevice functionality.
 
Method Summary
 void connect()
          Implements CaptureDevice.connect().
 void disconnect()
          Implements CaptureDevice.disconnect().
 javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
          Implements CaptureDevice.getCaptureDeviceInfo().
 String getContentType()
          Implements DataSource.getContentType().
 Object getControl(String controlType)
          Implements DataSource.getControl(String).
 Object[] getControls()
          Implements DataSource.getControls().
 javax.media.Time getDuration()
          Implements DataSource.getDuration().
 javax.media.control.FormatControl[] getFormatControls()
          Implements CaptureDevice.getFormatControls().
 javax.media.protocol.PushBufferStream[] getStreams()
          Implements PushBufferDataSource.getStreams().
 void start()
          Implements CaptureDevice.start().
 void stop()
          Implements CaptureDevice.stop().
 
Methods inherited from class javax.media.protocol.DataSource
getLocator, initCheck, setLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STREAMS

protected static final javax.media.protocol.PushBufferStream[] EMPTY_STREAMS
The constant which represents an empty array with PushBufferStream element type. Explicitly defined in order to reduce unnecessary allocations.


captureDevice

protected final javax.media.protocol.CaptureDevice captureDevice
The CaptureDevice this instance delegates to in order to implement its CaptureDevice functionality.

Constructor Detail

CaptureDeviceDelegatePushBufferDataSource

public CaptureDeviceDelegatePushBufferDataSource(javax.media.protocol.CaptureDevice captureDevice)
Initializes a new CaptureDeviceDelegatePushBufferDataSource instance which delegates to a specific CaptureDevice in order to implement its CaptureDevice functionality.

Parameters:
captureDevice - the CaptureDevice the new instance is to delegate to in order to provide its CaptureDevice functionality
Method Detail

connect

public void connect()
             throws IOException
Implements CaptureDevice.connect(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.

Specified by:
connect in interface javax.media.protocol.CaptureDevice
Specified by:
connect in class javax.media.protocol.DataSource
Throws:
IOException - if the wrapped CaptureDevice throws such an exception

disconnect

public void disconnect()
Implements CaptureDevice.disconnect(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.

Specified by:
disconnect in interface javax.media.protocol.CaptureDevice
Specified by:
disconnect in class javax.media.protocol.DataSource

getCaptureDeviceInfo

public javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
Implements CaptureDevice.getCaptureDeviceInfo(). Delegates to the wrapped CaptureDevice if available; otherwise, returns null.

Specified by:
getCaptureDeviceInfo in interface javax.media.protocol.CaptureDevice
Returns:
the CaptureDeviceInfo of the wrapped CaptureDevice if available; otherwise, null

getContentType

public String getContentType()
Implements DataSource.getContentType(). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns ContentDescriptor.CONTENT_UNKNOWN.

Specified by:
getContentType in class javax.media.protocol.DataSource
Returns:
a String value which describes the content type of the wrapped CaptureDevice if it implements DataSource; otherwise, ContentDescriptor#CONTENT_UNKNOWN

getControl

public Object getControl(String controlType)
Implements DataSource.getControl(String). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns null.

Specified by:
getControl in interface javax.media.Controls
Specified by:
getControl in class javax.media.protocol.DataSource
Parameters:
controlType - a String value which names the type of the control to be retrieved
Returns:
an Object which represents the control of the requested controlType of the wrapped CaptureDevice if it implements DataSource; otherwise, null

getControls

public Object[] getControls()
Implements DataSource.getControls(). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns an empty array with Object element type.

Specified by:
getControls in interface javax.media.Controls
Specified by:
getControls in class javax.media.protocol.DataSource
Returns:
the array of controls for the wrapped CaptureDevice if it implements DataSource; otherwise, an empty array with Object element type

getDuration

public javax.media.Time getDuration()
Implements DataSource.getDuration(). Delegates to the wrapped CaptureDevice if it implements DataSource; otherwise, returns Duration.DURATION_UNKNOWN.

Specified by:
getDuration in interface javax.media.Duration
Specified by:
getDuration in class javax.media.protocol.DataSource
Returns:
the duration of the wrapped CaptureDevice as returned by its implementation of DataSource if any; otherwise, returns DataSource#DURATION_UNKNOWN

getFormatControls

public javax.media.control.FormatControl[] getFormatControls()
Implements CaptureDevice.getFormatControls(). Delegates to the wrapped CaptureDevice if available; otherwise, returns an empty array with FormatControl element type.

Specified by:
getFormatControls in interface javax.media.protocol.CaptureDevice
Returns:
the array of FormatControls of the wrapped CaptureDevice if available; otherwise, an empty array with FormatControl element type

getStreams

public javax.media.protocol.PushBufferStream[] getStreams()
Implements PushBufferDataSource.getStreams(). Delegates to the wrapped CaptureDevice if it implements PushBufferDataSource; otherwise, returns an empty array with PushBufferStream element type.

Specified by:
getStreams in class javax.media.protocol.PushBufferDataSource
Returns:
an array of PushBufferStreams as returned by the wrapped CaptureDevice if it implements PushBufferDataSource; otherwise, an empty array with PushBufferStream element type

start

public void start()
           throws IOException
Implements CaptureDevice.start(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.

Specified by:
start in interface javax.media.protocol.CaptureDevice
Specified by:
start in class javax.media.protocol.DataSource
Throws:
IOException - if the wrapped CaptureDevice throws such an exception

stop

public void stop()
          throws IOException
Implements CaptureDevice.stop(). Delegates to the wrapped CaptureDevice if available; otherwise, does nothing.

Specified by:
stop in interface javax.media.protocol.CaptureDevice
Specified by:
stop in class javax.media.protocol.DataSource
Throws:
IOException - if the wrapped CaptureDevice throws such an exception

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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