Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.protocol
Class PushBufferDataSourceDelegate<T extends javax.media.protocol.DataSource>

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
              extended by net.java.sip.communicator.impl.neomedia.protocol.PushBufferDataSourceDelegate<T>
Type Parameters:
T - the very type of DataSource to be wrapped in a PushBufferDataSourceDelegate
All Implemented Interfaces:
javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice
Direct Known Subclasses:
PushBufferDataSourceAdapter, ReceiveStreamPushBufferDataSource, RewritablePushBufferDataSource

public abstract class PushBufferDataSourceDelegate<T extends javax.media.protocol.DataSource>
extends CaptureDeviceDelegatePushBufferDataSource

Implements most of PushBufferDataSource for a particular DataSource and requires extenders to only implement PushBufferDataSource.getStreams(). Intended to allow easier overriding of the streams returned by a DataSource.

Author:
Lubomir Marinov

Field Summary
protected  T dataSource
          The wrapped DataSource this instance delegates to.
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
captureDevice, EMPTY_STREAMS
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
PushBufferDataSourceDelegate(T dataSource)
          Initializes a new PushBufferDataSourceDelegate which is to delegate to a specific DataSource.
 
Method Summary
 void connect()
          Implements DataSource.connect().
 void disconnect()
          Implements DataSource.disconnect().
 String getContentType()
          Implements DataSource.getContentType().
 Object getControl(String controlType)
          Implements DataSource.getControl(String).
 Object[] getControls()
          Implements DataSource.getControls().
 T getDataSource()
          Gets the DataSource wrapped by this instance.
 javax.media.Time getDuration()
          Implements DataSource.getDuration().
 javax.media.MediaLocator getLocator()
          Implements DataSource.getLocator().
abstract  javax.media.protocol.PushBufferStream[] getStreams()
          Gets the PushBufferStreams through which this PushBufferDataSource gives access to its media data.
 void start()
          Implements DataSource.start().
 void stop()
          Implements DataSource.stop().
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
getCaptureDeviceInfo, getFormatControls
 
Methods inherited from class javax.media.protocol.DataSource
initCheck, setLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

protected final T extends javax.media.protocol.DataSource dataSource
The wrapped DataSource this instance delegates to.

Constructor Detail

PushBufferDataSourceDelegate

public PushBufferDataSourceDelegate(T dataSource)
Initializes a new PushBufferDataSourceDelegate which is to delegate to a specific DataSource.

Parameters:
dataSource - the DataSource the new instance is to delegate to
Method Detail

connect

public void connect()
             throws IOException
Implements DataSource.connect(). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.connect() because the wrapped DataSource may not be a CaptureDevice yet it still needs to be connected.

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

disconnect

public void disconnect()
Implements DataSource.disconnect(). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.disconnect() because the wrapped DataSource may not be a CaptureDevice yet it still needs to be disconnected.

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

getContentType

public String getContentType()
Implements DataSource.getContentType(). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.getContentType() because the wrapped DataSource may not be a CaptureDevice yet it still needs to report the content type.

Overrides:
getContentType in class CaptureDeviceDelegatePushBufferDataSource
Returns:
a String value which describes the content type of the wrapped DataSource

getLocator

public javax.media.MediaLocator getLocator()
Implements DataSource.getLocator(). Delegates to the wrapped DataSource.

Overrides:
getLocator in class javax.media.protocol.DataSource
Returns:
a MediaLocator value which describes the locator of the wrapped DataSource

getControl

public Object getControl(String controlType)
Implements DataSource.getControl(String). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.getControl(String) because the wrapped DataSource may not be a CaptureDevice yet it still needs to give access to the control.

Specified by:
getControl in interface javax.media.Controls
Overrides:
getControl in class CaptureDeviceDelegatePushBufferDataSource
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 DataSource

getControls

public Object[] getControls()
Implements DataSource.getControls(). Delegates to the wrapped PushBufferDataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.getControls() because the wrapped DataSource may not be a CaptureDevice yet it still needs to give access to the controls.

Specified by:
getControls in interface javax.media.Controls
Overrides:
getControls in class CaptureDeviceDelegatePushBufferDataSource
Returns:
an array of Objects which represent the controls of the wrapped DataSource

getDataSource

public T getDataSource()
Gets the DataSource wrapped by this instance.

Returns:
the DataSource wrapped by this instance

getDuration

public javax.media.Time getDuration()
Implements DataSource.getDuration(). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.getDuration() because the wrapped DataSource may not be a CaptureDevice yet it still needs to report the duration.

Specified by:
getDuration in interface javax.media.Duration
Overrides:
getDuration in class CaptureDeviceDelegatePushBufferDataSource
Returns:
the duration of the wrapped DataSource

getStreams

public abstract javax.media.protocol.PushBufferStream[] getStreams()
Gets the PushBufferStreams through which this PushBufferDataSource gives access to its media data.

Overrides:
getStreams in class CaptureDeviceDelegatePushBufferDataSource
Returns:
an array of PushBufferStreams through which this PushBufferDataSource gives access to its media data

start

public void start()
           throws IOException
Implements DataSource.start(). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.start() because the wrapped DataSource may not be a CaptureDevice yet it still needs to be started.

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

stop

public void stop()
          throws IOException
Implements DataSource.stop(). Delegates to the wrapped DataSource. Overrides CaptureDeviceDelegatePushBufferDataSource.stop() because the wrapped DataSource may not be a CaptureDevice yet it still needs to be stopped.

Specified by:
stop in interface javax.media.protocol.CaptureDevice
Overrides:
stop in class CaptureDeviceDelegatePushBufferDataSource
Throws:
IOException - if the wrapped DataSource 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.