Package org.jitsi.impl.neomedia.device
Class AudioMixerMediaDevice
- java.lang.Object
-
- org.jitsi.impl.neomedia.device.AbstractMediaDevice
-
- org.jitsi.impl.neomedia.device.AudioMixerMediaDevice
-
- All Implemented Interfaces:
MediaDevice,MediaDeviceWrapper
public class AudioMixerMediaDevice extends AbstractMediaDevice implements MediaDeviceWrapper
Implements a MediaDevice which performs audio mixing usingAudioMixer.- Author:
- Lyubomir Marinov, Emil Ivov
-
-
Constructor Summary
Constructors Constructor Description AudioMixerMediaDevice(AudioMediaDeviceImpl device)Initializes a new AudioMixerMediaDevice instance which is to enable audio mixing on a specific AudioMediaDeviceImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect(javax.media.protocol.DataSource captureDevice)Connects to a specific CaptureDevice given in the form of a DataSource.AudioMixingPushBufferDataSourcecreateOutputDataSource()Creates a DataSource instance for this MediaDevice which gives access to the captured media.protected javax.media.ProcessorcreatePlayer(javax.media.protocol.DataSource dataSource)Initializes a new Processor instance which is to be used to play back media on this MediaDevice.protected javax.media.RenderercreateRenderer()Initializes a new Renderer instance which is to play back media on this MediaDevice.MediaDeviceSessioncreateSession()Creates a new MediaDeviceSession instance which is to represent the use of this MediaDevice by a MediaStream.MediaDirectiongetDirection()Returns the MediaDirection supported by this device.MediaFormatgetFormat()Gets the MediaFormat in which this MediaDevice captures media.org.jitsi.utils.MediaTypegetMediaType()Gets the MediaType that this device supports.List<RTPExtension>getSupportedExtensions()Returns a List containing (at the time of writing) a single extension descriptor indicating SENDRECV for mixer-to-client audio levels.List<MediaFormat>getSupportedFormats(QualityPreset sendPreset, QualityPreset receivePreset)Gets the list of MediaFormats supported by this MediaDevice.List<MediaFormat>getSupportedFormats(QualityPreset sendPreset, QualityPreset receivePreset, EncodingConfiguration encodingConfiguration)Gets the list of MediaFormats supported by this MediaDevice and enabled in encodingConfiguration.TranscodingDataSourcegetTranscodingDataSource(javax.media.protocol.DataSource inputDataSource)Returns the TranscodingDataSource associated with inputDataSource in this object's AudioMixer.MediaDevicegetWrappedDevice()Gets the actual MediaDevice which this MediaDevice is effectively built on top of and forwarding to.voidsetReceiveStreamBufferListener(ReceiveStreamBufferListener listener)Set the listener which gets notified when this MediaDevice reads data from a ReceiveStream-
Methods inherited from class org.jitsi.impl.neomedia.device.AbstractMediaDevice
getSupportedFormats
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jitsi.service.neomedia.device.MediaDevice
getSupportedFormats
-
-
-
-
Constructor Detail
-
AudioMixerMediaDevice
public AudioMixerMediaDevice(AudioMediaDeviceImpl device)
Initializes a new AudioMixerMediaDevice instance which is to enable audio mixing on a specific AudioMediaDeviceImpl.- Parameters:
device- the AudioMediaDeviceImpl which the new instance is to enable audio mixing on
-
-
Method Detail
-
connect
public void connect(javax.media.protocol.DataSource captureDevice) throws IOExceptionConnects to a specific CaptureDevice given in the form of a DataSource.- Overrides:
connectin classAbstractMediaDevice- Parameters:
captureDevice- the CaptureDevice to be connected to- Throws:
IOException- if anything wrong happens while connecting to the specified captureDevice- See Also:
AbstractMediaDevice.connect(DataSource)
-
createOutputDataSource
public AudioMixingPushBufferDataSource createOutputDataSource()
Creates a DataSource instance for this MediaDevice which gives access to the captured media.- Specified by:
createOutputDataSourcein classAbstractMediaDevice- Returns:
- a DataSource instance which gives access to the media captured by this MediaDevice
- See Also:
AbstractMediaDevice.createOutputDataSource()
-
createPlayer
protected javax.media.Processor createPlayer(javax.media.protocol.DataSource dataSource) throws ExceptionInitializes a new Processor instance which is to be used to play back media on this MediaDevice. Allows extenders to, for example, disable the playback on this MediaDevice by completely overriding and returning null. Delegates to theAbstractMediaDevice.createPlayer(DataSource)implementation of the MediaDevice on which this instance enables mixing i.e.getWrappedDevice().- Overrides:
createPlayerin classAbstractMediaDevice- Parameters:
dataSource- the DataSource which is to be played back by the new Processor instance- Returns:
- a new Processor instance which is to be used to play back the media provided by the specified dataSource or null if the specified dataSource is to not be played back
- Throws:
Exception- if an exception is thrown byDataSource.connect(),Manager.createProcessor(DataSource), orDataSource.disconnect()
-
createRenderer
protected javax.media.Renderer createRenderer()
Initializes a new Renderer instance which is to play back media on this MediaDevice. Allows extenders to initialize a specific Renderer instance. The implementation of AbstractMediaDevice returns null which means that it is left to FMJ to choose a suitable Renderer irrespective of this MediaDevice. Delegates to theAbstractMediaDevice.createRenderer()implementation of the MediaDevice on which this instance enables mixing i.e.getWrappedDevice().- Overrides:
createRendererin classAbstractMediaDevice- Returns:
- a new Renderer instance which is to play back media on this MediaDevice or null if a suitable Renderer is to be chosen irrespective of this MediaDevice
-
createSession
public MediaDeviceSession createSession()
Creates a new MediaDeviceSession instance which is to represent the use of this MediaDevice by a MediaStream.- Overrides:
createSessionin classAbstractMediaDevice- Returns:
- a new MediaDeviceSession instance which is to represent the use of this MediaDevice by a MediaStream
- See Also:
AbstractMediaDevice.createSession()
-
getDirection
public MediaDirection getDirection()
Returns the MediaDirection supported by this device.- Specified by:
getDirectionin interfaceMediaDevice- Returns:
MediaDirection.SENDONLYif this is a read-only device,MediaDirection.RECVONLYif this is a write-only device orMediaDirection.SENDRECVif this MediaDevice can both capture and render media- See Also:
MediaDevice.getDirection()
-
getFormat
public MediaFormat getFormat()
Gets the MediaFormat in which this MediaDevice captures media.- Specified by:
getFormatin interfaceMediaDevice- Returns:
- the MediaFormat in which this MediaDevice captures media
- See Also:
MediaDevice.getFormat()
-
getMediaType
public org.jitsi.utils.MediaType getMediaType()
Gets the MediaType that this device supports.- Specified by:
getMediaTypein interfaceMediaDevice- Returns:
MediaType.AUDIOif this is an audio device orMediaType.VIDEOif this is a video device- See Also:
MediaDevice.getMediaType()
-
getSupportedExtensions
public List<RTPExtension> getSupportedExtensions()
Returns a List containing (at the time of writing) a single extension descriptor indicating SENDRECV for mixer-to-client audio levels.- Specified by:
getSupportedExtensionsin interfaceMediaDevice- Overrides:
getSupportedExtensionsin classAbstractMediaDevice- Returns:
- a List containing the CSRC_AUDIO_LEVEL_URN extension descriptor.
-
getSupportedFormats
public List<MediaFormat> getSupportedFormats(QualityPreset sendPreset, QualityPreset receivePreset)
Gets the list of MediaFormats supported by this MediaDevice.- Specified by:
getSupportedFormatsin interfaceMediaDevice- Parameters:
sendPreset- not usedreceivePreset- not used- Returns:
- the list of MediaFormats supported by this MediaDevice
- See Also:
MediaDevice.getSupportedFormats()
-
setReceiveStreamBufferListener
public void setReceiveStreamBufferListener(ReceiveStreamBufferListener listener)
Set the listener which gets notified when this MediaDevice reads data from a ReceiveStream- Parameters:
listener- the ReceiveStreamBufferListener which gets notified
-
getSupportedFormats
public List<MediaFormat> getSupportedFormats(QualityPreset sendPreset, QualityPreset receivePreset, EncodingConfiguration encodingConfiguration)
Gets the list of MediaFormats supported by this MediaDevice and enabled in encodingConfiguration.- Specified by:
getSupportedFormatsin interfaceMediaDevice- Parameters:
sendPreset- not usedreceivePreset- not usedencodingConfiguration- the EncodingConfiguration instance to use- Returns:
- the list of MediaFormats supported by this MediaDevice and enabled in encodingConfiguration.
- See Also:
MediaDevice.getSupportedFormats(QualityPreset, QualityPreset, EncodingConfiguration)
-
getWrappedDevice
public MediaDevice getWrappedDevice()
Gets the actual MediaDevice which this MediaDevice is effectively built on top of and forwarding to.- Specified by:
getWrappedDevicein interfaceMediaDeviceWrapper- Returns:
- the actual MediaDevice which this MediaDevice is effectively built on top of and forwarding to
- See Also:
MediaDeviceWrapper.getWrappedDevice()
-
getTranscodingDataSource
public TranscodingDataSource getTranscodingDataSource(javax.media.protocol.DataSource inputDataSource)
Returns the TranscodingDataSource associated with inputDataSource in this object's AudioMixer.- Parameters:
inputDataSource- the DataSource to search for- Returns:
- Returns the TranscodingDataSource associated with inputDataSource in this object's AudioMixer
- See Also:
AudioMixer.getTranscodingDataSource(javax.media.protocol.DataSource)
-
-