Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

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<javax.media.protocol.PushBufferDataSource>
                  extended by net.java.sip.communicator.impl.neomedia.protocol.MutePushBufferDataSource
All Implemented Interfaces:
javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice, MuteDataSource

public class MutePushBufferDataSource
extends PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
implements MuteDataSource

Implements a PushBufferDataSource wrapper which provides mute support for the wrapped instance.

Because the class wouldn't work for our use case without it, CaptureDevice is implemented and is being delegated to the wrapped DataSource (if it supports the interface in question).

Author:
Lyubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.protocol.PushBufferDataSourceDelegate
dataSource
 
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
MutePushBufferDataSource(javax.media.protocol.PushBufferDataSource dataSource)
          Initializes a new MutePushBufferDataSource instance which is to provide mute support for a specific PushBufferDataSource.
 
Method Summary
 javax.media.protocol.PushBufferStream[] getStreams()
          Implements PushBufferDataSource.getStreams().
 boolean isMute()
          Determines whether this DataSource is mute.
static void mute(javax.media.Buffer buffer)
          Replaces the media data contained in a specific Buffer with a compatible representation of silence.
 void setMute(boolean mute)
          Sets the mute state of this DataSource.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.protocol.PushBufferDataSourceDelegate
connect, disconnect, getContentType, getControl, getControls, getDataSource, getDuration, getLocator, start, 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
 

Constructor Detail

MutePushBufferDataSource

public MutePushBufferDataSource(javax.media.protocol.PushBufferDataSource dataSource)
Initializes a new MutePushBufferDataSource instance which is to provide mute support for a specific PushBufferDataSource.

Parameters:
dataSource - the PushBufferDataSource the new instance is to provide mute support for
Method Detail

getStreams

public javax.media.protocol.PushBufferStream[] getStreams()
Implements PushBufferDataSource.getStreams(). Wraps the streams of the wrapped PushBufferDataSource into MutePushBufferStream instances in order to provide mute support to them.

Specified by:
getStreams in class PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
Returns:
an array of PushBufferStream instances with enabled mute support

isMute

public boolean isMute()
Determines whether this DataSource is mute.

Specified by:
isMute in interface MuteDataSource
Returns:
true if this DataSource is mute; otherwise, false

mute

public static void mute(javax.media.Buffer buffer)
Replaces the media data contained in a specific Buffer with a compatible representation of silence.

Parameters:
buffer - the Buffer the data contained in which is to be replaced with silence

setMute

public void setMute(boolean mute)
Sets the mute state of this DataSource.

Specified by:
setMute in interface MuteDataSource
Parameters:
mute - true to mute this DataSource; otherwise, false

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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