class AudioMixerPushBufferStream extends ControlsAdapter implements javax.media.protocol.PushBufferStream
Pretty much private to AudioMixer but extracted into its own file for the sake of clarity.
EMPTY_CONTROLS
Constructor and Description |
---|
AudioMixerPushBufferStream(AudioMixer audioMixer,
javax.media.format.AudioFormat outFormat)
Initializes a new AudioMixerPushBufferStream instance to output
data in a specific AudioFormat for a specific
AudioMixer.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addOutStream(AudioMixingPushBufferStream outStream)
Adds a specific AudioMixingPushBufferStream to the collection of
such streams to which this instance is to push the data for audio mixing
it reads from its input SourceStreams.
|
boolean |
endOfStream()
Implements
SourceStream.endOfStream() . |
(package private) void |
equalizeInStreamBufferLength()
Attempts to equalize the length in milliseconds of the buffering
performed by the inStreams in order to always read and mix
one and the same length in milliseconds.
|
javax.media.protocol.ContentDescriptor |
getContentDescriptor()
Implements
SourceStream.getContentDescriptor() . |
long |
getContentLength()
Implements
SourceStream.getContentLength() . |
javax.media.format.AudioFormat |
getFormat()
Implements
PushBufferStream.getFormat() . |
(package private) InStreamDesc[] |
getInStreams()
Gets the SourceStreams (in the form of
InStreamDescs) from which this instance reads audio samples.
|
void |
read(javax.media.Buffer buffer)
Implements
PushBufferStream.read(Buffer) . |
(package private) void |
removeOutStream(AudioMixingPushBufferStream outStream)
Removes a specific AudioMixingPushBufferStream from the
collection of such streams to which this instance pushes the data for
audio mixing it reads from its input SourceStreams.
|
(package private) void |
setInStreams(java.util.Collection<InStreamDesc> inStreams)
Sets the SourceStreams (in the form of InStreamDesc)
from which this instance is to read audio samples and push them to the
AudioMixingPushBufferStreams for audio mixing.
|
void |
setTransferHandler(javax.media.protocol.BufferTransferHandler transferHandler)
Implements
PushBufferStream.setTransferHandler(BufferTransferHandler) . |
protected void |
transferData(javax.media.Buffer buffer)
Reads audio samples from the input SourceStreams of this
instance and pushes them to its output
AudioMixingPushBufferStreams for audio mixing.
|
getControls
getControl, getControl, queryInterface, queryInterface
public AudioMixerPushBufferStream(AudioMixer audioMixer, javax.media.format.AudioFormat outFormat)
audioMixer
- the AudioMixer which creates this instance and
for which it is to output dataoutFormat
- the AudioFormat in which the new instance is to
output datavoid addOutStream(AudioMixingPushBufferStream outStream) throws java.io.IOException
outStream
- the AudioMixingPushBufferStream to add to the
collection of such streams to which this instance is to push the data for
audio mixing it reads from its input SourceStreamsjava.io.IOException
- if outStream was the first
AudioMixingPushBufferStream and the AudioMixer failed
to startpublic boolean endOfStream()
SourceStream.endOfStream()
. Delegates to the input
SourceStreams of this instance.endOfStream
in interface javax.media.protocol.SourceStream
void equalizeInStreamBufferLength()
public javax.media.protocol.ContentDescriptor getContentDescriptor()
SourceStream.getContentDescriptor()
. Returns a
ContentDescriptor which describes the content type of this
instance.getContentDescriptor
in interface javax.media.protocol.SourceStream
public long getContentLength()
SourceStream.getContentLength()
. Delegates to the
input SourceStreams of this instance.getContentLength
in interface javax.media.protocol.SourceStream
public javax.media.format.AudioFormat getFormat()
PushBufferStream.getFormat()
. Returns the
AudioFormat in which this instance was configured to output its
data.getFormat
in interface javax.media.protocol.PushBufferStream
InStreamDesc[] getInStreams()
public void read(javax.media.Buffer buffer) throws java.io.IOException
PushBufferStream.read(Buffer)
. Reads audio samples
from the input SourceStreams of this instance in various
formats, converts the read audio samples to one and the same format and
pushes them to the output AudioMixingPushBufferStreams for the
very audio mixing.read
in interface javax.media.protocol.PushBufferStream
buffer
- the Buffer in which the audio samples read from
the input SourceStreams are to be returned to the callerjava.io.IOException
- if any of the input SourceStreams throws
such an exception while reading from them or anything else goes wrongvoid removeOutStream(AudioMixingPushBufferStream outStream) throws java.io.IOException
outStream
- the AudioMixingPushBufferStream to remove from
the collection of such streams to which this instance pushes the data for
audio mixing it reads from its input SourceStreamsjava.io.IOException
- if outStream was the last
AudioMixingPushBufferStream and the AudioMixer failed
to stopvoid setInStreams(java.util.Collection<InStreamDesc> inStreams)
inStreams
- the SourceStreams (in the form of
InStreamDesc) from which this instance is to read audio
samples and push them to the AudioMixingPushBufferStreams for
audio mixingpublic void setTransferHandler(javax.media.protocol.BufferTransferHandler transferHandler)
PushBufferStream.setTransferHandler(BufferTransferHandler)
.
Because this instance pushes data to multiple output
AudioMixingPushBufferStreams, a single
BufferTransferHandler is not sufficient and thus this method is
unsupported and throws UnsupportedOperationException.setTransferHandler
in interface javax.media.protocol.PushBufferStream
transferHandler
- the BufferTransferHandler to be notified
by this PushBufferStream when media is available for readingprotected void transferData(javax.media.Buffer buffer)
buffer
- the cached Buffer instance to be used during the
execution of the method in order to reduce garbage collection. The
length of the buffer will be reset to 0 before
and after the execution of the method.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.