Class WASAPIRenderer
- java.lang.Object
-
- org.jitsi.impl.neomedia.control.AbstractControls
-
- org.jitsi.impl.neomedia.control.ControlsAdapter
-
- org.jitsi.impl.neomedia.jmfext.media.renderer.AbstractRenderer<javax.media.format.AudioFormat>
-
- org.jitsi.impl.neomedia.jmfext.media.renderer.audio.AbstractAudioRenderer<WASAPISystem>
-
- org.jitsi.impl.neomedia.jmfext.media.renderer.audio.WASAPIRenderer
-
- All Implemented Interfaces:
javax.media.Controls,javax.media.PlugIn,javax.media.Renderer
public class WASAPIRenderer extends AbstractAudioRenderer<WASAPISystem>
Implements an audio Renderer using Windows Audio Session API (WASAPI) and related Core Audio APIs such as Multimedia Device (MMDevice) API.- Author:
- Lyubomir Marinov
-
-
Field Summary
-
Fields inherited from class org.jitsi.impl.neomedia.jmfext.media.renderer.audio.AbstractAudioRenderer
audioSystem, dataFlow, JAVA_AUDIO_FORMAT_ENDIAN, NATIVE_AUDIO_FORMAT_ENDIAN
-
Fields inherited from class org.jitsi.impl.neomedia.jmfext.media.renderer.AbstractRenderer
inputFormat
-
Fields inherited from class org.jitsi.impl.neomedia.control.ControlsAdapter
EMPTY_CONTROLS
-
-
Constructor Summary
Constructors Constructor Description WASAPIRenderer()Initializes a new WASAPIRenderer instance which is to perform playback (as opposed to sound a notification).WASAPIRenderer(boolean playback)Initializes a new WASAPIRenderer instance which is to either perform playback or sound a notification.WASAPIRenderer(AudioSystem.DataFlow dataFlow)Initializes a new WASAPIRenderer instance which is to either perform playback or sound a notification.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()StringgetName()javax.media.Format[]getSupportedInputFormats()Overrides the super implementation to handle the case in which the user has selected "none" for the playback/notify device.static javax.media.CodecmaybeOpenResampler(javax.media.format.AudioFormat inFormat, javax.media.format.AudioFormat outFormat)Attempts to initialize and open a new Codec to resample media data from a specific input AudioFormat into a specific output AudioFormat.voidopen()protected voidplaybackDevicePropertyChange(PropertyChangeEvent ev)Notifies this instance that the value of the property ofAbstractAudioRenderer.audioSystemwhich identifies the default notification or playback (as determined byAbstractAudioRenderer.dataFlow) device has changed.static intpop(byte[] array, int arrayLength, int length)Pops a specific number of bytes from (the head of) a specific array of bytes.intprocess(javax.media.Buffer buffer)javax.media.FormatsetInputFormat(javax.media.Format format)Sets the Format of the media data to be rendered by this Renderer.voidstart()voidstop()-
Methods inherited from class org.jitsi.impl.neomedia.jmfext.media.renderer.audio.AbstractAudioRenderer
getControls, getGainControl, getLocator, setLocator, setVolumeControl, useAudioThreadPriority
-
Methods inherited from class org.jitsi.impl.neomedia.jmfext.media.renderer.AbstractRenderer
reset, useThreadPriority
-
Methods inherited from class org.jitsi.impl.neomedia.control.AbstractControls
getControl, getControl, queryInterface, queryInterface
-
-
-
-
Constructor Detail
-
WASAPIRenderer
public WASAPIRenderer()
Initializes a new WASAPIRenderer instance which is to perform playback (as opposed to sound a notification).
-
WASAPIRenderer
public WASAPIRenderer(AudioSystem.DataFlow dataFlow)
Initializes a new WASAPIRenderer instance which is to either perform playback or sound a notification.- Parameters:
dataFlow-AudioSystem.DataFlow.PLAYBACKif the new instance is to perform playback orAudioSystem.DataFlow.NOTIFYif the new instance is to sound a notification
-
WASAPIRenderer
public WASAPIRenderer(boolean playback)
Initializes a new WASAPIRenderer instance which is to either perform playback or sound a notification.- Parameters:
playback- true if the new instance is to perform playback or false if the new instance is to sound a notification
-
-
Method Detail
-
maybeOpenResampler
public static javax.media.Codec maybeOpenResampler(javax.media.format.AudioFormat inFormat, javax.media.format.AudioFormat outFormat)Attempts to initialize and open a new Codec to resample media data from a specific input AudioFormat into a specific output AudioFormat. If no suitable resampler is found, returns null. If a suitable resampler is found but its initialization or opening fails, logs and swallows any Throwable and returns null.- Parameters:
inFormat- the AudioFormat in which the new instance is to input media dataoutFormat- the AudioFormat in which the new instance is to output media data- Returns:
- a new Codec which is able to resample media data from the specified inFormat into the specified outFormat if such a resampler could be found, initialized and opened; otherwise, null
-
pop
public static int pop(byte[] array, int arrayLength, int length)Pops a specific number of bytes from (the head of) a specific array of bytes.- Parameters:
array- the array of byte from which the specified number of bytes are to be poppedarrayLength- the number of elements in array which contain valid datalength- the number of bytes to be popped from array- Returns:
- the number of elements in array which contain valid data after the specified number of bytes have been popped from it
-
close
public void close()
- Specified by:
closein interfacejavax.media.PlugIn- Overrides:
closein classAbstractAudioRenderer<WASAPISystem>
-
getName
public String getName()
-
getSupportedInputFormats
public javax.media.Format[] getSupportedInputFormats()
Overrides the super implementation to handle the case in which the user has selected "none" for the playback/notify device.- Specified by:
getSupportedInputFormatsin interfacejavax.media.Renderer- Overrides:
getSupportedInputFormatsin classAbstractAudioRenderer<WASAPISystem>
-
open
public void open() throws javax.media.ResourceUnavailableException- Specified by:
openin interfacejavax.media.PlugIn- Overrides:
openin classAbstractAudioRenderer<WASAPISystem>- Throws:
javax.media.ResourceUnavailableException
-
playbackDevicePropertyChange
protected void playbackDevicePropertyChange(PropertyChangeEvent ev)
Notifies this instance that the value of the property ofAbstractAudioRenderer.audioSystemwhich identifies the default notification or playback (as determined byAbstractAudioRenderer.dataFlow) device has changed. The default implementation does nothing so extenders may safely not call back to their AbstractAudioRenderer super.- Overrides:
playbackDevicePropertyChangein classAbstractAudioRenderer<WASAPISystem>- Parameters:
ev- a PropertyChangeEvent which specifies details about the change such as the name of the property and its old and new values
-
process
public int process(javax.media.Buffer buffer)
-
setInputFormat
public javax.media.Format setInputFormat(javax.media.Format format)
Sets the Format of the media data to be rendered by this Renderer. Disallows mid-stream changes of the inputFormat of this AbstractRenderer.- Specified by:
setInputFormatin interfacejavax.media.Renderer- Overrides:
setInputFormatin classAbstractRenderer<javax.media.format.AudioFormat>- Parameters:
format- the Format of the media data to be rendered by this Renderer- Returns:
- null if the specified format is not compatible with this Renderer; otherwise, the Format which has been successfully set
-
start
public void start()
-
stop
public void stop()
-
-