Package org.jitsi.impl.neomedia.protocol
Class RewritablePushBufferDataSource
- java.lang.Object
-
- javax.media.protocol.DataSource
-
- javax.media.protocol.PushBufferDataSource
-
- org.jitsi.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
-
- org.jitsi.impl.neomedia.protocol.PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
-
- org.jitsi.impl.neomedia.protocol.RewritablePushBufferDataSource
-
- All Implemented Interfaces:
javax.media.Controls,javax.media.Duration,javax.media.protocol.CaptureDevice,javax.media.protocol.Controls,InbandDTMFDataSource,MuteDataSource
public class RewritablePushBufferDataSource extends PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource> implements MuteDataSource, InbandDTMFDataSource
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 org.jitsi.impl.neomedia.protocol.PushBufferDataSourceDelegate
dataSource
-
Fields inherited from class org.jitsi.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
captureDevice, EMPTY_STREAMS
-
-
Constructor Summary
Constructors Constructor Description RewritablePushBufferDataSource(javax.media.protocol.PushBufferDataSource dataSource)Initializes a new RewritablePushBufferDataSource instance which is to provide mute support for a specific PushBufferDataSource.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDTMF(DTMFInbandTone tone)Adds a new inband DTMF tone to send.ObjectgetControl(String controlType)ImplementsControls.getControl(String).javax.media.protocol.PushBufferStream[]getStreams()ImplementsPushBufferDataSource.getStreams().booleanisMute()Determines whether this DataSource is mute.booleanisSendingDTMF()Determines whether this DataSource sends a DTMF tone.static voidmute(javax.media.Buffer buffer)Replaces the media data contained in a specific Buffer with a compatible representation of silence.static voidsendDTMF(javax.media.Buffer buffer, DTMFInbandTone tone)Replaces the media data contained in a specific Buffer with an inband DTMF tone signal.voidsetMute(boolean mute)Sets the mute state of this DataSource.-
Methods inherited from class org.jitsi.impl.neomedia.protocol.PushBufferDataSourceDelegate
connect, disconnect, getContentType, getControls, getDataSource, getDuration, getLocator, start, stop
-
Methods inherited from class org.jitsi.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
getCaptureDeviceInfo, getFormatControls
-
-
-
-
Constructor Detail
-
RewritablePushBufferDataSource
public RewritablePushBufferDataSource(javax.media.protocol.PushBufferDataSource dataSource)
Initializes a new RewritablePushBufferDataSource 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
-
getControl
public Object getControl(String controlType)
ImplementsControls.getControl(String). Delegates to the wrapped DataSource. OverridesCaptureDeviceDelegatePushBufferDataSource.getControl(String)because the wrapped DataSource may not be a CaptureDevice yet it still needs to give access to the control. Overrides the super implementation to include the type hierarchy of the very wrapped dataSource instance into the search for the specified controlType.- Specified by:
getControlin interfacejavax.media.Controls- Overrides:
getControlin classPushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>- 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
-
getStreams
public javax.media.protocol.PushBufferStream[] getStreams()
ImplementsPushBufferDataSource.getStreams(). Wraps the streams of the wrapped PushBufferDataSource into MutePushBufferStream instances in order to provide mute support to them.- Specified by:
getStreamsin classPushBufferDataSourceDelegate<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:
isMutein interfaceMuteDataSource- 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:
setMutein interfaceMuteDataSource- Parameters:
mute- true to mute this DataSource; otherwise, false
-
addDTMF
public void addDTMF(DTMFInbandTone tone)
Adds a new inband DTMF tone to send.- Specified by:
addDTMFin interfaceInbandDTMFDataSource- Parameters:
tone- the DTMF tone to send.
-
isSendingDTMF
public boolean isSendingDTMF()
Determines whether this DataSource sends a DTMF tone.- Returns:
- true if this DataSource is sending a DTMF tone; otherwise, false.
-
sendDTMF
public static void sendDTMF(javax.media.Buffer buffer, DTMFInbandTone tone)Replaces the media data contained in a specific Buffer with an inband DTMF tone signal.- Parameters:
buffer- the Buffer the data contained in which is to be replaced with the DTMF tonetone- the DMFTTone to send via inband DTMF signal.
-
-