public class RewritablePushBufferDataSource extends PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource> implements MuteDataSource, InbandDTMFDataSource
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).
dataSource
captureDevice, EMPTY_STREAMS
Constructor and Description |
---|
RewritablePushBufferDataSource(javax.media.protocol.PushBufferDataSource dataSource)
Initializes a new RewritablePushBufferDataSource instance which
is to provide mute support for a specific PushBufferDataSource.
|
Modifier and Type | Method and Description |
---|---|
void |
addDTMF(DTMFInbandTone tone)
Adds a new inband DTMF tone to send.
|
java.lang.Object |
getControl(java.lang.String controlType)
Implements
DataSource.getControl(String) . |
javax.media.protocol.PushBufferStream[] |
getStreams()
Implements
PushBufferDataSource.getStreams() . |
boolean |
isMute()
Determines whether this DataSource is mute.
|
boolean |
isSendingDTMF()
Determines whether this DataSource sends a DTMF tone.
|
static void |
mute(javax.media.Buffer buffer)
Replaces the media data contained in a specific Buffer with a
compatible representation of silence.
|
static void |
sendDTMF(javax.media.Buffer buffer,
DTMFInbandTone tone)
Replaces the media data contained in a specific Buffer with an
inband DTMF tone signal.
|
void |
setMute(boolean mute)
Sets the mute state of this DataSource.
|
connect, disconnect, getContentType, getControls, getDataSource, getDuration, getLocator, start, stop
getCaptureDeviceInfo, getFormatControls
public RewritablePushBufferDataSource(javax.media.protocol.PushBufferDataSource dataSource)
dataSource
- the PushBufferDataSource the new instance is
to provide mute support forpublic java.lang.Object getControl(java.lang.String controlType)
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.
Overrides the super implementation to include the type hierarchy of the
very wrapped dataSource instance into the search for the
specified controlType.getControl
in interface javax.media.Controls
getControl
in class PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
controlType
- a String value which names the type of the
control to be retrievedpublic javax.media.protocol.PushBufferStream[] getStreams()
PushBufferDataSource.getStreams()
. Wraps the streams
of the wrapped PushBufferDataSource into
MutePushBufferStream instances in order to provide mute support
to them.getStreams
in class PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
public boolean isMute()
isMute
in interface MuteDataSource
public static void mute(javax.media.Buffer buffer)
buffer
- the Buffer the data contained in which is to be
replaced with silencepublic void setMute(boolean mute)
setMute
in interface MuteDataSource
mute
- true to mute this DataSource; otherwise,
falsepublic void addDTMF(DTMFInbandTone tone)
addDTMF
in interface InbandDTMFDataSource
tone
- the DTMF tone to send.public boolean isSendingDTMF()
public static void sendDTMF(javax.media.Buffer buffer, DTMFInbandTone tone)
buffer
- the Buffer the data contained in which is to be
replaced with the DTMF tonetone
- the DMFTTone to send via inband DTMF signal.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.