Commit 352d493e authored by Davide Beatrici's avatar Davide Beatrici Committed by Alexandre Julliard

winepulse: Move AudioClock into mmdevapi.

parent 8ae0c308
...@@ -48,11 +48,173 @@ void set_stream_volumes(struct audio_client *This) ...@@ -48,11 +48,173 @@ void set_stream_volumes(struct audio_client *This)
WINE_UNIX_CALL(set_volumes, &params); WINE_UNIX_CALL(set_volumes, &params);
} }
static inline struct audio_client *impl_from_IAudioClock(IAudioClock *iface)
{
return CONTAINING_RECORD(iface, struct audio_client, IAudioClock_iface);
}
static inline struct audio_client *impl_from_IAudioClock2(IAudioClock2 *iface)
{
return CONTAINING_RECORD(iface, struct audio_client, IAudioClock2_iface);
}
static inline struct audio_client *impl_from_IAudioStreamVolume(IAudioStreamVolume *iface) static inline struct audio_client *impl_from_IAudioStreamVolume(IAudioStreamVolume *iface)
{ {
return CONTAINING_RECORD(iface, struct audio_client, IAudioStreamVolume_iface); return CONTAINING_RECORD(iface, struct audio_client, IAudioStreamVolume_iface);
} }
static HRESULT WINAPI clock_QueryInterface(IAudioClock *iface, REFIID riid, void **ppv)
{
struct audio_client *This = impl_from_IAudioClock(iface);
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
if (!ppv)
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IAudioClock))
*ppv = iface;
else if (IsEqualIID(riid, &IID_IAudioClock2))
*ppv = &This->IAudioClock2_iface;
else if (IsEqualIID(riid, &IID_IMarshal)) {
return IUnknown_QueryInterface(This->marshal, riid, ppv);
} else {
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*ppv);
return S_OK;
}
static ULONG WINAPI clock_AddRef(IAudioClock *iface)
{
struct audio_client *This = impl_from_IAudioClock(iface);
return IAudioClient3_AddRef(&This->IAudioClient3_iface);
}
static ULONG WINAPI clock_Release(IAudioClock *iface)
{
struct audio_client *This = impl_from_IAudioClock(iface);
return IAudioClient3_Release(&This->IAudioClient3_iface);
}
static HRESULT WINAPI clock_GetFrequency(IAudioClock *iface, UINT64 *freq)
{
struct audio_client *This = impl_from_IAudioClock(iface);
struct get_frequency_params params;
TRACE("(%p)->(%p)\n", This, freq);
if (!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
params.stream = This->stream;
params.freq = freq;
WINE_UNIX_CALL(get_frequency, &params);
return params.result;
}
static HRESULT WINAPI clock_GetPosition(IAudioClock *iface, UINT64 *pos, UINT64 *qpctime)
{
struct audio_client *This = impl_from_IAudioClock(iface);
struct get_position_params params;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
if (!pos)
return E_POINTER;
if (!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
params.stream = This->stream;
params.device = FALSE;
params.pos = pos;
params.qpctime = qpctime;
WINE_UNIX_CALL(get_position, &params);
return params.result;
}
static HRESULT WINAPI clock_GetCharacteristics(IAudioClock *iface, DWORD *chars)
{
struct audio_client *This = impl_from_IAudioClock(iface);
TRACE("(%p)->(%p)\n", This, chars);
if (!chars)
return E_POINTER;
*chars = AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ;
return S_OK;
}
const IAudioClockVtbl AudioClock_Vtbl =
{
clock_QueryInterface,
clock_AddRef,
clock_Release,
clock_GetFrequency,
clock_GetPosition,
clock_GetCharacteristics
};
static HRESULT WINAPI clock2_QueryInterface(IAudioClock2 *iface, REFIID riid, void **ppv)
{
struct audio_client *This = impl_from_IAudioClock2(iface);
return IAudioClock_QueryInterface(&This->IAudioClock_iface, riid, ppv);
}
static ULONG WINAPI clock2_AddRef(IAudioClock2 *iface)
{
struct audio_client *This = impl_from_IAudioClock2(iface);
return IAudioClient3_AddRef(&This->IAudioClient3_iface);
}
static ULONG WINAPI clock2_Release(IAudioClock2 *iface)
{
struct audio_client *This = impl_from_IAudioClock2(iface);
return IAudioClient3_Release(&This->IAudioClient3_iface);
}
static HRESULT WINAPI clock2_GetDevicePosition(IAudioClock2 *iface, UINT64 *pos, UINT64 *qpctime)
{
struct audio_client *This = impl_from_IAudioClock2(iface);
struct get_position_params params;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
if (!pos)
return E_POINTER;
if (!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
params.stream = This->stream;
params.device = TRUE;
params.pos = pos;
params.qpctime = qpctime;
WINE_UNIX_CALL(get_position, &params);
return params.result;
}
const IAudioClock2Vtbl AudioClock2_Vtbl =
{
clock2_QueryInterface,
clock2_AddRef,
clock2_Release,
clock2_GetDevicePosition
};
static HRESULT WINAPI streamvolume_QueryInterface(IAudioStreamVolume *iface, REFIID riid, static HRESULT WINAPI streamvolume_QueryInterface(IAudioStreamVolume *iface, REFIID riid,
void **ppv) void **ppv)
{ {
......
...@@ -130,8 +130,8 @@ static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; ...@@ -130,8 +130,8 @@ static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl;
extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl;
extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
static const IAudioClockVtbl AudioClock_Vtbl; extern const IAudioClockVtbl AudioClock_Vtbl;
static const IAudioClock2Vtbl AudioClock2_Vtbl; extern const IAudioClock2Vtbl AudioClock2_Vtbl;
extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl;
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client); static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client);
...@@ -1542,155 +1542,6 @@ static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl = ...@@ -1542,155 +1542,6 @@ static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl =
AudioCaptureClient_GetNextPacketSize AudioCaptureClient_GetNextPacketSize
}; };
static HRESULT WINAPI AudioClock_QueryInterface(IAudioClock *iface,
REFIID riid, void **ppv)
{
ACImpl *This = impl_from_IAudioClock(iface);
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
if (!ppv)
return E_POINTER;
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IAudioClock))
*ppv = iface;
else if (IsEqualIID(riid, &IID_IAudioClock2))
*ppv = &This->IAudioClock2_iface;
if (*ppv) {
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
if (IsEqualIID(riid, &IID_IMarshal))
return IUnknown_QueryInterface(This->marshal, riid, ppv);
WARN("Unknown interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI AudioClock_AddRef(IAudioClock *iface)
{
ACImpl *This = impl_from_IAudioClock(iface);
return IAudioClient3_AddRef(&This->IAudioClient3_iface);
}
static ULONG WINAPI AudioClock_Release(IAudioClock *iface)
{
ACImpl *This = impl_from_IAudioClock(iface);
return IAudioClient3_Release(&This->IAudioClient3_iface);
}
static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
{
ACImpl *This = impl_from_IAudioClock(iface);
struct get_frequency_params params;
TRACE("(%p)->(%p)\n", This, freq);
if (!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
params.stream = This->stream;
params.freq = freq;
pulse_call(get_frequency, &params);
return params.result;
}
static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
UINT64 *qpctime)
{
ACImpl *This = impl_from_IAudioClock(iface);
struct get_position_params params;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
if (!pos)
return E_POINTER;
if (!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
params.stream = This->stream;
params.device = FALSE;
params.pos = pos;
params.qpctime = qpctime;
pulse_call(get_position, &params);
return params.result;
}
static HRESULT WINAPI AudioClock_GetCharacteristics(IAudioClock *iface,
DWORD *chars)
{
ACImpl *This = impl_from_IAudioClock(iface);
TRACE("(%p)->(%p)\n", This, chars);
if (!chars)
return E_POINTER;
*chars = AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ;
return S_OK;
}
static const IAudioClockVtbl AudioClock_Vtbl =
{
AudioClock_QueryInterface,
AudioClock_AddRef,
AudioClock_Release,
AudioClock_GetFrequency,
AudioClock_GetPosition,
AudioClock_GetCharacteristics
};
static HRESULT WINAPI AudioClock2_QueryInterface(IAudioClock2 *iface,
REFIID riid, void **ppv)
{
ACImpl *This = impl_from_IAudioClock2(iface);
return IAudioClock_QueryInterface(&This->IAudioClock_iface, riid, ppv);
}
static ULONG WINAPI AudioClock2_AddRef(IAudioClock2 *iface)
{
ACImpl *This = impl_from_IAudioClock2(iface);
return IAudioClient3_AddRef(&This->IAudioClient3_iface);
}
static ULONG WINAPI AudioClock2_Release(IAudioClock2 *iface)
{
ACImpl *This = impl_from_IAudioClock2(iface);
return IAudioClient3_Release(&This->IAudioClient3_iface);
}
static HRESULT WINAPI AudioClock2_GetDevicePosition(IAudioClock2 *iface,
UINT64 *pos, UINT64 *qpctime)
{
ACImpl *This = impl_from_IAudioClock2(iface);
struct get_position_params params;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
if (!pos)
return E_POINTER;
if (!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
params.stream = This->stream;
params.device = TRUE;
params.pos = pos;
params.qpctime = qpctime;
pulse_call(get_position, &params);
return params.result;
}
static const IAudioClock2Vtbl AudioClock2_Vtbl =
{
AudioClock2_QueryInterface,
AudioClock2_AddRef,
AudioClock2_Release,
AudioClock2_GetDevicePosition
};
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client)
{ {
AudioSessionWrapper *ret; AudioSessionWrapper *ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment