wineoss: Use mmdevdrv structs from mmdevapi.
This commit is contained in:
parent
854066a589
commit
bdabe6a47b
1 changed files with 13 additions and 76 deletions
|
@ -44,6 +44,8 @@
|
|||
|
||||
#include "unixlib.h"
|
||||
|
||||
#include "../mmdevapi/mmdevdrv.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(oss);
|
||||
|
||||
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
|
||||
|
@ -51,71 +53,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(oss);
|
|||
static const REFERENCE_TIME DefaultPeriod = 100000;
|
||||
static const REFERENCE_TIME MinimumPeriod = 50000;
|
||||
|
||||
struct ACImpl;
|
||||
typedef struct ACImpl ACImpl;
|
||||
|
||||
typedef struct _AudioSession {
|
||||
GUID guid;
|
||||
struct list clients;
|
||||
|
||||
IMMDevice *device;
|
||||
|
||||
float master_vol;
|
||||
UINT32 channel_count;
|
||||
float *channel_vols;
|
||||
BOOL mute;
|
||||
|
||||
struct list entry;
|
||||
} AudioSession;
|
||||
|
||||
typedef struct _AudioSessionWrapper {
|
||||
IAudioSessionControl2 IAudioSessionControl2_iface;
|
||||
IChannelAudioVolume IChannelAudioVolume_iface;
|
||||
ISimpleAudioVolume ISimpleAudioVolume_iface;
|
||||
|
||||
LONG ref;
|
||||
|
||||
ACImpl *client;
|
||||
AudioSession *session;
|
||||
} AudioSessionWrapper;
|
||||
|
||||
struct ACImpl {
|
||||
IAudioClient3 IAudioClient3_iface;
|
||||
IAudioRenderClient IAudioRenderClient_iface;
|
||||
IAudioCaptureClient IAudioCaptureClient_iface;
|
||||
IAudioClock IAudioClock_iface;
|
||||
IAudioClock2 IAudioClock2_iface;
|
||||
IAudioStreamVolume IAudioStreamVolume_iface;
|
||||
|
||||
LONG ref;
|
||||
|
||||
IMMDevice *parent;
|
||||
IUnknown *pUnkFTMarshal;
|
||||
|
||||
EDataFlow dataflow;
|
||||
float *vols;
|
||||
UINT32 channel_count;
|
||||
stream_handle stream;
|
||||
|
||||
HANDLE timer_thread;
|
||||
|
||||
AudioSession *session;
|
||||
AudioSessionWrapper *session_wrapper;
|
||||
|
||||
struct list entry;
|
||||
|
||||
/* Keep at end */
|
||||
char devnode[0];
|
||||
};
|
||||
|
||||
typedef struct _SessionMgr {
|
||||
IAudioSessionManager2 IAudioSessionManager2_iface;
|
||||
|
||||
LONG ref;
|
||||
|
||||
IMMDevice *device;
|
||||
} SessionMgr;
|
||||
|
||||
typedef struct _OSSDevice {
|
||||
struct list entry;
|
||||
EDataFlow flow;
|
||||
|
@ -252,7 +189,7 @@ static HRESULT stream_release(stream_handle stream, HANDLE timer_thread)
|
|||
static DWORD WINAPI timer_thread(void *user)
|
||||
{
|
||||
struct timer_loop_params params;
|
||||
struct ACImpl *This = user;
|
||||
ACImpl *This = user;
|
||||
|
||||
params.stream = This->stream;
|
||||
OSS_CALL(timer_loop, ¶ms);
|
||||
|
@ -447,18 +384,18 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
|
|||
return AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
}
|
||||
len = strlen(oss_dev->devnode);
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, devnode[len + 1]));
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1]));
|
||||
if(!This)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->pUnkFTMarshal);
|
||||
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
|
||||
if (FAILED(hr)) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return hr;
|
||||
}
|
||||
|
||||
This->dataflow = oss_dev->flow;
|
||||
strcpy(This->devnode, oss_dev->devnode);
|
||||
strcpy(This->device_name, oss_dev->devnode);
|
||||
|
||||
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
|
||||
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
|
||||
|
@ -491,7 +428,7 @@ static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient3 *iface,
|
|||
IsEqualIID(riid, &IID_IAudioClient3))
|
||||
*ppv = iface;
|
||||
else if(IsEqualIID(riid, &IID_IMarshal))
|
||||
return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv);
|
||||
return IUnknown_QueryInterface(This->marshal, riid, ppv);
|
||||
if(*ppv){
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
|
@ -519,7 +456,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
|
|||
if(!ref){
|
||||
IAudioClient3_Stop(iface);
|
||||
IMMDevice_Release(This->parent);
|
||||
IUnknown_Release(This->pUnkFTMarshal);
|
||||
IUnknown_Release(This->marshal);
|
||||
if(This->session){
|
||||
EnterCriticalSection(&g_sessions_lock);
|
||||
list_remove(&This->entry);
|
||||
|
@ -711,7 +648,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
|
|||
}
|
||||
|
||||
params.name = NULL;
|
||||
params.device = This->devnode;
|
||||
params.device = This->device_name;
|
||||
params.flow = This->dataflow;
|
||||
params.share = mode;
|
||||
params.flags = flags;
|
||||
|
@ -831,7 +768,7 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface,
|
|||
TRACE("(%p)->(%x, %p, %p)\n", This, mode, fmt, out);
|
||||
if(fmt) dump_fmt(fmt);
|
||||
|
||||
params.device = This->devnode;
|
||||
params.device = This->device_name;
|
||||
params.flow = This->dataflow;
|
||||
params.share = mode;
|
||||
params.fmt_in = fmt;
|
||||
|
@ -864,7 +801,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface,
|
|||
return E_POINTER;
|
||||
*pwfx = NULL;
|
||||
|
||||
params.device = This->devnode;
|
||||
params.device = This->device_name;
|
||||
params.flow = This->dataflow;
|
||||
params.fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE));
|
||||
if(!params.fmt)
|
||||
|
@ -1193,7 +1130,7 @@ static HRESULT WINAPI AudioRenderClient_QueryInterface(
|
|||
IsEqualIID(riid, &IID_IAudioRenderClient))
|
||||
*ppv = iface;
|
||||
else if(IsEqualIID(riid, &IID_IMarshal))
|
||||
return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv);
|
||||
return IUnknown_QueryInterface(This->marshal, riid, ppv);
|
||||
if(*ppv){
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
|
@ -1274,7 +1211,7 @@ static HRESULT WINAPI AudioCaptureClient_QueryInterface(
|
|||
IsEqualIID(riid, &IID_IAudioCaptureClient))
|
||||
*ppv = iface;
|
||||
else if(IsEqualIID(riid, &IID_IMarshal))
|
||||
return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv);
|
||||
return IUnknown_QueryInterface(This->marshal, riid, ppv);
|
||||
if(*ppv){
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
|
|
Loading…
Add table
Reference in a new issue