Commit 62068a4d authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

winegstreamer: Implement _GetInputStatus() for aac decoder transform.

parent 1e3d4a1d
......@@ -2373,6 +2373,7 @@ static void test_aac_decoder(void)
IMFMediaType *media_type;
IMFTransform *transform;
const BYTE *aacenc_data;
DWORD flags;
HRESULT hr;
hr = CoInitialize(NULL);
......@@ -2452,10 +2453,23 @@ static void test_aac_decoder(void)
ok(aacenc_data_len == 24861, "got length %lu\n", aacenc_data_len);
input_sample = create_sample(aacenc_data + sizeof(DWORD), *(DWORD *)aacenc_data);
flags = 0;
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == S_OK, "Got %#lx\n", hr);
ok(flags == MFT_INPUT_STATUS_ACCEPT_DATA, "Got flags %#lx.\n", flags);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == S_OK, "ProcessInput returned %#lx\n", hr);
flags = 0xdeadbeef;
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == S_OK, "Got %#lx\n", hr);
ok(!flags, "Got flags %#lx.\n", flags);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
flags = 0xdeadbeef;
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == S_OK, "Got %#lx\n", hr);
ok(!flags, "Got flags %#lx.\n", flags);
/* As output_info.dwFlags doesn't have MFT_OUTPUT_STREAM_CAN_PROVIDE_SAMPLES
* IMFTransform_ProcessOutput needs a sample or returns MF_E_TRANSFORM_NEED_MORE_INPUT */
......@@ -2463,11 +2477,19 @@ static void test_aac_decoder(void)
hr = check_mft_process_output(transform, NULL, &output_status);
ok(hr == E_INVALIDARG, "ProcessOutput returned %#lx\n", hr);
ok(output_status == 0, "got output[0].dwStatus %#lx\n", output_status);
flags = 0xdeadbeef;
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == S_OK, "Got %#lx\n", hr);
ok(!flags, "Got flags %#lx.\n", flags);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
hr = IMFTransform_ProcessMessage(transform, MFT_MESSAGE_COMMAND_DRAIN, 0);
ok(hr == S_OK, "ProcessMessage returned %#lx\n", hr);
flags = 0xdeadbeef;
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == S_OK, "Got %#lx\n", hr);
ok(!flags, "Got flags %#lx.\n", flags);
hr = IMFTransform_ProcessInput(transform, 0, input_sample, 0);
ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#lx\n", hr);
......@@ -2487,6 +2509,12 @@ static void test_aac_decoder(void)
winetest_pop_context();
}
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
flags = 0;
hr = IMFTransform_GetInputStatus(transform, 0, &flags);
ok(hr == S_OK, "Got %#lx\n", hr);
ok(flags == MFT_INPUT_STATUS_ACCEPT_DATA, "Got flags %#lx.\n", flags);
ok(output_status == MFT_OUTPUT_DATA_BUFFER_NO_SAMPLE, "got output[0].dwStatus %#lx\n", output_status);
ret = IMFSample_Release(output_sample);
ok(ret == 0, "Release returned %lu\n", ret);
......
......@@ -500,8 +500,20 @@ static HRESULT WINAPI transform_GetOutputCurrentType(IMFTransform *iface, DWORD
static HRESULT WINAPI transform_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
{
FIXME("iface %p, id %#lx, flags %p stub!\n", iface, id, flags);
return E_NOTIMPL;
struct aac_decoder *decoder = impl_from_IMFTransform(iface);
bool accepts_input;
HRESULT hr;
TRACE("iface %p, id %#lx, flags %p.\n", iface, id, flags);
if (!decoder->wg_transform)
return MF_E_TRANSFORM_TYPE_NOT_SET;
if (FAILED(hr = wg_transform_get_status(decoder->wg_transform, &accepts_input)))
return hr;
*flags = accepts_input ? MFT_INPUT_STATUS_ACCEPT_DATA : 0;
return S_OK;
}
static HRESULT WINAPI transform_GetOutputStatus(IMFTransform *iface, DWORD *flags)
......
......@@ -104,6 +104,7 @@ struct wg_transform *wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format);
void wg_transform_destroy(struct wg_transform *transform);
bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_format *format);
bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input);
unsigned int wg_format_get_max_size(const struct wg_format *format);
......
......@@ -384,6 +384,22 @@ HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample
return params.result;
}
bool wg_transform_get_status(struct wg_transform *transform, bool *accepts_input)
{
struct wg_transform_get_status_params params =
{
.transform = transform,
};
TRACE("transform %p, accepts_input %p.\n", transform, accepts_input);
if (WINE_UNIX_CALL(unix_wg_transform_get_status, &params))
return false;
*accepts_input = params.accepts_input;
return true;
}
bool wg_transform_set_output_format(struct wg_transform *transform, struct wg_format *format)
{
struct wg_transform_set_output_format_params params =
......
......@@ -37,6 +37,7 @@ extern NTSTATUS wg_transform_destroy(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_set_output_format(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_push_data(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_read_data(void *args) DECLSPEC_HIDDEN;
extern NTSTATUS wg_transform_get_status(void *args) DECLSPEC_HIDDEN;
/* wg_allocator_release_sample can be used to release any sample that was requested. */
typedef struct wg_sample *(*wg_allocator_request_sample_cb)(gsize size, void *context);
......
......@@ -310,6 +310,12 @@ struct wg_transform_set_output_format_params
const struct wg_format *format;
};
struct wg_transform_get_status_params
{
struct wg_transform *transform;
UINT32 accepts_input;
};
enum unix_funcs
{
unix_wg_parser_create,
......@@ -343,6 +349,7 @@ enum unix_funcs
unix_wg_transform_push_data,
unix_wg_transform_read_data,
unix_wg_transform_get_status,
};
#endif /* __WINE_WINEGSTREAMER_UNIXLIB_H */
......@@ -1815,4 +1815,5 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
X(wg_transform_push_data),
X(wg_transform_read_data),
X(wg_transform_get_status),
};
......@@ -931,3 +931,12 @@ NTSTATUS wg_transform_read_data(void *args)
wg_allocator_release_sample(transform->allocator, sample, discard_data);
return STATUS_SUCCESS;
}
NTSTATUS wg_transform_get_status(void *args)
{
struct wg_transform_get_status_params *params = args;
struct wg_transform *transform = params->transform;
params->accepts_input = gst_atomic_queue_length(transform->input_queue) < transform->input_max_length;
return STATUS_SUCCESS;
}
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