Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

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

public class CaptureDeviceDelegatePullBufferDataSource
extends javax.media.protocol.PullBufferDataSource
implements javax.media.protocol.CaptureDevice

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

Author:
Damian Minkov, 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.PullBufferStream[] EMPTY_STREAMS
          The constant which represents an empty array with PullBufferStream element type.
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
CaptureDeviceDelegatePullBufferDataSource(javax.media.protocol.CaptureDevice captureDevice)
          Initializes a new CaptureDeviceDelegatePullBufferDataSource 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.PullBufferStream[] getStreams()
          Implements PullBufferDataSource.getStreams().
 void start()
          Implements CaptureDevice.start().
 void stop()
          Implements CaptureDevice.start().
 
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

captureDevice

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


EMPTY_STREAMS

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

Constructor Detail

CaptureDeviceDelegatePullBufferDataSource

public CaptureDeviceDelegatePullBufferDataSource(javax.media.protocol.CaptureDevice captureDevice)
Initializes a new CaptureDeviceDelegatePullBufferDataSource 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

getStreams

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

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

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

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

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.start(). 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

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

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

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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