Class WASAPI
- java.lang.Object
-
- org.jitsi.impl.neomedia.jmfext.media.protocol.wasapi.WASAPI
-
public class WASAPI extends Object
Defines the native interface to Windows Audio Session API (WASAPI) and related Core Audio APIs such as Multimedia Device (MMDevice) API as used by WASAPISystem and its associated CaptureDevice, DataSource and Renderer implementations.- Author:
- Lyubomir Marinov
-
-
Field Summary
Fields Modifier and Type Field Description static intAUDCLNT_E_NOT_STOPPEDstatic intAUDCLNT_SHAREMODE_SHAREDstatic intAUDCLNT_STREAMFLAGS_EVENTCALLBACKstatic intAUDCLNT_STREAMFLAGS_LOOPBACKstatic intAUDCLNT_STREAMFLAGS_NOPERSISTstatic intCLSCTX_ALLstatic StringCLSID_MMDeviceEnumeratorstatic intCOINIT_MULTITHREADEDstatic intDEVICE_STATE_ACTIVEstatic inteAllstatic inteCapturestatic inteRenderstatic StringIID_IAudioCaptureClientstatic StringIID_IAudioClientstatic StringIID_IAudioRenderClientstatic StringIID_IMMDeviceEnumeratorstatic StringIID_IMMEndpointstatic longPKEY_Device_FriendlyNamestatic intRPC_E_CHANGED_MODEstatic intS_FALSEstatic intS_OKstatic intSTGM_READstatic intWAIT_ABANDONEDThe return value ofWaitForSingleObject(long, long)which indicates that the specified object is a mutex that was not released by the thread that owned the mutex before the owning thread terminated.static intWAIT_FAILEDThe return value ofWaitForSingleObject(long, long)which indicates that the function has failed.static intWAIT_OBJECT_0The return value ofWaitForSingleObject(long, long)which indicates that the specified object is signaled.static intWAIT_TIMEOUTThe return value ofWaitForSingleObject(long, long)which indicates that the specified time-out interval has elapsed and the state of the specified object is non-signaled.static charWAVE_FORMAT_PCM
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidCloseHandle(long hObject)static StringCoCreateGuid()static longCoCreateInstance(String clsid, long pUnkOuter, int dwClsContext, String iid)static intCoInitializeEx(long pvReserved, int dwCoInit)static voidCoTaskMemFree(long pv)static voidCoUninitialize()static longCreateEvent(long lpEventAttributes, boolean bManualReset, boolean bInitialState, String lpName)static booleanFAILED(int hresult)Determines whether a specific HRESULT value indicates failure.static intIAudioCaptureClient_GetNextPacketSize(long thiz)static intIAudioCaptureClient_Read(long thiz, byte[] data, int offset, int length, int srcSampleSize, int srcChannels, int dstSampleSize, int dstChannels)static voidIAudioCaptureClient_Release(long thiz)static intIAudioClient_GetBufferSize(long thiz)static intIAudioClient_GetCurrentPadding(long thiz)static longIAudioClient_GetDefaultDevicePeriod(long thiz)static longIAudioClient_GetMinimumDevicePeriod(long thiz)static longIAudioClient_GetService(long thiz, String iid)static intIAudioClient_Initialize(long thiz, int shareMode, int streamFlags, long hnsBufferDuration, long hnsPeriodicity, long pFormat, String audioSessionGuid)static longIAudioClient_IsFormatSupported(long thiz, int shareMode, long pFormat)static voidIAudioClient_Release(long thiz)static voidIAudioClient_SetEventHandle(long thiz, long eventHandle)static intIAudioClient_Start(long thiz)static intIAudioClient_Stop(long thiz)static voidIAudioRenderClient_Release(long thiz)static intIAudioRenderClient_Write(long thiz, byte[] data, int offset, int length, int srcSampleSize, int srcChannels, int dstSampleSize, int dstChannels)Writes specific audio data into the rendering endpoint buffer of a specific IAudioRenderClient.static longIMMDevice_Activate(long thiz, String iid, int dwClsCtx, long pActivationParams)static StringIMMDevice_GetId(long thiz)static intIMMDevice_GetState(long thiz)static longIMMDevice_OpenPropertyStore(long thiz, int stgmAccess)static longIMMDevice_QueryInterface(long thiz, String iid)static voidIMMDevice_Release(long thiz)static intIMMDeviceCollection_GetCount(long thiz)static longIMMDeviceCollection_Item(long thiz, int nDevice)static voidIMMDeviceCollection_Release(long thiz)static longIMMDeviceEnumerator_EnumAudioEndpoints(long thiz, int dataFlow, int dwStateMask)static longIMMDeviceEnumerator_GetDevice(long thiz, String pwstrId)static voidIMMDeviceEnumerator_Release(long thiz)static intIMMEndpoint_GetDataFlow(long thiz)static voidIMMEndpoint_Release(long thiz)static StringIPropertyStore_GetString(long thiz, long key)static voidIPropertyStore_Release(long thiz)static longPSPropertyKeyFromString(String pszString)static voidResetEvent(long hEvent)static booleanSUCCEEDED(int hresult)Determines whether a specific HRESULT value indicates success.static intWaitForSingleObject(long hHandle, long dwMilliseconds)Waits until the specified object is in the signaled state or the specified time-out interval elapses.static longWAVEFORMATEX_alloc()static voidWAVEFORMATEX_fill(long thiz, char wFormatTag, char nChannels, int nSamplesPerSec, int nAvgBytesPerSec, char nBlockAlign, char wBitsPerSample, char cbSize)static charWAVEFORMATEX_getCbSize(long thiz)static intWAVEFORMATEX_getNAvgBytesPerSec(long thiz)static charWAVEFORMATEX_getNBlockAlign(long thiz)static charWAVEFORMATEX_getNChannels(long thiz)static intWAVEFORMATEX_getNSamplesPerSec(long thiz)static charWAVEFORMATEX_getWBitsPerSample(long thiz)static charWAVEFORMATEX_getWFormatTag(long thiz)static voidWAVEFORMATEX_setCbSize(long thiz, char cbSize)static voidWAVEFORMATEX_setNAvgBytesPerSec(long thiz, int nAvgBytesPerSec)static voidWAVEFORMATEX_setNBlockAlign(long thiz, char nBlockAlign)static voidWAVEFORMATEX_setNChannels(long thiz, char nChannels)static voidWAVEFORMATEX_setNSamplesPerSec(long thiz, int nSamplesPerSec)static voidWAVEFORMATEX_setWBitsPerSample(long thiz, char wBitsPerSample)static voidWAVEFORMATEX_setWFormatTag(long thiz, char wFormatTag)static intWAVEFORMATEX_sizeof()
-
-
-
Field Detail
-
AUDCLNT_E_NOT_STOPPED
public static final int AUDCLNT_E_NOT_STOPPED
-
AUDCLNT_SHAREMODE_SHARED
public static final int AUDCLNT_SHAREMODE_SHARED
- See Also:
- Constant Field Values
-
AUDCLNT_STREAMFLAGS_EVENTCALLBACK
public static final int AUDCLNT_STREAMFLAGS_EVENTCALLBACK
- See Also:
- Constant Field Values
-
AUDCLNT_STREAMFLAGS_LOOPBACK
public static final int AUDCLNT_STREAMFLAGS_LOOPBACK
- See Also:
- Constant Field Values
-
AUDCLNT_STREAMFLAGS_NOPERSIST
public static final int AUDCLNT_STREAMFLAGS_NOPERSIST
- See Also:
- Constant Field Values
-
CLSCTX_ALL
public static final int CLSCTX_ALL
- See Also:
- Constant Field Values
-
CLSID_MMDeviceEnumerator
public static final String CLSID_MMDeviceEnumerator
- See Also:
- Constant Field Values
-
COINIT_MULTITHREADED
public static final int COINIT_MULTITHREADED
- See Also:
- Constant Field Values
-
DEVICE_STATE_ACTIVE
public static final int DEVICE_STATE_ACTIVE
- See Also:
- Constant Field Values
-
eAll
public static final int eAll
- See Also:
- Constant Field Values
-
eCapture
public static final int eCapture
- See Also:
- Constant Field Values
-
eRender
public static final int eRender
- See Also:
- Constant Field Values
-
IID_IAudioCaptureClient
public static final String IID_IAudioCaptureClient
- See Also:
- Constant Field Values
-
IID_IAudioClient
public static final String IID_IAudioClient
- See Also:
- Constant Field Values
-
IID_IAudioRenderClient
public static final String IID_IAudioRenderClient
- See Also:
- Constant Field Values
-
IID_IMMDeviceEnumerator
public static final String IID_IMMDeviceEnumerator
- See Also:
- Constant Field Values
-
IID_IMMEndpoint
public static final String IID_IMMEndpoint
- See Also:
- Constant Field Values
-
PKEY_Device_FriendlyName
public static final long PKEY_Device_FriendlyName
-
RPC_E_CHANGED_MODE
public static final int RPC_E_CHANGED_MODE
- See Also:
- Constant Field Values
-
S_FALSE
public static final int S_FALSE
- See Also:
- Constant Field Values
-
S_OK
public static final int S_OK
- See Also:
- Constant Field Values
-
STGM_READ
public static final int STGM_READ
- See Also:
- Constant Field Values
-
WAIT_ABANDONED
public static final int WAIT_ABANDONED
The return value ofWaitForSingleObject(long, long)which indicates that the specified object is a mutex that was not released by the thread that owned the mutex before the owning thread terminated. Ownership of the mutex is granted to the calling thread and the mutex state is set to non-signaled.- See Also:
- Constant Field Values
-
WAIT_FAILED
public static final int WAIT_FAILED
The return value ofWaitForSingleObject(long, long)which indicates that the function has failed. Normally, the function will throw anHResultExceptionin the case andHResultException.getHResult()will return WAIT_FAILED.- See Also:
- Constant Field Values
-
WAIT_OBJECT_0
public static final int WAIT_OBJECT_0
The return value ofWaitForSingleObject(long, long)which indicates that the specified object is signaled.- See Also:
- Constant Field Values
-
WAIT_TIMEOUT
public static final int WAIT_TIMEOUT
The return value ofWaitForSingleObject(long, long)which indicates that the specified time-out interval has elapsed and the state of the specified object is non-signaled.- See Also:
- Constant Field Values
-
WAVE_FORMAT_PCM
public static final char WAVE_FORMAT_PCM
- See Also:
- Constant Field Values
-
-
Method Detail
-
CloseHandle
public static void CloseHandle(long hObject) throws HResultException- Throws:
HResultException
-
CoCreateGuid
public static String CoCreateGuid() throws HResultException
- Throws:
HResultException
-
CoCreateInstance
public static long CoCreateInstance(String clsid, long pUnkOuter, int dwClsContext, String iid) throws HResultException
- Throws:
HResultException
-
CoInitializeEx
public static int CoInitializeEx(long pvReserved, int dwCoInit) throws HResultException- Throws:
HResultException
-
CoTaskMemFree
public static void CoTaskMemFree(long pv)
-
CoUninitialize
public static void CoUninitialize()
-
CreateEvent
public static long CreateEvent(long lpEventAttributes, boolean bManualReset, boolean bInitialState, String lpName) throws HResultException- Throws:
HResultException
-
FAILED
public static boolean FAILED(int hresult)
Determines whether a specific HRESULT value indicates failure.- Parameters:
hresult- the HRESULT value to be checked whether it indicates failure- Returns:
- true if the specified hresult indicates failure; otherwise, false
-
IAudioCaptureClient_GetNextPacketSize
public static int IAudioCaptureClient_GetNextPacketSize(long thiz) throws HResultException- Throws:
HResultException
-
IAudioCaptureClient_Read
public static int IAudioCaptureClient_Read(long thiz, byte[] data, int offset, int length, int srcSampleSize, int srcChannels, int dstSampleSize, int dstChannels) throws HResultException- Throws:
HResultException
-
IAudioCaptureClient_Release
public static void IAudioCaptureClient_Release(long thiz)
-
IAudioClient_GetBufferSize
public static int IAudioClient_GetBufferSize(long thiz) throws HResultException- Throws:
HResultException
-
IAudioClient_GetCurrentPadding
public static int IAudioClient_GetCurrentPadding(long thiz) throws HResultException- Throws:
HResultException
-
IAudioClient_GetDefaultDevicePeriod
public static long IAudioClient_GetDefaultDevicePeriod(long thiz) throws HResultException- Throws:
HResultException
-
IAudioClient_GetMinimumDevicePeriod
public static long IAudioClient_GetMinimumDevicePeriod(long thiz) throws HResultException- Throws:
HResultException
-
IAudioClient_GetService
public static long IAudioClient_GetService(long thiz, String iid) throws HResultException- Throws:
HResultException
-
IAudioClient_Initialize
public static int IAudioClient_Initialize(long thiz, int shareMode, int streamFlags, long hnsBufferDuration, long hnsPeriodicity, long pFormat, String audioSessionGuid) throws HResultException- Throws:
HResultException
-
IAudioClient_IsFormatSupported
public static long IAudioClient_IsFormatSupported(long thiz, int shareMode, long pFormat) throws HResultException- Throws:
HResultException
-
IAudioClient_Release
public static void IAudioClient_Release(long thiz)
-
IAudioClient_SetEventHandle
public static void IAudioClient_SetEventHandle(long thiz, long eventHandle) throws HResultException- Throws:
HResultException
-
IAudioClient_Start
public static int IAudioClient_Start(long thiz) throws HResultException- Throws:
HResultException
-
IAudioClient_Stop
public static int IAudioClient_Stop(long thiz) throws HResultException- Throws:
HResultException
-
IAudioRenderClient_Release
public static void IAudioRenderClient_Release(long thiz)
-
IAudioRenderClient_Write
public static int IAudioRenderClient_Write(long thiz, byte[] data, int offset, int length, int srcSampleSize, int srcChannels, int dstSampleSize, int dstChannels) throws HResultExceptionWrites specific audio data into the rendering endpoint buffer of a specific IAudioRenderClient. If the sample sizes and/or the numbers of channels of the specified audio data and the specified rendering endpoint buffer differ, the method may be able to perform the necessary conversions.- Parameters:
thiz- the IAudioRenderClient which abstracts the rendering endpoint buffer into which the specified audio data is to be writtendata- the bytes of the audio samples to be written into the specified rendering endpoint bufferoffset- the offset in bytes within data at which valid audio samples beginlength- the number of bytes of valid audio samples in datasrcSampleSize- the size in bytes of an audio sample in datasrcChannels- the number of channels of the audio signal provided in datadstSampleSize- the size in bytes of an audio sample in the rendering endpoint bufferdstChannels- the number of channels with which the rendering endpoint buffer has been initialized- Returns:
- the number of bytes which have been read from data (beginning at offset, of course) and successfully written into the rendering endpoint buffer
- Throws:
HResultException- if an HRESULT value indicating an error is returned by a function invoked by the method implementation or an I/O error is encountered during the execution of the method
-
IMMDevice_Activate
public static long IMMDevice_Activate(long thiz, String iid, int dwClsCtx, long pActivationParams) throws HResultException- Throws:
HResultException
-
IMMDevice_GetId
public static String IMMDevice_GetId(long thiz) throws HResultException
- Throws:
HResultException
-
IMMDevice_GetState
public static int IMMDevice_GetState(long thiz) throws HResultException- Throws:
HResultException
-
IMMDevice_OpenPropertyStore
public static long IMMDevice_OpenPropertyStore(long thiz, int stgmAccess) throws HResultException- Throws:
HResultException
-
IMMDevice_QueryInterface
public static long IMMDevice_QueryInterface(long thiz, String iid) throws HResultException- Throws:
HResultException
-
IMMDevice_Release
public static void IMMDevice_Release(long thiz)
-
IMMDeviceCollection_GetCount
public static int IMMDeviceCollection_GetCount(long thiz) throws HResultException- Throws:
HResultException
-
IMMDeviceCollection_Item
public static long IMMDeviceCollection_Item(long thiz, int nDevice) throws HResultException- Throws:
HResultException
-
IMMDeviceCollection_Release
public static void IMMDeviceCollection_Release(long thiz)
-
IMMDeviceEnumerator_EnumAudioEndpoints
public static long IMMDeviceEnumerator_EnumAudioEndpoints(long thiz, int dataFlow, int dwStateMask) throws HResultException- Throws:
HResultException
-
IMMDeviceEnumerator_GetDevice
public static long IMMDeviceEnumerator_GetDevice(long thiz, String pwstrId) throws HResultException- Throws:
HResultException
-
IMMDeviceEnumerator_Release
public static void IMMDeviceEnumerator_Release(long thiz)
-
IMMEndpoint_GetDataFlow
public static int IMMEndpoint_GetDataFlow(long thiz) throws HResultException- Throws:
HResultException
-
IMMEndpoint_Release
public static void IMMEndpoint_Release(long thiz)
-
IPropertyStore_GetString
public static String IPropertyStore_GetString(long thiz, long key) throws HResultException
- Throws:
HResultException
-
IPropertyStore_Release
public static void IPropertyStore_Release(long thiz)
-
PSPropertyKeyFromString
public static long PSPropertyKeyFromString(String pszString) throws HResultException
- Throws:
HResultException
-
ResetEvent
public static void ResetEvent(long hEvent) throws HResultException- Throws:
HResultException
-
SUCCEEDED
public static boolean SUCCEEDED(int hresult)
Determines whether a specific HRESULT value indicates success.- Parameters:
hresult- the HRESULT value to be checked whether it indicates success- Returns:
- true if the specified hresult indicates success; otherwise, false
-
WaitForSingleObject
public static int WaitForSingleObject(long hHandle, long dwMilliseconds) throws HResultExceptionWaits until the specified object is in the signaled state or the specified time-out interval elapses.- Parameters:
hHandle- a HANDLE to the object to wait fordwMilliseconds- the time-out interval in milliseconds to wait. If a nonzero value is specified, the function waits until the specified object is signaled or the specified time-out interval elapses. If dwMilliseconds is zero, the function does not enter a wait state if the specified object is not signaled; it always returns immediately. If dwMilliseconds is INFINITE, the function will return only when the specified object is signaled.- Returns:
- one of the WAIT_XXX constant values defined by the WASAPI class to indicate the event that caused the function to return
- Throws:
HResultException- if the return value isWAIT_FAILED
-
WAVEFORMATEX_alloc
public static long WAVEFORMATEX_alloc()
-
WAVEFORMATEX_fill
public static void WAVEFORMATEX_fill(long thiz, char wFormatTag, char nChannels, int nSamplesPerSec, int nAvgBytesPerSec, char nBlockAlign, char wBitsPerSample, char cbSize)
-
WAVEFORMATEX_getCbSize
public static char WAVEFORMATEX_getCbSize(long thiz)
-
WAVEFORMATEX_getNAvgBytesPerSec
public static int WAVEFORMATEX_getNAvgBytesPerSec(long thiz)
-
WAVEFORMATEX_getNBlockAlign
public static char WAVEFORMATEX_getNBlockAlign(long thiz)
-
WAVEFORMATEX_getNChannels
public static char WAVEFORMATEX_getNChannels(long thiz)
-
WAVEFORMATEX_getNSamplesPerSec
public static int WAVEFORMATEX_getNSamplesPerSec(long thiz)
-
WAVEFORMATEX_getWBitsPerSample
public static char WAVEFORMATEX_getWBitsPerSample(long thiz)
-
WAVEFORMATEX_getWFormatTag
public static char WAVEFORMATEX_getWFormatTag(long thiz)
-
WAVEFORMATEX_setCbSize
public static void WAVEFORMATEX_setCbSize(long thiz, char cbSize)
-
WAVEFORMATEX_setNAvgBytesPerSec
public static void WAVEFORMATEX_setNAvgBytesPerSec(long thiz, int nAvgBytesPerSec)
-
WAVEFORMATEX_setNBlockAlign
public static void WAVEFORMATEX_setNBlockAlign(long thiz, char nBlockAlign)
-
WAVEFORMATEX_setNChannels
public static void WAVEFORMATEX_setNChannels(long thiz, char nChannels)
-
WAVEFORMATEX_setNSamplesPerSec
public static void WAVEFORMATEX_setNSamplesPerSec(long thiz, int nSamplesPerSec)
-
WAVEFORMATEX_setWBitsPerSample
public static void WAVEFORMATEX_setWBitsPerSample(long thiz, char wBitsPerSample)
-
WAVEFORMATEX_setWFormatTag
public static void WAVEFORMATEX_setWFormatTag(long thiz, char wFormatTag)
-
WAVEFORMATEX_sizeof
public static int WAVEFORMATEX_sizeof()
-
-