From 6b2cc4c58f4fba8a443a2c45ec8cccba7e0ab561 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Tue, 22 Jul 2014 08:38:10 -0600 Subject: [PATCH] Return correct IMediaSeeking stream positions in quartz. --- debian/changelog | 3 +- ...he-stream-position-in-addition-to-th.patch | 58 +++++++++++++++ ...-MediaSeeking_GetCurrentPosition-on-.patch | 72 +++++++++++++++++++ ...-MediaSeeking_GetStopPosition-on-top.patch | 68 ++++++++++++++++++ ...used-cache-of-MediaSeeking-stop-posi.patch | 44 ++++++++++++ .../748e5166-11ad-11e4-ae23-0090f5c75ad5.def | 3 + patches/patch-list.patch | 3 +- 7 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 patches/18-quartz-MediaSeeking_Positions/0001-quartz-Include-the-stream-position-in-addition-to-th.patch create mode 100644 patches/18-quartz-MediaSeeking_Positions/0002-quartz-Implement-MediaSeeking_GetCurrentPosition-on-.patch create mode 100644 patches/18-quartz-MediaSeeking_Positions/0003-quartz-Implement-MediaSeeking_GetStopPosition-on-top.patch create mode 100644 patches/18-quartz-MediaSeeking_Positions/0004-quartz-Remove-unused-cache-of-MediaSeeking-stop-posi.patch create mode 100644 patches/18-quartz-MediaSeeking_Positions/748e5166-11ad-11e4-ae23-0090f5c75ad5.def diff --git a/debian/changelog b/debian/changelog index ca30ace0..aea065b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,8 @@ wine-compholio (1.7.23) UNRELEASED; urgency=low * Fix possible race conditions in strmbase/quartz. * Fix race condition between EndOfStream and Pause. - -- Erich E. Hoover Fri, 18 Jul 2014 10:58:01 -0600 + * Return correct IMediaSeeking stream positions in quartz. + -- Erich E. Hoover Tue, 22 Jul 2014 08:37:27 -0600 wine-compholio (1.7.22) unstable; urgency=low * Implement passing ACLs to CreateProcess. diff --git a/patches/18-quartz-MediaSeeking_Positions/0001-quartz-Include-the-stream-position-in-addition-to-th.patch b/patches/18-quartz-MediaSeeking_Positions/0001-quartz-Include-the-stream-position-in-addition-to-th.patch new file mode 100644 index 00000000..fd74ec8c --- /dev/null +++ b/patches/18-quartz-MediaSeeking_Positions/0001-quartz-Include-the-stream-position-in-addition-to-th.patch @@ -0,0 +1,58 @@ +From fb2417ad73fb67b20340a65d645b9dac245bdbf0 Mon Sep 17 00:00:00 2001 +From: "Erich E. Hoover" +Date: Tue, 22 Jul 2014 08:26:47 -0600 +Subject: quartz: Include the stream position in addition to the reference + clock offset in the time returned by MediaSeeking_GetPositions. + +--- + dlls/quartz/filtergraph.c | 27 ++++++++++++++++++++++++--- + 1 file changed, 24 insertions(+), 3 deletions(-) + +diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c +index 771a330..ad24691 100644 +--- a/dlls/quartz/filtergraph.c ++++ b/dlls/quartz/filtergraph.c +@@ -2539,16 +2539,37 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG * + return hr; + } + ++static HRESULT WINAPI found_getposition(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pargs) ++{ ++ struct pos_args *args = (void*)pargs; ++ ++ return IMediaSeeking_GetPositions(seek, args->current, args->stop); ++} ++ + static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface, LONGLONG *pCurrent, + LONGLONG *pStop) + { + IFilterGraphImpl *This = impl_from_IMediaSeeking(iface); ++ struct pos_args args; ++ LONGLONG time = 0; + HRESULT hr; + + TRACE("(%p/%p)->(%p, %p)\n", This, iface, pCurrent, pStop); +- hr = IMediaSeeking_GetCurrentPosition(iface, pCurrent); +- if (SUCCEEDED(hr)) +- hr = IMediaSeeking_GetStopPosition(iface, pStop); ++ ++ args.current = pCurrent; ++ args.stop = pStop; ++ EnterCriticalSection(&This->cs); ++ hr = all_renderers_seek(This, found_getposition, (DWORD_PTR)&args); ++ if (This->state == State_Running && This->refClock && This->start_time >= 0) ++ { ++ IReferenceClock_GetTime(This->refClock, &time); ++ if (time) ++ time -= This->start_time; ++ } ++ if (This->pause_time > 0) ++ time += This->pause_time; ++ *pCurrent += time; ++ LeaveCriticalSection(&This->cs); + + return hr; + } +-- +1.7.9.5 + diff --git a/patches/18-quartz-MediaSeeking_Positions/0002-quartz-Implement-MediaSeeking_GetCurrentPosition-on-.patch b/patches/18-quartz-MediaSeeking_Positions/0002-quartz-Implement-MediaSeeking_GetCurrentPosition-on-.patch new file mode 100644 index 00000000..a1135ee9 --- /dev/null +++ b/patches/18-quartz-MediaSeeking_Positions/0002-quartz-Implement-MediaSeeking_GetCurrentPosition-on-.patch @@ -0,0 +1,72 @@ +From 77648650211d1750a49494b2d0bcf7943b58e1b1 Mon Sep 17 00:00:00 2001 +From: "Erich E. Hoover" +Date: Tue, 22 Jul 2014 08:27:52 -0600 +Subject: quartz: Implement MediaSeeking_GetCurrentPosition on top of + MediaSeeking_GetPositions. + +--- + dlls/quartz/filtergraph.c | 41 ++++++++++++++++------------------------- + 1 file changed, 16 insertions(+), 25 deletions(-) + +diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c +index ad24691..4c093f3 100644 +--- a/dlls/quartz/filtergraph.c ++++ b/dlls/quartz/filtergraph.c +@@ -2451,31 +2451,6 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLON + return hr; + } + +-static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *pCurrent) +-{ +- IFilterGraphImpl *This = impl_from_IMediaSeeking(iface); +- LONGLONG time = 0; +- +- if (!pCurrent) +- return E_POINTER; +- +- EnterCriticalSection(&This->cs); +- if (This->state == State_Running && This->refClock && This->start_time >= 0) +- { +- IReferenceClock_GetTime(This->refClock, &time); +- if (time) +- time -= This->start_time; +- } +- if (This->pause_time > 0) +- time += This->pause_time; +- *pCurrent = time; +- LeaveCriticalSection(&This->cs); +- +- TRACE("Time: %u.%03u\n", (DWORD)(*pCurrent / 10000000), (DWORD)((*pCurrent / 10000)%1000)); +- +- return S_OK; +-} +- + static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *pTarget, + const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat) + { +@@ -2574,6 +2549,22 @@ static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface, LONGLONG * + return hr; + } + ++static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *pCurrent) ++{ ++ IFilterGraphImpl *This = impl_from_IMediaSeeking(iface); ++ LONGLONG time; ++ HRESULT hr; ++ ++ if (!pCurrent) ++ return E_POINTER; ++ ++ hr = MediaSeeking_GetPositions(iface, pCurrent, &time); ++ ++ TRACE("Time: %u.%03u\n", (DWORD)(*pCurrent / 10000000), (DWORD)((*pCurrent / 10000)%1000)); ++ ++ return hr; ++} ++ + static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface, LONGLONG *pEarliest, + LONGLONG *pLatest) + { +-- +1.7.9.5 + diff --git a/patches/18-quartz-MediaSeeking_Positions/0003-quartz-Implement-MediaSeeking_GetStopPosition-on-top.patch b/patches/18-quartz-MediaSeeking_Positions/0003-quartz-Implement-MediaSeeking_GetStopPosition-on-top.patch new file mode 100644 index 00000000..c7e1be02 --- /dev/null +++ b/patches/18-quartz-MediaSeeking_Positions/0003-quartz-Implement-MediaSeeking_GetStopPosition-on-top.patch @@ -0,0 +1,68 @@ +From e2abc9b73d2e909f62468de5d66c5d9ec51fce0f Mon Sep 17 00:00:00 2001 +From: "Erich E. Hoover" +Date: Tue, 22 Jul 2014 08:32:31 -0600 +Subject: quartz: Implement MediaSeeking_GetStopPosition on top of + MediaSeeking_GetPositions. + +--- + dlls/quartz/filtergraph.c | 37 ++++++++++++++++--------------------- + 1 file changed, 16 insertions(+), 21 deletions(-) + +diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c +index 4c093f3..0d06ba4 100644 +--- a/dlls/quartz/filtergraph.c ++++ b/dlls/quartz/filtergraph.c +@@ -2430,27 +2430,6 @@ static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface, LONGLONG *p + return hr; + } + +-static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *pStop) +-{ +- IFilterGraphImpl *This = impl_from_IMediaSeeking(iface); +- HRESULT hr = S_OK; +- +- TRACE("(%p/%p)->(%p)\n", This, iface, pStop); +- +- if (!pStop) +- return E_POINTER; +- +- EnterCriticalSection(&This->cs); +- if (This->stop_position < 0) +- /* Stop position not set, use duration instead */ +- hr = IMediaSeeking_GetDuration(iface, pStop); +- else +- *pStop = This->stop_position; +- LeaveCriticalSection(&This->cs); +- +- return hr; +-} +- + static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *pTarget, + const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat) + { +@@ -2565,6 +2544,22 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG + return hr; + } + ++static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *pStop) ++{ ++ IFilterGraphImpl *This = impl_from_IMediaSeeking(iface); ++ LONGLONG time; ++ HRESULT hr; ++ ++ TRACE("(%p/%p)->(%p)\n", This, iface, pStop); ++ ++ if (!pStop) ++ return E_POINTER; ++ ++ hr = MediaSeeking_GetPositions(iface, &time, pStop); ++ ++ return hr; ++} ++ + static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface, LONGLONG *pEarliest, + LONGLONG *pLatest) + { +-- +1.7.9.5 + diff --git a/patches/18-quartz-MediaSeeking_Positions/0004-quartz-Remove-unused-cache-of-MediaSeeking-stop-posi.patch b/patches/18-quartz-MediaSeeking_Positions/0004-quartz-Remove-unused-cache-of-MediaSeeking-stop-posi.patch new file mode 100644 index 00000000..22f04439 --- /dev/null +++ b/patches/18-quartz-MediaSeeking_Positions/0004-quartz-Remove-unused-cache-of-MediaSeeking-stop-posi.patch @@ -0,0 +1,44 @@ +From 3c9438db949d434b8cb5fba36ee55df384624016 Mon Sep 17 00:00:00 2001 +From: "Erich E. Hoover" +Date: Tue, 22 Jul 2014 08:34:09 -0600 +Subject: quartz: Remove unused cache of MediaSeeking stop position. + +--- + dlls/quartz/filtergraph.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c +index 0d06ba4..df6b4bd 100644 +--- a/dlls/quartz/filtergraph.c ++++ b/dlls/quartz/filtergraph.c +@@ -201,7 +201,6 @@ typedef struct _IFilterGraphImpl { + GUID timeformatseek; + REFERENCE_TIME start_time; + REFERENCE_TIME pause_time; +- LONGLONG stop_position; + LONG recursioncount; + IUnknown *pSite; + LONG version; +@@ -2471,11 +2470,6 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG * + (dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning) + FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags & 0x7); + +- if ((dwStopFlags & 0x7) == AM_SEEKING_AbsolutePositioning) +- This->stop_position = *pStop; +- else if ((dwStopFlags & 0x7) != AM_SEEKING_NoPositioning) +- FIXME("Stop position not handled yet!\n"); +- + if (state == State_Running && !(dwCurrentFlags & AM_SEEKING_NoFlush)) + IMediaControl_Pause(&This->IMediaControl_iface); + args.current = pCurrent; +@@ -5669,7 +5663,6 @@ HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj) + fimpl->nItfCacheEntries = 0; + memcpy(&fimpl->timeformatseek, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID)); + fimpl->start_time = fimpl->pause_time = 0; +- fimpl->stop_position = -1; + fimpl->punkFilterMapper2 = NULL; + fimpl->recursioncount = 0; + fimpl->version = 0; +-- +1.7.9.5 + diff --git a/patches/18-quartz-MediaSeeking_Positions/748e5166-11ad-11e4-ae23-0090f5c75ad5.def b/patches/18-quartz-MediaSeeking_Positions/748e5166-11ad-11e4-ae23-0090f5c75ad5.def new file mode 100644 index 00000000..8a0fdc78 --- /dev/null +++ b/patches/18-quartz-MediaSeeking_Positions/748e5166-11ad-11e4-ae23-0090f5c75ad5.def @@ -0,0 +1,3 @@ +Revision: 1 +Author: Erich E. Hoover +Title: Return correct IMediaSeeking stream positions in quartz. diff --git a/patches/patch-list.patch b/patches/patch-list.patch index 8ebe53f6..583f5ee7 100644 --- a/patches/patch-list.patch +++ b/patches/patch-list.patch @@ -6,7 +6,7 @@ diff --git a/libs/wine/config.c b/libs/wine/config.c index a273502..5fa0cd5 100644 --- a/libs/wine/config.c +++ b/libs/wine/config.c -@@ -478,6 +478,45 @@ const char *wine_get_version(void) +@@ -478,6 +478,46 @@ const char *wine_get_version(void) return PACKAGE_VERSION; } @@ -33,6 +33,7 @@ index a273502..5fa0cd5 100644 + { "3790a2d5-f930-423e-9c03-f7fc1c1e0811:1", "Sebastian Lackner", "Partial implementation of WTSEnumerateProcessesW." }, + { "a3f43350-092c-11e4-9b1e-0090f5c75ad5:1", "Joris van der Wel", "Implement passing ACLs to CreateProcess." }, + { "c64ef9a8-0dd2-11e4-ab01-0090f5c75ad5:1", "Erich E. Hoover", "Fix possible race conditions in strmbase/quartz." }, ++ { "748e5166-11ad-11e4-ae23-0090f5c75ad5:1", "Erich E. Hoover", "Return correct IMediaSeeking stream positions in quartz." }, + { "0b21d7ac-0387-4493-aa38-fbafe3e749f5:2", "Michael Müller", "Decrease minimum SetTimer interval to 5 ms." }, + { "2394843e-2bc4-4fa4-8368-1ef32093b89e:1", "Michael Müller", "Allow changing strict draw ordering through an exported function." }, + { "255473fa-4e0a-4f51-952b-4deecc1a2181:1", "Michael Müller", "Indicate direct rendering through OpenGL extension." },