Skip to content

Commit

Permalink
winegstreamer: Implement H264 decoder GetOutputStreamInfo.
Browse files Browse the repository at this point in the history
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
  • Loading branch information
rbernon authored and julliard committed Mar 28, 2022
1 parent aca4537 commit 962b432
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
22 changes: 4 additions & 18 deletions dlls/mf/tests/mf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6688,13 +6688,9 @@ static void test_h264_decoder(void)
flags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
memset(&output_info, 0xcd, sizeof(output_info));
hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info);
todo_wine
ok(hr == S_OK, "GetOutputStreamInfo returned %#lx\n", hr);
todo_wine
ok(output_info.dwFlags == flags, "got dwFlags %#lx\n", output_info.dwFlags);
todo_wine
ok(output_info.cbSize == 0x3fc000, "got cbSize %#lx\n", output_info.cbSize);
todo_wine
ok(output_info.cbSize == 1920 * 1088 * 2, "got cbSize %#lx\n", output_info.cbSize);
ok(output_info.cbAlignment == 0, "got cbAlignment %#lx\n", output_info.cbAlignment);

i = -1;
Expand Down Expand Up @@ -6729,14 +6725,11 @@ static void test_h264_decoder(void)
flags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
memset(&output_info, 0xcd, sizeof(output_info));
hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info);
todo_wine
ok(hr == S_OK, "GetOutputStreamInfo returned %#lx\n", hr);
todo_wine
ok(output_info.dwFlags == flags, "got dwFlags %#lx\n", output_info.dwFlags);
todo_wine
ok(output_info.cbSize == 0x3f4800 || broken(output_info.cbSize == 0x3fc000) /* Win7 */,
ok(output_info.cbSize == 1920 * 1080 * 2 || broken(output_info.cbSize == 1920 * 1088 * 2) /* Win7 */,
"got cbSize %#lx\n", output_info.cbSize);
todo_wine
ok(output_info.cbAlignment == 0, "got cbAlignment %#lx\n", output_info.cbAlignment);

/* output types can now be enumerated (though they are actually the same for all input types) */
Expand Down Expand Up @@ -6800,14 +6793,10 @@ static void test_h264_decoder(void)
flags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
memset(&output_info, 0xcd, sizeof(output_info));
hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info);
todo_wine
ok(hr == S_OK, "GetOutputStreamInfo returned %#lx\n", hr);
todo_wine
ok(output_info.dwFlags == flags, "got dwFlags %#lx\n", output_info.dwFlags);
todo_wine
ok(output_info.cbSize == 0x3f4800 || broken(output_info.cbSize == 0x3fc000) /* Win7 */,
ok(output_info.cbSize == 1920 * 1080 * 2 || broken(output_info.cbSize == 1920 * 1088 * 2) /* Win7 */,
"got cbSize %#lx\n", output_info.cbSize);
todo_wine
ok(output_info.cbAlignment == 0, "got cbAlignment %#lx\n", output_info.cbAlignment);

input_count = output_count = 0xdeadbeef;
Expand Down Expand Up @@ -6846,7 +6835,7 @@ static void test_h264_decoder(void)
{
status = 0;
memset(&output, 0, sizeof(output));
output.pSample = create_sample(NULL, 0x3fc000);
output.pSample = create_sample(NULL, output_info.cbSize);
hr = IMFTransform_ProcessOutput(transform, 0, 1, &output, &status);
if (hr != MF_E_TRANSFORM_NEED_MORE_INPUT) break;
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "ProcessOutput returned %#lx\n", hr);
Expand Down Expand Up @@ -6900,13 +6889,10 @@ static void test_h264_decoder(void)
flags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
memset(&output_info, 0xcd, sizeof(output_info));
hr = IMFTransform_GetOutputStreamInfo(transform, 0, &output_info);
todo_wine
ok(hr == S_OK, "GetOutputStreamInfo returned %#lx\n", hr);
todo_wine
ok(output_info.dwFlags == flags, "got dwFlags %#lx\n", output_info.dwFlags);
todo_wine
ok(output_info.cbSize == 0x3200, "got cbSize %#lx\n", output_info.cbSize);
todo_wine
ok(output_info.cbAlignment == 0, "got cbAlignment %#lx\n", output_info.cbAlignment);

i = -1;
Expand Down
23 changes: 21 additions & 2 deletions dlls/winegstreamer/h264_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,27 @@ static HRESULT WINAPI transform_GetInputStreamInfo(IMFTransform *iface, DWORD id

static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info)
{
FIXME("iface %p, id %#lx, info %p stub!\n", iface, id, info);
return E_NOTIMPL;
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
UINT32 sample_size;
UINT64 frame_size;

TRACE("iface %p, id %#lx, info %p.\n", iface, id, info);

if (!decoder->output_type)
sample_size = 1920 * 1088 * 2;
else if (FAILED(IMFMediaType_GetUINT32(decoder->output_type, &MF_MT_SAMPLE_SIZE, &sample_size)))
{
if (FAILED(IMFMediaType_GetUINT64(decoder->output_type, &MF_MT_FRAME_SIZE, &frame_size)))
sample_size = 1920 * 1088 * 2;
else
sample_size = (frame_size >> 32) * (UINT32)frame_size * 2;
}

info->dwFlags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
info->cbSize = sample_size;
info->cbAlignment = 0;

return S_OK;
}

static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes)
Expand Down

0 comments on commit 962b432

Please sign in to comment.