Commit e89ab440 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

mp3dmod: Implement IMediaObject::GetInputSizeInfo().

parent b9b5560a
...@@ -52,7 +52,7 @@ struct mp3_decoder ...@@ -52,7 +52,7 @@ struct mp3_decoder
mpg123_handle *mh; mpg123_handle *mh;
DMO_MEDIA_TYPE intype, outtype; DMO_MEDIA_TYPE intype, outtype;
BOOL intype_set; BOOL intype_set, outtype_set;
IMediaBuffer *buffer; IMediaBuffer *buffer;
REFERENCE_TIME timestamp; REFERENCE_TIME timestamp;
...@@ -262,6 +262,7 @@ static HRESULT WINAPI MediaObject_SetOutputType(IMediaObject *iface, DWORD index ...@@ -262,6 +262,7 @@ static HRESULT WINAPI MediaObject_SetOutputType(IMediaObject *iface, DWORD index
if (flags & DMO_SET_TYPEF_CLEAR) if (flags & DMO_SET_TYPEF_CLEAR)
{ {
MoFreeMediaType(&This->outtype); MoFreeMediaType(&This->outtype);
This->outtype_set = FALSE;
return S_OK; return S_OK;
} }
...@@ -287,6 +288,7 @@ static HRESULT WINAPI MediaObject_SetOutputType(IMediaObject *iface, DWORD index ...@@ -287,6 +288,7 @@ static HRESULT WINAPI MediaObject_SetOutputType(IMediaObject *iface, DWORD index
return DMO_E_TYPE_NOT_ACCEPTED; return DMO_E_TYPE_NOT_ACCEPTED;
} }
MoCopyMediaType(&This->outtype, type); MoCopyMediaType(&This->outtype, type);
This->outtype_set = TRUE;
} }
return S_OK; return S_OK;
...@@ -306,11 +308,19 @@ static HRESULT WINAPI MediaObject_GetOutputCurrentType(IMediaObject *iface, DWOR ...@@ -306,11 +308,19 @@ static HRESULT WINAPI MediaObject_GetOutputCurrentType(IMediaObject *iface, DWOR
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI MediaObject_GetInputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, DWORD *max_lookahead, DWORD *alignment) static HRESULT WINAPI MediaObject_GetInputSizeInfo(IMediaObject *iface,
DWORD index, DWORD *size, DWORD *lookahead, DWORD *alignment)
{ {
FIXME("(%p)->(%d, %p, %p, %p) stub!\n", iface, index, size, max_lookahead, alignment); struct mp3_decoder *dmo = impl_from_IMediaObject(iface);
return E_NOTIMPL; TRACE("iface %p, index %u, size %p, lookahead %p, alignment %p.\n", iface, index, size, lookahead, alignment);
if (!dmo->intype_set || !dmo->outtype_set)
return DMO_E_TYPE_NOT_SET;
*size = 0;
*alignment = 1;
return S_OK;
} }
static HRESULT WINAPI MediaObject_GetOutputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, DWORD *alignment) static HRESULT WINAPI MediaObject_GetOutputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, DWORD *alignment)
......
...@@ -288,7 +288,36 @@ static void test_aggregation(void) ...@@ -288,7 +288,36 @@ static void test_aggregation(void)
static void test_stream_info(void) static void test_stream_info(void)
{ {
DWORD input_count, output_count, flags; static const MPEGLAYER3WAVEFORMAT input_format =
{
.wfx.nChannels = 2,
.wfx.nSamplesPerSec = 48000,
};
DMO_MEDIA_TYPE input_mt =
{
.majortype = MEDIATYPE_Audio,
.subtype = WMMEDIASUBTYPE_MP3,
.formattype = FORMAT_WaveFormatEx,
.cbFormat = sizeof(input_format),
.pbFormat = (BYTE *)&input_format,
};
static const WAVEFORMATEX output_format =
{
.nChannels = 1,
.nSamplesPerSec = 48000,
.nAvgBytesPerSec = 2 * 48000,
.nBlockAlign = 2,
.wBitsPerSample = 16,
};
DMO_MEDIA_TYPE output_mt =
{
.formattype = FORMAT_WaveFormatEx,
.cbFormat = sizeof(output_format),
.pbFormat = (BYTE *)&output_format,
};
DWORD input_count, output_count, flags, size, lookahead, alignment;
IMediaObject *dmo; IMediaObject *dmo;
HRESULT hr; HRESULT hr;
...@@ -311,6 +340,25 @@ static void test_stream_info(void) ...@@ -311,6 +340,25 @@ static void test_stream_info(void)
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!flags, "Got flags %#x.\n", flags); ok(!flags, "Got flags %#x.\n", flags);
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment);
ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
hr = IMediaObject_SetInputType(dmo, 0, &input_mt, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment);
ok(hr == DMO_E_TYPE_NOT_SET, "Got hr %#x.\n", hr);
hr = IMediaObject_SetOutputType(dmo, 0, &output_mt, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = lookahead = alignment = 0xdeadbeef;
hr = IMediaObject_GetInputSizeInfo(dmo, 0, &size, &lookahead, &alignment);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!size, "Got size %u.\n", size);
ok(lookahead == 0xdeadbeef, "Got lookahead %u.\n", lookahead);
ok(alignment == 1, "Got alignment %u.\n", alignment);
IMediaObject_Release(dmo); IMediaObject_Release(dmo);
} }
......
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