amstream: Implement AMAudioData::GetFormat.
Signed-off-by: Anton Baskanov <baskanov@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
634deaf874
commit
fa542355e9
|
@ -34,6 +34,7 @@ typedef struct {
|
|||
BYTE *data;
|
||||
BOOL data_owned;
|
||||
DWORD actual_data;
|
||||
WAVEFORMATEX wave_format;
|
||||
} AMAudioDataImpl;
|
||||
|
||||
static inline AMAudioDataImpl *impl_from_IAudioData(IAudioData *iface)
|
||||
|
@ -168,9 +169,18 @@ static HRESULT WINAPI IAudioDataImpl_SetActual(IAudioData* iface, DWORD data_val
|
|||
/*** IAudioData methods ***/
|
||||
static HRESULT WINAPI IAudioDataImpl_GetFormat(IAudioData* iface, WAVEFORMATEX *wave_format_current)
|
||||
{
|
||||
FIXME("(%p)->(%p): stub\n", iface, wave_format_current);
|
||||
AMAudioDataImpl *This = impl_from_IAudioData(iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", iface, wave_format_current);
|
||||
|
||||
if (!wave_format_current)
|
||||
{
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
*wave_format_current = This->wave_format;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioDataImpl_SetFormat(IAudioData* iface, const WAVEFORMATEX *wave_format)
|
||||
|
@ -211,6 +221,13 @@ HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|||
object->IAudioData_iface.lpVtbl = &AudioData_Vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
object->wave_format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
object->wave_format.nChannels = 1;
|
||||
object->wave_format.nSamplesPerSec = 11025;
|
||||
object->wave_format.wBitsPerSample = 16;
|
||||
object->wave_format.nBlockAlign = object->wave_format.wBitsPerSample * object->wave_format.nChannels / 8;
|
||||
object->wave_format.nAvgBytesPerSec = object->wave_format.nBlockAlign * object->wave_format.nSamplesPerSec;
|
||||
|
||||
*ppObj = &object->IAudioData_iface;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -745,6 +745,48 @@ out_unknown:
|
|||
IUnknown_Release(unknown);
|
||||
}
|
||||
|
||||
static void test_audiodata_get_format(void)
|
||||
{
|
||||
IUnknown *unknown = create_audio_data();
|
||||
IAudioData *audio_data = NULL;
|
||||
WAVEFORMATEX wave_format = {0};
|
||||
|
||||
HRESULT result;
|
||||
|
||||
result = IUnknown_QueryInterface(unknown, &IID_IAudioData, (void **)&audio_data);
|
||||
if (FAILED(result))
|
||||
{
|
||||
/* test_audiodata_query_interface handles this case */
|
||||
skip("No IAudioData\n");
|
||||
goto out_unknown;
|
||||
}
|
||||
|
||||
result = IAudioData_GetFormat(audio_data, NULL);
|
||||
ok(E_POINTER == result, "got 0x%08x\n", result);
|
||||
|
||||
wave_format.wFormatTag = 0xdead;
|
||||
wave_format.nChannels = 0xdead;
|
||||
wave_format.nSamplesPerSec = 0xdeadbeef;
|
||||
wave_format.nAvgBytesPerSec = 0xdeadbeef;
|
||||
wave_format.nBlockAlign = 0xdead;
|
||||
wave_format.wBitsPerSample = 0xdead;
|
||||
wave_format.cbSize = 0xdead;
|
||||
result = IAudioData_GetFormat(audio_data, &wave_format);
|
||||
ok(S_OK == result, "got 0x%08x\n", result);
|
||||
ok(WAVE_FORMAT_PCM == wave_format.wFormatTag, "got %u\n", wave_format.wFormatTag);
|
||||
ok(1 == wave_format.nChannels, "got %u\n", wave_format.nChannels);
|
||||
ok(11025 == wave_format.nSamplesPerSec, "got %u\n", wave_format.nSamplesPerSec);
|
||||
ok(22050 == wave_format.nAvgBytesPerSec, "got %u\n", wave_format.nAvgBytesPerSec);
|
||||
ok(2 == wave_format.nBlockAlign, "got %u\n", wave_format.nBlockAlign);
|
||||
ok(16 == wave_format.wBitsPerSample, "got %u\n", wave_format.wBitsPerSample);
|
||||
ok(0 == wave_format.cbSize, "got %u\n", wave_format.cbSize);
|
||||
|
||||
IAudioData_Release(audio_data);
|
||||
|
||||
out_unknown:
|
||||
IUnknown_Release(unknown);
|
||||
}
|
||||
|
||||
START_TEST(amstream)
|
||||
{
|
||||
HANDLE file;
|
||||
|
@ -767,6 +809,7 @@ START_TEST(amstream)
|
|||
test_audiodata_get_info();
|
||||
test_audiodata_set_buffer();
|
||||
test_audiodata_set_actual();
|
||||
test_audiodata_get_format();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue