Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 2 +- dlls/quartz/videorenderer.c | 17 +++++++---------- dlls/quartz/vmr9.c | 20 +++++++++----------- dlls/quartz/window.c | 3 +-- 4 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 3274714eea1..b0fb91c665a 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -111,7 +111,7 @@ struct video_window_ops
void video_window_cleanup(struct video_window *window) DECLSPEC_HIDDEN; HRESULT video_window_create_window(struct video_window *window) DECLSPEC_HIDDEN; -HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, +void video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, struct strmbase_filter *filter, struct strmbase_pin *pin, const struct video_window_ops *ops) DECLSPEC_HIDDEN; void video_window_unregister_class(void) DECLSPEC_HIDDEN;
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 3888d010e6e..54a646fbc04 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -714,27 +714,24 @@ HRESULT video_renderer_create(IUnknown *outer, IUnknown **out) strmbase_renderer_init(&object->renderer, outer, &CLSID_VideoRenderer, L"In", &renderer_ops); object->IOverlay_iface.lpVtbl = &overlay_vtbl;
- hr = video_window_init(&object->baseControlWindow, &IVideoWindow_VTable, + video_window_init(&object->baseControlWindow, &IVideoWindow_VTable, &object->renderer.filter, &object->renderer.sink.pin, &window_ops); - if (FAILED(hr)) - goto fail; - basic_video_init(&object->baseControlVideo, &object->renderer.filter, &object->renderer.sink.pin, &renderer_BaseControlVideoFuncTable);
if (FAILED(hr = video_window_create_window(&object->baseControlWindow))) - goto fail; + { + video_window_cleanup(&object->baseControlWindow); + strmbase_renderer_cleanup(&object->renderer); + free(object); + return hr; + }
object->run_event = CreateEventW(NULL, TRUE, FALSE, NULL);
TRACE("Created video renderer %p.\n", object); *out = &object->renderer.filter.IUnknown_inner; return S_OK; - -fail: - strmbase_renderer_cleanup(&object->renderer); - free(object); - return hr; }
HRESULT video_renderer_default_create(IUnknown *outer, IUnknown **out) diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 82727adb870..389166db3ed 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2318,13 +2318,17 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) object->IVMRWindowlessControl9_iface.lpVtbl = &VMR9_WindowlessControl_Vtbl; object->IOverlay_iface.lpVtbl = &overlay_vtbl;
- hr = video_window_init(&object->baseControlWindow, &IVideoWindow_VTable, + video_window_init(&object->baseControlWindow, &IVideoWindow_VTable, &object->renderer.filter, &object->renderer.sink.pin, &window_ops); - if (FAILED(hr)) - goto fail;
if (FAILED(hr = video_window_create_window(&object->baseControlWindow))) - goto fail; + { + video_window_cleanup(&object->baseControlWindow); + strmbase_renderer_cleanup(&object->renderer); + FreeLibrary(object->hD3d9); + free(object); + return hr; + }
basic_video_init(&object->baseControlVideo, &object->renderer.filter, &object->renderer.sink.pin, &renderer_BaseControlVideoFuncTable); @@ -2333,13 +2337,7 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid)
TRACE("Created VMR %p.\n", object); *out = &object->renderer.filter.IUnknown_inner; - return hr; - -fail: - strmbase_renderer_cleanup(&object->renderer); - FreeLibrary(object->hD3d9); - free(object); - return hr; + return S_OK; }
HRESULT vmr7_create(IUnknown *outer, IUnknown **out) diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c index 7e8aba8a263..61673cab048 100644 --- a/dlls/quartz/window.c +++ b/dlls/quartz/window.c @@ -662,7 +662,7 @@ void video_window_unregister_class(void) ERR("Failed to unregister class, error %u.\n", GetLastError()); }
-HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, +void video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, struct strmbase_filter *owner, struct strmbase_pin *pin, const struct video_window_ops *ops) { memset(window, 0, sizeof(*window)); @@ -671,7 +671,6 @@ HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *v window->AutoShow = OATRUE; window->pFilter = owner; window->pPin = pin; - return S_OK; }
void video_window_cleanup(struct video_window *window)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 1 - dlls/quartz/window.c | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index b0fb91c665a..9c39b642c48 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -92,7 +92,6 @@ struct video_window IVideoWindow IVideoWindow_iface;
HWND hwnd; - LONG width, height; BOOL AutoShow; HWND hwndDrain; HWND hwndOwner; diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c index 61673cab048..b8fbd2694ca 100644 --- a/dlls/quartz/window.c +++ b/dlls/quartz/window.c @@ -70,9 +70,6 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM case WM_SIZE: if (window->ops->resize) return window->ops->resize(window, LOWORD(lparam), HIWORD(lparam)); - - window->width = LOWORD(lparam); - window->height = HIWORD(lparam); }
return DefWindowProcW(hwnd, message, wparam, lparam); @@ -370,24 +367,27 @@ HRESULT WINAPI BaseControlWindowImpl_get_Left(IVideoWindow *iface, LONG *left) HRESULT WINAPI BaseControlWindowImpl_put_Width(IVideoWindow *iface, LONG width) { struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
TRACE("window %p, width %d.\n", window, width);
- if (!SetWindowPos(window->hwnd, NULL, 0, 0, width, window->height, + GetWindowRect(window->hwnd, &rect); + if (!SetWindowPos(window->hwnd, NULL, 0, 0, width, rect.bottom - rect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE)) return E_FAIL;
- window->width = width; return S_OK; }
HRESULT WINAPI BaseControlWindowImpl_get_Width(IVideoWindow *iface, LONG *width) { struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
TRACE("window %p, width %p.\n", window, width);
- *width = window->width; + GetWindowRect(window->hwnd, &rect); + *width = rect.right - rect.left; return S_OK; }
@@ -421,24 +421,27 @@ HRESULT WINAPI BaseControlWindowImpl_get_Top(IVideoWindow *iface, LONG *top) HRESULT WINAPI BaseControlWindowImpl_put_Height(IVideoWindow *iface, LONG height) { struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
TRACE("window %p, height %d.\n", window, height);
- if (!SetWindowPos(window->hwnd, NULL, 0, 0, window->width, + GetWindowRect(window->hwnd, &rect); + if (!SetWindowPos(window->hwnd, NULL, 0, 0, rect.right - rect.left, height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE)) return E_FAIL;
- window->height = height; return S_OK; }
HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *height) { struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
TRACE("window %p, height %p.\n", window, height);
- *height = window->height; + GetWindowRect(window->hwnd, &rect); + *height = rect.bottom - rect.top; return S_OK; }
@@ -555,9 +558,6 @@ HRESULT WINAPI BaseControlWindowImpl_SetWindowPosition(IVideoWindow *iface,
if (!SetWindowPos(window->hwnd, NULL, left, top, width, height, SWP_NOACTIVATE | SWP_NOZORDER)) return E_FAIL; - - window->width = width; - window->height = height; return S_OK; }
@@ -572,8 +572,8 @@ HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, GetWindowRect(window->hwnd, &rect); *left = rect.left; *top = rect.top; - *width = window->width; - *height = window->height; + *width = rect.right - rect.left; + *height = rect.bottom - rect.top; return S_OK; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/filesource.c | 27 --------------------------- 1 file changed, 27 deletions(-)
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index a4643529224..3b19d6e7df5 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -63,7 +63,6 @@ struct async_reader
LPOLESTR pszFileName; AM_MEDIA_TYPE mt; - ALLOCATOR_PROPERTIES allocProps; HANDLE file, port, io_thread; CRITICAL_SECTION sample_cs; BOOL flushing; @@ -550,11 +549,6 @@ static inline struct async_reader *impl_from_strmbase_pin(struct strmbase_pin *i return CONTAINING_RECORD(iface, struct async_reader, source.pin); }
-static inline struct async_reader *impl_from_strmbase_source(struct strmbase_source *iface) -{ - return CONTAINING_RECORD(iface, struct async_reader, source); -} - static inline struct async_reader *impl_from_IAsyncReader(IAsyncReader *iface) { return CONTAINING_RECORD(iface, struct async_reader, IAsyncReader_iface); @@ -630,32 +624,12 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(struct strmbase_sourc return hr; }
-static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(struct strmbase_source *iface, - IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) -{ - struct async_reader *This = impl_from_strmbase_source(iface); - ALLOCATOR_PROPERTIES actual; - - if (ppropInputRequest->cbAlign && ppropInputRequest->cbAlign != This->allocProps.cbAlign) - FIXME("Requested Buffer cbAlign mismatch %i,%i\n",This->allocProps.cbAlign, ppropInputRequest->cbAlign); - if (ppropInputRequest->cbPrefix) - FIXME("Requested Buffer cbPrefix mismatch %i,%i\n",This->allocProps.cbPrefix, ppropInputRequest->cbPrefix); - if (ppropInputRequest->cbBuffer) - FIXME("Requested Buffer cbBuffer mismatch %i,%i\n",This->allocProps.cbBuffer, ppropInputRequest->cbBuffer); - if (ppropInputRequest->cBuffers) - FIXME("Requested Buffer cBuffers mismatch %i,%i\n",This->allocProps.cBuffers, ppropInputRequest->cBuffers); - - return IMemAllocator_SetProperties(pAlloc, &This->allocProps, &actual); -} - static const struct strmbase_source_ops source_ops = { .base.pin_query_accept = source_query_accept, .base.pin_get_media_type = source_get_media_type, .base.pin_query_interface = source_query_interface, .pfnAttemptConnection = FileAsyncReaderPin_AttemptConnection, - .pfnDecideBufferSize = FileAsyncReaderPin_DecideBufferSize, - .pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator, };
static HRESULT WINAPI FileAsyncReader_QueryInterface(IAsyncReader *iface, REFIID iid, void **out) @@ -720,7 +694,6 @@ static HRESULT WINAPI FileAsyncReader_RequestAllocator(IAsyncReader *iface,
for (i = 0; i < filter->max_requests; ++i) filter->requests[i].ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - filter->allocProps = *props;
*ret_allocator = allocator; return S_OK;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/qcap.c | 2 +- dlls/strmbase/pin.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/qcap/tests/qcap.c b/dlls/qcap/tests/qcap.c index 45fd98b7f93..56eaf775132 100644 --- a/dlls/qcap/tests/qcap.c +++ b/dlls/qcap/tests/qcap.c @@ -1433,7 +1433,7 @@ static void test_AviMux(char *arg) pin, &source_filter.IPin_iface);
hr = IPin_Connect(avimux_out, &source_filter.IPin_iface, NULL); - todo_wine ok(hr == VFW_E_INVALID_DIRECTION, "Connect returned %x\n", hr); + ok(hr == VFW_E_INVALID_DIRECTION, "Connect returned %x\n", hr);
hr = IBaseFilter_JoinFilterGraph(avimux, (IFilterGraph*)&GraphBuilder, NULL); ok(hr == S_OK, "JoinFilterGraph returned %x\n", hr); diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index b2a0c39110f..4676c9d82b0 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -447,6 +447,7 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP struct strmbase_source *pin = impl_source_from_IPin(iface); AM_MEDIA_TYPE candidate, *candidate_ptr; IEnumMediaTypes *enummt; + PIN_DIRECTION dir; unsigned int i; ULONG count; HRESULT hr; @@ -458,10 +459,12 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP if (!peer) return E_POINTER;
- /* If we try to connect to ourselves, we will definitely deadlock. - * There are other cases where we could deadlock too, but this - * catches the obvious case */ - assert(peer != iface); + IPin_QueryDirection(peer, &dir); + if (dir != PINDIR_INPUT) + { + WARN("Attempt to connect to another source pin, returning VFW_E_INVALID_DIRECTION.\n"); + return VFW_E_INVALID_DIRECTION; + }
EnterCriticalSection(&pin->pin.filter->csFilter);