winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2024
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
775 discussions
Start a n
N
ew thread
Mark Jansen : kernel32/tests: Add tests for job object accounting.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: 9e639ff1f6c2b913518501b3f99ca085c4eed6c7 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9e639ff1f6c2b913518501b3f99ca0…
Author: Mark Jansen <mark.jansen(a)reactos.org> Date: Sun Sep 24 22:45:22 2017 +0200 kernel32/tests: Add tests for job object accounting. Signed-off-by: Mark Jansen <mark.jansen(a)reactos.org> --- dlls/kernel32/tests/process.c | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 8fadc624e05..8e168622c17 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -2625,6 +2625,53 @@ static void _create_process(int line, const char *command, LPPROCESS_INFORMATION ok_(__FILE__, line)(ret, "CreateProcess error %lu\n", GetLastError()); } +#define test_assigned_proc(job, ...) _test_assigned_proc(__LINE__, job, __VA_ARGS__) +static void _test_assigned_proc(int line, HANDLE job, unsigned int count, ...) +{ + char buf[sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST) + sizeof(ULONG_PTR) * 20]; + JOBOBJECT_BASIC_PROCESS_ID_LIST *list = (JOBOBJECT_BASIC_PROCESS_ID_LIST *)buf; + unsigned int i, pid; + va_list valist; + DWORD size; + BOOL ret; + + memset(buf, 0, sizeof(buf)); + ret = pQueryInformationJobObject(job, JobObjectBasicProcessIdList, list, sizeof(buf), &size); + ok_(__FILE__, line)(ret, "failed to get process id list, error %lu\n", GetLastError()); + + ok_(__FILE__, line)(list->NumberOfAssignedProcesses == count, + "expected %u assigned processes, got %lu\n", count, list->NumberOfAssignedProcesses); + ok_(__FILE__, line)(list->NumberOfProcessIdsInList == count, + "expected %u process IDs, got %lu\n", count, list->NumberOfProcessIdsInList); + + va_start(valist, count); + for (i = 0; i < min(count, list->NumberOfProcessIdsInList); ++i) + { + pid = va_arg(valist, unsigned int); + ok_(__FILE__, line)(pid == list->ProcessIdList[i], + "wrong pid %u: expected %#04x, got %#04Ix\n", i, pid, list->ProcessIdList[i]); + } + va_end(valist); +} + +#define test_accounting(a, b, c, d) _test_accounting(__LINE__, a, b, c, d) +static void _test_accounting(int line, HANDLE job, unsigned int total, unsigned int active, unsigned int terminated) +{ + JOBOBJECT_BASIC_ACCOUNTING_INFORMATION info; + DWORD size; + BOOL ret; + + memset(&info, 0, sizeof(info)); + ret = pQueryInformationJobObject(job, JobObjectBasicAccountingInformation, &info, sizeof(info), &size); + ok_(__FILE__, line)(ret, "failed to get accounting information, error %lu\n", GetLastError()); + + ok_(__FILE__, line)(info.TotalProcesses == total, + "expected %u total processes, got %lu\n", total, info.TotalProcesses); + ok_(__FILE__, line)(info.ActiveProcesses == active, + "expected %u active processes, got %lu\n", active, info.ActiveProcesses); + ok_(__FILE__, line)(info.TotalTerminatedProcesses == terminated, + "expected %u terminated processes, got %lu\n", terminated, info.TotalTerminatedProcesses); +} static void test_IsProcessInJob(void) { @@ -2650,11 +2697,15 @@ static void test_IsProcessInJob(void) ret = pIsProcessInJob(pi.hProcess, job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(!out, "IsProcessInJob returned out=%u\n", out); + test_assigned_proc(job, 0); + test_accounting(job, 0, 0, 0); out = TRUE; ret = pIsProcessInJob(pi.hProcess, job2, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(!out, "IsProcessInJob returned out=%u\n", out); + test_assigned_proc(job2, 0); + test_accounting(job2, 0, 0, 0); ret = pAssignProcessToJobObject(job, pi.hProcess); ok(ret, "AssignProcessToJobObject error %lu\n", GetLastError()); @@ -2663,11 +2714,15 @@ static void test_IsProcessInJob(void) ret = pIsProcessInJob(pi.hProcess, job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(out, "IsProcessInJob returned out=%u\n", out); + test_assigned_proc(job, 1, pi.dwProcessId); + test_accounting(job, 1, 1, 0); out = TRUE; ret = pIsProcessInJob(pi.hProcess, job2, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(!out, "IsProcessInJob returned out=%u\n", out); + test_assigned_proc(job2, 0); + test_accounting(job2, 0, 0, 0); out = FALSE; ret = pIsProcessInJob(pi.hProcess, NULL, &out); @@ -2681,6 +2736,8 @@ static void test_IsProcessInJob(void) ret = pIsProcessInJob(pi.hProcess, job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(out, "IsProcessInJob returned out=%u\n", out); + test_assigned_proc(job, 0); + test_accounting(job, 1, 0, 0); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); @@ -2697,11 +2754,15 @@ static void test_TerminateJobObject(void) job = pCreateJobObjectW(NULL, NULL); ok(job != NULL, "CreateJobObject error %lu\n", GetLastError()); + test_assigned_proc(job, 0); + test_accounting(job, 0, 0, 0); create_process("wait", &pi); ret = pAssignProcessToJobObject(job, pi.hProcess); ok(ret, "AssignProcessToJobObject error %lu\n", GetLastError()); + test_assigned_proc(job, 1, pi.dwProcessId); + test_accounting(job, 1, 1, 0); ret = pTerminateJobObject(job, 123); ok(ret, "TerminateJobObject error %lu\n", GetLastError()); @@ -2710,6 +2771,8 @@ static void test_TerminateJobObject(void) dwret = WaitForSingleObject(pi.hProcess, 1000); ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", dwret); if (dwret == WAIT_TIMEOUT) TerminateProcess(pi.hProcess, 0); + test_assigned_proc(job, 0); + test_accounting(job, 1, 0, 0); ret = GetExitCodeProcess(pi.hProcess, &dwret); ok(ret, "GetExitCodeProcess error %lu\n", GetLastError()); @@ -2727,6 +2790,8 @@ static void test_TerminateJobObject(void) ret = pAssignProcessToJobObject(job, pi.hProcess); ok(!ret, "AssignProcessToJobObject unexpectedly succeeded\n"); expect_eq_d(ERROR_ACCESS_DENIED, GetLastError()); + test_assigned_proc(job, 0); + test_accounting(job, 1, 0, 0); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); @@ -2925,11 +2990,15 @@ static void test_KillOnJobClose(void) return; } ok(ret, "SetInformationJobObject error %lu\n", GetLastError()); + test_assigned_proc(job, 0); + test_accounting(job, 0, 0, 0); create_process("wait", &pi); ret = pAssignProcessToJobObject(job, pi.hProcess); ok(ret, "AssignProcessToJobObject error %lu\n", GetLastError()); + test_assigned_proc(job, 1, pi.dwProcessId); + test_accounting(job, 1, 1, 0); CloseHandle(job); @@ -3039,6 +3108,8 @@ static HANDLE test_AddSelfToJob(void) ret = pAssignProcessToJobObject(job, GetCurrentProcess()); ok(ret, "AssignProcessToJobObject error %lu\n", GetLastError()); + test_assigned_proc(job, 1, GetCurrentProcessId()); + test_accounting(job, 1, 1, 0); return job; } @@ -3060,6 +3131,8 @@ static void test_jobInheritance(HANDLE job) ret = pIsProcessInJob(pi.hProcess, job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(out, "IsProcessInJob returned out=%u\n", out); + test_assigned_proc(job, 2, GetCurrentProcessId(), pi.dwProcessId); + test_accounting(job, 2, 2, 0); wait_and_close_child_process(&pi); } @@ -3102,6 +3175,9 @@ static void test_BreakawayOk(HANDLE parent_job) if (nested_jobs) { + test_assigned_proc(job, 1, GetCurrentProcessId()); + test_accounting(job, 1, 1, 0); + limit_info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_BREAKAWAY_OK; ret = pSetInformationJobObject(job, JobObjectExtendedLimitInformation, &limit_info, sizeof(limit_info)); ok(ret, "SetInformationJobObject error %lu\n", GetLastError()); @@ -3132,6 +3208,11 @@ static void test_BreakawayOk(HANDLE parent_job) ret = pIsProcessInJob(pi.hProcess, job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(!out, "IsProcessInJob returned out=%u\n", out); + if (nested_jobs) + { + test_assigned_proc(job, 1, GetCurrentProcessId()); + test_accounting(job, 1, 1, 0); + } ret = pIsProcessInJob(pi.hProcess, parent_job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); @@ -3149,6 +3230,11 @@ static void test_BreakawayOk(HANDLE parent_job) ret = pIsProcessInJob(pi.hProcess, job, &out); ok(ret, "IsProcessInJob error %lu\n", GetLastError()); ok(!out, "IsProcessInJob returned out=%u\n", out); + if (nested_jobs) + { + test_assigned_proc(job, 1, GetCurrentProcessId()); + test_accounting(job, 1, 1, 0); + } wait_and_close_child_process(&pi);
1
0
0
0
Santino Mazza : mf/topoloader: Preserve input topology id.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: b37d3f232b4fd5ecb052031e0a685b4ba8cf9668 URL:
https://gitlab.winehq.org/wine/wine/-/commit/b37d3f232b4fd5ecb052031e0a685b…
Author: Santino Mazza <smazza(a)codeweavers.com> Date: Mon Mar 11 11:29:48 2024 -0300 mf/topoloader: Preserve input topology id. --- dlls/mf/mf_private.h | 1 + dlls/mf/tests/mf.c | 4 ++-- dlls/mf/topology.c | 25 +++++++++++++++---------- dlls/mf/topology_loader.c | 4 +++- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index bbfadaee5d8..401e1f55b49 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -118,6 +118,7 @@ extern HRESULT urlmon_scheme_handler_construct(REFIID riid, void **obj); extern BOOL mf_is_sample_copier_transform(IMFTransform *transform); extern BOOL mf_is_sar_sink(IMFMediaSink *sink); +extern HRESULT create_topology(TOPOID id, IMFTopology **topology); extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj); extern HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaTypeHandler **handler); extern HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type); diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 58688c0cfba..fece60d37a7 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4179,7 +4179,7 @@ static void test_topology_loader(void) { IMFTopology_GetTopologyID(topology, &oldtopoid); IMFTopology_GetTopologyID(full_topology, &newtopoid); - todo_wine ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); + ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); ok(topology != full_topology, "Expected a different object for the resolved topology.\n"); hr = IMFTopology_GetCount(full_topology, &count); @@ -4331,7 +4331,7 @@ todo_wine { ok(full_topology != topology2, "Unexpected instance.\n"); IMFTopology_GetTopologyID(topology2, &oldtopoid); IMFTopology_GetTopologyID(full_topology, &newtopoid); - todo_wine ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); + ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); hr = IMFTopology_GetUINT32(topology2, &IID_IMFTopology, &value); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c index f09a9c87a46..572d4d426d3 100644 --- a/dlls/mf/topology.c +++ b/dlls/mf/topology.c @@ -866,19 +866,11 @@ static TOPOID topology_generate_id(void) return next_topology_id; } -/*********************************************************************** - * MFCreateTopology (mf.@) - */ -HRESULT WINAPI MFCreateTopology(IMFTopology **topology) +HRESULT create_topology(TOPOID id, IMFTopology **topology) { struct topology *object; HRESULT hr; - TRACE("%p.\n", topology); - - if (!topology) - return E_POINTER; - if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -892,13 +884,26 @@ HRESULT WINAPI MFCreateTopology(IMFTopology **topology) return hr; } - object->id = topology_generate_id(); + object->id = id; *topology = &object->IMFTopology_iface; return S_OK; } +/*********************************************************************** + * MFCreateTopology (mf.@) + */ +HRESULT WINAPI MFCreateTopology(IMFTopology **topology) +{ + TRACE("%p.\n", topology); + + if (!topology) + return E_POINTER; + + return create_topology(topology_generate_id(), topology); +} + static HRESULT WINAPI topology_node_QueryInterface(IMFTopologyNode *iface, REFIID riid, void **out) { struct topology_node *node = impl_from_IMFTopologyNode(iface); diff --git a/dlls/mf/topology_loader.c b/dlls/mf/topology_loader.c index 11d0162d94f..96ae74dbfe2 100644 --- a/dlls/mf/topology_loader.c +++ b/dlls/mf/topology_loader.c @@ -721,6 +721,7 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in unsigned short i = 0; IMFStreamSink *sink; IUnknown *object; + TOPOID topoid; HRESULT hr = E_FAIL; FIXME("iface %p, input_topology %p, ret_topology %p, current_topology %p stub!\n", @@ -763,7 +764,8 @@ static HRESULT WINAPI topology_loader_Load(IMFTopoLoader *iface, IMFTopology *in return hr; } - if (FAILED(hr = MFCreateTopology(&output_topology))) + IMFTopology_GetTopologyID(input_topology, &topoid); + if (FAILED(hr = create_topology(topoid, &output_topology))) return hr; IMFTopology_CopyAllItems(input_topology, (IMFAttributes *)output_topology);
1
0
0
0
Santino Mazza : mf/test: Check the topologies id's in topo loader.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: 4da091eddd1ef940a6eec3af73033150e4101e63 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4da091eddd1ef940a6eec3af730331…
Author: Santino Mazza <smazza(a)codeweavers.com> Date: Thu Feb 8 14:39:02 2024 -0300 mf/test: Check the topologies id's in topo loader. --- dlls/mf/tests/mf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index c05482778df..58688c0cfba 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3951,7 +3951,7 @@ static void test_topology_loader(void) IMFTopoLoader *loader; IUnknown *node_object; WORD node_count; - TOPOID node_id; + TOPOID node_id, oldtopoid, newtopoid; DWORD index; HRESULT hr; BOOL ret; @@ -4177,6 +4177,11 @@ static void test_topology_loader(void) } else if (test->expected_result == S_OK) { + IMFTopology_GetTopologyID(topology, &oldtopoid); + IMFTopology_GetTopologyID(full_topology, &newtopoid); + todo_wine ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); + ok(topology != full_topology, "Expected a different object for the resolved topology.\n"); + hr = IMFTopology_GetCount(full_topology, &count); ok(hr == S_OK, "Failed to get attribute count, hr %#lx.\n", hr); todo_wine @@ -4324,6 +4329,9 @@ todo_wine { hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL); ok(hr == S_OK, "Failed to resolve topology, hr %#lx.\n", hr); ok(full_topology != topology2, "Unexpected instance.\n"); + IMFTopology_GetTopologyID(topology2, &oldtopoid); + IMFTopology_GetTopologyID(full_topology, &newtopoid); + todo_wine ok(oldtopoid == newtopoid, "Expected the same topology id. %llu == %llu\n", oldtopoid, newtopoid); hr = IMFTopology_GetUINT32(topology2, &IID_IMFTopology, &value); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1
0
0
0
Rémi Bernon : mfplat/mediatype: Implement some VIDEOINFOHEADER2 dwInterlaceFlags conversion.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: fc97535ccbc6856e74d302eec02d7c5c862794d0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/fc97535ccbc6856e74d302eec02d7c…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 17 15:48:08 2024 +0100 mfplat/mediatype: Implement some VIDEOINFOHEADER2 dwInterlaceFlags conversion. --- dlls/mfplat/mediatype.c | 24 +++++++++++++++++++++++- dlls/mfplat/tests/mfplat.c | 1 - 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index eaabad59689..35fce38652b 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3781,7 +3781,6 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_guid(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video, &hr); mediatype_set_guid(media_type, &MF_MT_SUBTYPE, subtype, &hr); mediatype_set_uint64(media_type, &MF_MT_PIXEL_ASPECT_RATIO, 1, 1, &hr); - mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive, &hr); mediatype_set_uint64(media_type, &MF_MT_FRAME_SIZE, vih->bmiHeader.biWidth, height, &hr); if (SUCCEEDED(mf_get_stride_for_bitmap_info_header(subtype->Data1, &vih->bmiHeader, &stride))) @@ -3834,6 +3833,13 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_uint32(media_type, &MF_MT_TRANSFER_FUNCTION, format->VideoTransferFunction, &hr); } + if (!(vih->dwInterlaceFlags & AMINTERLACE_IsInterlaced)) + mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive, &hr); + else if (vih->dwInterlaceFlags & AMINTERLACE_DisplayModeBobOrWeave) + mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_MixedInterlaceOrProgressive, &hr); + else + FIXME("dwInterlaceFlags %#lx not implemented\n", vih->dwInterlaceFlags); + return hr; } @@ -4012,6 +4018,22 @@ static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, if (format->VideoChromaSubsampling || format->NominalRange || format->VideoTransferMatrix || format->VideoLighting || format->VideoPrimaries || format->VideoTransferFunction) format->SampleFormat = AMCONTROL_COLORINFO_PRESENT; + + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_INTERLACE_MODE, &value))) + { + switch (value) + { + case MFVideoInterlace_Progressive: + break; + case MFVideoInterlace_MixedInterlaceOrProgressive: + vih->dwInterlaceFlags = AMINTERLACE_DisplayModeBobOrWeave | AMINTERLACE_IsInterlaced; + break; + default: + FIXME("MF_MT_INTERLACE_MODE %u not implemented!\n", value); + vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced; + break; + } + } } static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, UINT32 user_size, IMFMediaType *media_type) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 38bb9651823..14873422d04 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10318,7 +10318,6 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_INTERLACE_MODE, &value32); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == MFVideoInterlace_MixedInterlaceOrProgressive, "Unexpected value %#x.\n", value32); vih.dwPictAspectRatioX = 123;
1
0
0
0
Rémi Bernon : mfplat/mediatype: Implement VIDEOINFOHEADER2 dwControlFlags conversion.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: 76abdf3403f0f91543742c24b90f35c06a1bec55 URL:
https://gitlab.winehq.org/wine/wine/-/commit/76abdf3403f0f91543742c24b90f35…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 17 15:45:36 2024 +0100 mfplat/mediatype: Implement VIDEOINFOHEADER2 dwControlFlags conversion. --- dlls/mfplat/mediatype.c | 39 ++++++++++++++++++++++++++++++++++++++- dlls/mfplat/tests/mfplat.c | 4 ---- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 96d9a07973e..eaabad59689 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -21,6 +21,7 @@ #include "mfplat_private.h" #include <math.h> +#include "dxva.h" #include "dxva2api.h" #include "uuids.h" #include "strmif.h" @@ -3815,6 +3816,24 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_uint64(media_type, &MF_MT_FRAME_RATE, num, den, &hr); } + if (vih->dwControlFlags & AMCONTROL_COLORINFO_PRESENT) + { + DXVA_ExtendedFormat *format = (DXVA_ExtendedFormat *)&vih->dwControlFlags; + + if (format->VideoChromaSubsampling) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_CHROMA_SITING, format->VideoChromaSubsampling, &hr); + if (format->NominalRange) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, format->NominalRange, &hr); + if (format->VideoTransferMatrix) + mediatype_set_uint32(media_type, &MF_MT_YUV_MATRIX, format->VideoTransferMatrix, &hr); + if (format->VideoLighting) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_LIGHTING, format->VideoLighting, &hr); + if (format->VideoPrimaries) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_PRIMARIES, format->VideoPrimaries, &hr); + if (format->VideoTransferFunction) + mediatype_set_uint32(media_type, &MF_MT_TRANSFER_FUNCTION, format->VideoTransferFunction, &hr); + } + return hr; } @@ -3930,7 +3949,8 @@ static HRESULT init_am_media_type_audio_format(AM_MEDIA_TYPE *am_type, UINT32 us static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, IMFMediaType *media_type) { struct uncompressed_video_format *video_format = mf_get_video_format(subtype); - UINT32 image_size, bitrate, sample_size, width, height; + DXVA_ExtendedFormat *format = (DXVA_ExtendedFormat *)&vih->dwControlFlags; + UINT32 image_size, bitrate, sample_size, width, height, value; UINT64 frame_size, frame_rate; vih->bmiHeader.biSize = sizeof(vih->bmiHeader); @@ -3975,6 +3995,23 @@ static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, vih->rcSource.bottom = vih->rcTarget.bottom = height; } } + + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_CHROMA_SITING, &value))) + format->VideoChromaSubsampling = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &value))) + format->NominalRange = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_YUV_MATRIX, &value))) + format->VideoTransferMatrix = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_LIGHTING, &value))) + format->VideoLighting = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_PRIMARIES, &value))) + format->VideoPrimaries = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_TRANSFER_FUNCTION, &value))) + format->VideoTransferFunction = value; + + if (format->VideoChromaSubsampling || format->NominalRange || format->VideoTransferMatrix + || format->VideoLighting || format->VideoPrimaries || format->VideoTransferFunction) + format->SampleFormat = AMCONTROL_COLORINFO_PRESENT; } static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, UINT32 user_size, IMFMediaType *media_type) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 66c0f0d7951..38bb9651823 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10348,9 +10348,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_YUV_MATRIX, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == MFVideoTransferMatrix_SMPTE240M, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); @@ -10360,9 +10358,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == MFNominalRange_Wide, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, &value32);
1
0
0
0
Rémi Bernon : mfplat/mediatype: Implement MF_MT_FRAME_RATE from VIDEOINFOHEADER2.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: 5a3460160670f9bbfb4f6ffc6bb7baadc5182f03 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5a3460160670f9bbfb4f6ffc6bb7ba…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 17 15:32:11 2024 +0100 mfplat/mediatype: Implement MF_MT_FRAME_RATE from VIDEOINFOHEADER2. Native seems to also treat some frame rate specially, matching a wide range of time per frame into the same predefined frame rates. --- dlls/mfplat/mediatype.c | 7 +++++++ dlls/mfplat/tests/mfplat.c | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 0fd8402d4d2..96d9a07973e 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3808,6 +3808,13 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_blob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &hr); } + if (SUCCEEDED(hr) && vih->AvgTimePerFrame) + { + UINT32 num, den; + if (SUCCEEDED(hr = MFAverageTimePerFrameToFrameRate(vih->AvgTimePerFrame, &num, &den))) + mediatype_set_uint64(media_type, &MF_MT_FRAME_RATE, num, den, &hr); + } + return hr; } diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index b6d63f42d1c..66c0f0d7951 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10058,9 +10058,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) hr = MFInitMediaTypeFromVideoInfoHeader(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_RATE, &value64); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value64 == ((UINT64)10000000 << 32 | 1151617), "Unexpected value %#I64x.\n", value64); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, &value32); @@ -10311,9 +10309,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_RATE, &value64); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value64 == ((UINT64)10000000 << 32 | 1151617), "Unexpected value %#I64x.\n", value64); value32 = 0xdeadbeef;
1
0
0
0
Rémi Bernon : mfplat: Support flexible frame time in MFAverageTimePerFrameToFrameRate.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: aa385765a1229c4dd6c15d45cb1883ce93bbc30b URL:
https://gitlab.winehq.org/wine/wine/-/commit/aa385765a1229c4dd6c15d45cb1883…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Mar 18 13:41:28 2024 +0100 mfplat: Support flexible frame time in MFAverageTimePerFrameToFrameRate. --- dlls/mfplat/mediatype.c | 82 +++++++++++++++++++++++----------------------- dlls/mfplat/tests/mfplat.c | 34 +++++++++---------- 2 files changed, 57 insertions(+), 59 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 6ed23c0ef6a..0fd8402d4d2 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3353,15 +3353,45 @@ HRESULT WINAPI MFConvertColorInfoToDXVA(DWORD *dxva_info, const MFVIDEOFORMAT *f struct frame_rate { - UINT64 key; - UINT64 value; + UINT64 time; + UINT64 rate; +}; + +static const struct frame_rate known_rates[] = +{ +#define KNOWN_RATE(ft,n,d) { ft, ((UINT64)n << 32) | d } + KNOWN_RATE(417188, 24000, 1001), + KNOWN_RATE(416667, 24, 1), + KNOWN_RATE(400000, 25, 1), + KNOWN_RATE(333667, 30000, 1001), + KNOWN_RATE(333333, 30, 1), + KNOWN_RATE(200000, 50, 1), + KNOWN_RATE(166833, 60000, 1001), + KNOWN_RATE(166667, 60, 1), +#undef KNOWN_RATE }; -static int __cdecl frame_rate_compare(const void *a, const void *b) +static const struct frame_rate *known_rate_from_rate(UINT64 rate) +{ + UINT i; + for (i = 0; i < ARRAY_SIZE(known_rates); i++) + { + if (rate == known_rates[i].rate) + return known_rates + i; + } + return NULL; +} + +static const struct frame_rate *known_rate_from_time(UINT64 time) { - const UINT64 *key = a; - const struct frame_rate *known_rate = b; - return *key == known_rate->key ? 0 : ( *key < known_rate->key ? 1 : -1 ); + UINT i; + for (i = 0; i < ARRAY_SIZE(known_rates); i++) + { + if (time >= known_rates[i].time - 30 + && time <= known_rates[i].time + 30) + return known_rates + i; + } + return NULL; } /*********************************************************************** @@ -3369,29 +3399,13 @@ static int __cdecl frame_rate_compare(const void *a, const void *b) */ HRESULT WINAPI MFFrameRateToAverageTimePerFrame(UINT32 numerator, UINT32 denominator, UINT64 *avgframetime) { - static const struct frame_rate known_rates[] = - { -#define KNOWN_RATE(n,d,ft) { ((UINT64)n << 32) | d, ft } - KNOWN_RATE(60000, 1001, 166833), - KNOWN_RATE(30000, 1001, 333667), - KNOWN_RATE(24000, 1001, 417188), - KNOWN_RATE(60, 1, 166667), - KNOWN_RATE(50, 1, 200000), - KNOWN_RATE(30, 1, 333333), - KNOWN_RATE(25, 1, 400000), - KNOWN_RATE(24, 1, 416667), -#undef KNOWN_RATE - }; UINT64 rate = ((UINT64)numerator << 32) | denominator; const struct frame_rate *entry; TRACE("%u, %u, %p.\n", numerator, denominator, avgframetime); - if ((entry = bsearch(&rate, known_rates, ARRAY_SIZE(known_rates), sizeof(*known_rates), - frame_rate_compare))) - { - *avgframetime = entry->value; - } + if ((entry = known_rate_from_rate(rate))) + *avgframetime = entry->time; else *avgframetime = numerator ? denominator * (UINT64)10000000 / numerator : 0; @@ -3417,29 +3431,15 @@ static unsigned int get_gcd(unsigned int a, unsigned int b) */ HRESULT WINAPI MFAverageTimePerFrameToFrameRate(UINT64 avgtime, UINT32 *numerator, UINT32 *denominator) { - static const struct frame_rate known_rates[] = - { -#define KNOWN_RATE(ft,n,d) { ft, ((UINT64)n << 32) | d } - KNOWN_RATE(417188, 24000, 1001), - KNOWN_RATE(416667, 24, 1), - KNOWN_RATE(400000, 25, 1), - KNOWN_RATE(333667, 30000, 1001), - KNOWN_RATE(333333, 30, 1), - KNOWN_RATE(200000, 50, 1), - KNOWN_RATE(166833, 60000, 1001), - KNOWN_RATE(166667, 60, 1), -#undef KNOWN_RATE - }; const struct frame_rate *entry; unsigned int gcd; TRACE("%s, %p, %p.\n", wine_dbgstr_longlong(avgtime), numerator, denominator); - if ((entry = bsearch(&avgtime, known_rates, ARRAY_SIZE(known_rates), sizeof(*known_rates), - frame_rate_compare))) + if ((entry = known_rate_from_time(avgtime))) { - *numerator = entry->value >> 32; - *denominator = entry->value; + *numerator = entry->rate >> 32; + *denominator = entry->rate; } else if (avgtime) { diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index e6ed89225d5..b6d63f42d1c 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -8206,40 +8206,39 @@ static void test_MFAverageTimePerFrameToFrameRate(void) unsigned int numerator; unsigned int denominator; UINT64 avgtime; - BOOL todo; } frame_rate_tests[] = { - { 60000, 1001, 166863, TRUE }, + { 60000, 1001, 166863 }, { 60000, 1001, 166833 }, - { 60000, 1001, 166803, TRUE }, + { 60000, 1001, 166803 }, - { 30000, 1001, 333697, TRUE }, + { 30000, 1001, 333697 }, { 30000, 1001, 333667 }, - { 30000, 1001, 333637, TRUE }, + { 30000, 1001, 333637 }, - { 24000, 1001, 417218, TRUE }, + { 24000, 1001, 417218 }, { 24000, 1001, 417188 }, - { 24000, 1001, 417158, TRUE }, + { 24000, 1001, 417158 }, - { 60, 1, 166697, TRUE }, + { 60, 1, 166697 }, { 60, 1, 166667 }, - { 60, 1, 166637, TRUE }, + { 60, 1, 166637 }, - { 30, 1, 333363, TRUE }, + { 30, 1, 333363 }, { 30, 1, 333333 }, - { 30, 1, 333303, TRUE }, + { 30, 1, 333303 }, - { 50, 1, 200030, TRUE }, + { 50, 1, 200030 }, { 50, 1, 200000 }, - { 50, 1, 199970, TRUE }, + { 50, 1, 199970 }, - { 25, 1, 400030, TRUE }, + { 25, 1, 400030 }, { 25, 1, 400000 }, - { 25, 1, 399970, TRUE }, + { 25, 1, 399970 }, - { 24, 1, 416697, TRUE }, + { 24, 1, 416697 }, { 24, 1, 416667 }, - { 24, 1, 416637, TRUE }, + { 24, 1, 416637 }, { 1000000, 25641, 256410 }, { 10000000, 83333, 83333 }, @@ -8264,7 +8263,6 @@ static void test_MFAverageTimePerFrameToFrameRate(void) numerator = denominator = 12345; hr = MFAverageTimePerFrameToFrameRate(frame_rate_tests[i].avgtime, &numerator, &denominator); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine_if(frame_rate_tests[i].todo) ok(numerator == frame_rate_tests[i].numerator && denominator == frame_rate_tests[i].denominator, "%u: unexpected %u/%u, expected %u/%u.\n", i, numerator, denominator, frame_rate_tests[i].numerator, frame_rate_tests[i].denominator);
1
0
0
0
Rémi Bernon : mfplat/tests: Add more MFAverageTimePerFrameToFrameRate tests.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: 578d104cf6f3dc131423fd861373e2e33eaaf231 URL:
https://gitlab.winehq.org/wine/wine/-/commit/578d104cf6f3dc131423fd861373e2…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Mar 18 13:35:22 2024 +0100 mfplat/tests: Add more MFAverageTimePerFrameToFrameRate tests. --- dlls/mfplat/tests/mfplat.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 7277346ebfe..e6ed89225d5 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -8206,16 +8206,40 @@ static void test_MFAverageTimePerFrameToFrameRate(void) unsigned int numerator; unsigned int denominator; UINT64 avgtime; + BOOL todo; } frame_rate_tests[] = { + { 60000, 1001, 166863, TRUE }, { 60000, 1001, 166833 }, + { 60000, 1001, 166803, TRUE }, + + { 30000, 1001, 333697, TRUE }, { 30000, 1001, 333667 }, + { 30000, 1001, 333637, TRUE }, + + { 24000, 1001, 417218, TRUE }, { 24000, 1001, 417188 }, + { 24000, 1001, 417158, TRUE }, + + { 60, 1, 166697, TRUE }, { 60, 1, 166667 }, + { 60, 1, 166637, TRUE }, + + { 30, 1, 333363, TRUE }, { 30, 1, 333333 }, + { 30, 1, 333303, TRUE }, + + { 50, 1, 200030, TRUE }, { 50, 1, 200000 }, + { 50, 1, 199970, TRUE }, + + { 25, 1, 400030, TRUE }, { 25, 1, 400000 }, + { 25, 1, 399970, TRUE }, + + { 24, 1, 416697, TRUE }, { 24, 1, 416667 }, + { 24, 1, 416637, TRUE }, { 1000000, 25641, 256410 }, { 10000000, 83333, 83333 }, @@ -8240,6 +8264,7 @@ static void test_MFAverageTimePerFrameToFrameRate(void) numerator = denominator = 12345; hr = MFAverageTimePerFrameToFrameRate(frame_rate_tests[i].avgtime, &numerator, &denominator); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine_if(frame_rate_tests[i].todo) ok(numerator == frame_rate_tests[i].numerator && denominator == frame_rate_tests[i].denominator, "%u: unexpected %u/%u, expected %u/%u.\n", i, numerator, denominator, frame_rate_tests[i].numerator, frame_rate_tests[i].denominator);
1
0
0
0
Rémi Bernon : mfplat/mediatype: Set rcSource and rcTarget if stride differs from width.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: c94c464920dbda6d5471d30d33a448aba4d71d80 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c94c464920dbda6d5471d30d33a448…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 17 16:56:57 2024 +0100 mfplat/mediatype: Set rcSource and rcTarget if stride differs from width. --- dlls/mfplat/mediatype.c | 23 +++++++++++++++-------- dlls/mfplat/tests/mfplat.c | 12 ------------ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index c9ca4c471e7..6ed23c0ef6a 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3923,9 +3923,8 @@ static HRESULT init_am_media_type_audio_format(AM_MEDIA_TYPE *am_type, UINT32 us static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, IMFMediaType *media_type) { struct uncompressed_video_format *video_format = mf_get_video_format(subtype); - UINT32 image_size, bitrate, sample_size; + UINT32 image_size, bitrate, sample_size, width, height; UINT64 frame_size, frame_rate; - INT32 width, height; vih->bmiHeader.biSize = sizeof(vih->bmiHeader); vih->bmiHeader.biPlanes = 1; @@ -3948,18 +3947,26 @@ static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &frame_size))) { BOOL bottom_up = vih->bmiHeader.biCompression == BI_RGB || vih->bmiHeader.biCompression == BI_BITFIELDS; + INT32 stride; - if (FAILED(IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, (UINT32 *)&width))) - width = (frame_size >> 32) * (bottom_up ? -1 : 1); + width = frame_size >> 32; + if (FAILED(IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, (UINT32 *)&stride))) + stride = width * (bottom_up ? -1 : 1); else if (video_format) - width /= video_format->bpp / 8; + stride /= video_format->bpp / 8; height = (UINT32)frame_size; - vih->bmiHeader.biWidth = abs(width); - vih->bmiHeader.biHeight = height * (bottom_up && width >= 0 ? -1 : 1); + vih->bmiHeader.biWidth = abs(stride); + vih->bmiHeader.biHeight = height * (bottom_up && stride >= 0 ? -1 : 1); - if (SUCCEEDED(MFCalculateImageSize(subtype, abs(width), height, &image_size))) + if (SUCCEEDED(MFCalculateImageSize(subtype, abs(stride), height, &image_size))) vih->bmiHeader.biSizeImage = image_size; + + if (vih->bmiHeader.biWidth > width) + { + vih->rcSource.right = vih->rcTarget.right = width; + vih->rcSource.bottom = vih->rcTarget.bottom = height; + } } } diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index c1cedec16c4..7277346ebfe 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -7619,16 +7619,12 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); - todo_wine ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); - todo_wine ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); - todo_wine ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); - todo_wine ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight); @@ -7642,16 +7638,12 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); - todo_wine ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); - todo_wine ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); - todo_wine ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); - todo_wine ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == -456, "got %ld\n", video_info->bmiHeader.biHeight); @@ -7674,16 +7666,12 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); - todo_wine ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); - todo_wine ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); - todo_wine ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); - todo_wine ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight);
1
0
0
0
Rémi Bernon : mfplat/mediatype: Map rcSource to MF_MT_(PAN_SCAN|MINIMUM_DISPLAY)_APERTURE.
by Alexandre Julliard
18 Mar '24
18 Mar '24
Module: wine Branch: master Commit: d0c996b2b4f3279286034be75936239f9dcf0bd1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d0c996b2b4f3279286034be7593623…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat Feb 17 14:04:58 2024 +0100 mfplat/mediatype: Map rcSource to MF_MT_(PAN_SCAN|MINIMUM_DISPLAY)_APERTURE. --- dlls/mfplat/mediatype.c | 14 ++++++++++++++ dlls/mfplat/tests/mfplat.c | 19 ------------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index f09a20d68fe..c9ca4c471e7 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3794,6 +3794,20 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con if (vih->bmiHeader.biSizeImage) mediatype_set_uint32(media_type, &MF_MT_SAMPLE_SIZE, vih->bmiHeader.biSizeImage, &hr); + if (vih->rcSource.left || vih->rcSource.top || vih->rcSource.right || vih->rcSource.bottom) + { + MFVideoArea aperture = {{0}}; + + aperture.OffsetX.value = vih->rcSource.left; + aperture.OffsetY.value = vih->rcSource.top; + aperture.Area.cx = vih->rcSource.right - vih->rcSource.left; + aperture.Area.cy = vih->rcSource.bottom - vih->rcSource.top; + + mediatype_set_uint32(media_type, &MF_MT_PAN_SCAN_ENABLED, 1, &hr); + mediatype_set_blob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &hr); + mediatype_set_blob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &hr); + } + return hr; } diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 3ef01a07de5..c1cedec16c4 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10084,28 +10084,20 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); value32 = 0xdeadbeef; hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 1, "got %d.\n", (UINT32)value32); value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); hr = IMFMediaType_GetItem(media_type, &MF_MT_GEOMETRIC_APERTURE, NULL); @@ -10407,28 +10399,20 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); value32 = 0xdeadbeef; hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 1, "got %d.\n", (UINT32)value32); value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); hr = IMFMediaType_GetItem(media_type, &MF_MT_GEOMETRIC_APERTURE, NULL); @@ -10706,11 +10690,8 @@ static void test_MFInitMediaTypeFromAMMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(value32 == 12345678, "got %d.\n", (UINT32)value32); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); vih.bmiHeader.biHeight = 24;
1
0
0
0
← Newer
1
...
25
26
27
28
29
30
31
...
78
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Results per page:
10
25
50
100
200