2004-08-24 04:28:35 +02:00
|
|
|
/*
|
|
|
|
* Video Renderer (Fullscreen and Windowed using Direct Draw)
|
|
|
|
*
|
|
|
|
* Copyright 2004 Christian Costa
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-08-24 04:28:35 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "quartz_private.h"
|
|
|
|
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "vfwmsgs.h"
|
|
|
|
#include "amvideo.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "dshow.h"
|
2005-03-02 11:12:12 +01:00
|
|
|
#include "evcode.h"
|
2004-08-24 04:28:35 +02:00
|
|
|
#include "strmif.h"
|
|
|
|
#include "ddraw.h"
|
2008-04-12 00:10:19 +02:00
|
|
|
#include "dvdmedia.h"
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2008-07-26 19:12:32 +02:00
|
|
|
#include <assert.h>
|
2004-08-24 04:28:35 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2019-10-24 03:04:23 +02:00
|
|
|
struct strmbase_renderer renderer;
|
2020-05-07 02:28:48 +02:00
|
|
|
struct video_window window;
|
2012-03-31 03:09:14 +02:00
|
|
|
|
2019-10-02 05:43:13 +02:00
|
|
|
IOverlay IOverlay_iface;
|
|
|
|
|
2010-05-19 21:46:50 +02:00
|
|
|
LONG VideoWidth;
|
|
|
|
LONG VideoHeight;
|
2016-07-20 06:37:12 +02:00
|
|
|
LONG FullScreenMode;
|
2019-10-17 02:36:47 +02:00
|
|
|
|
|
|
|
DWORD saved_style;
|
2020-04-02 06:01:02 +02:00
|
|
|
};
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2020-04-03 06:20:48 +02:00
|
|
|
static inline struct video_renderer *impl_from_video_window(struct video_window *iface)
|
2010-11-29 10:44:16 +01:00
|
|
|
{
|
2020-05-07 02:28:48 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct video_renderer, window);
|
2005-06-13 13:37:55 +02:00
|
|
|
}
|
|
|
|
|
2020-04-02 06:01:02 +02:00
|
|
|
static inline struct video_renderer *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
|
2012-03-31 03:08:55 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct video_renderer, renderer);
|
2012-03-31 03:08:55 +02:00
|
|
|
}
|
|
|
|
|
2020-04-02 06:01:02 +02:00
|
|
|
static inline struct video_renderer *impl_from_IVideoWindow(IVideoWindow *iface)
|
2012-03-31 03:09:14 +02:00
|
|
|
{
|
2020-05-07 02:28:48 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct video_renderer, window.IVideoWindow_iface);
|
2012-03-31 03:09:14 +02:00
|
|
|
}
|
|
|
|
|
2020-05-06 02:03:41 +02:00
|
|
|
static const BITMAPINFOHEADER *get_bitmap_header(const AM_MEDIA_TYPE *mt)
|
|
|
|
{
|
|
|
|
if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo))
|
|
|
|
return &((VIDEOINFOHEADER *)mt->pbFormat)->bmiHeader;
|
|
|
|
else
|
|
|
|
return &((VIDEOINFOHEADER2 *)mt->pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
|
2020-04-02 06:01:02 +02:00
|
|
|
static void VideoRenderer_AutoShowWindow(struct video_renderer *This)
|
2012-10-09 23:55:44 +02:00
|
|
|
{
|
2020-05-07 02:28:48 +02:00
|
|
|
if (This->window.AutoShow)
|
|
|
|
ShowWindow(This->window.hwnd, SW_SHOW);
|
2010-11-11 14:03:29 +01:00
|
|
|
}
|
|
|
|
|
2021-03-12 00:21:56 +01:00
|
|
|
static HRESULT video_renderer_render(struct strmbase_renderer *iface, IMediaSample *pSample)
|
2012-03-31 03:08:55 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
|
2020-05-07 02:28:52 +02:00
|
|
|
RECT src = filter->window.src, dst = filter->window.dst;
|
2004-08-24 04:28:35 +02:00
|
|
|
LPBYTE pbSrcStream = NULL;
|
|
|
|
HRESULT hr;
|
2019-11-22 01:11:24 +01:00
|
|
|
HDC dc;
|
2008-12-02 20:29:48 +01:00
|
|
|
|
2019-11-22 01:11:24 +01:00
|
|
|
TRACE("filter %p, sample %p.\n", filter, pSample);
|
2008-04-17 20:16:13 +02:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2006-10-12 20:57:23 +02:00
|
|
|
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
2005-06-13 13:37:55 +02:00
|
|
|
return hr;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2020-05-07 02:28:48 +02:00
|
|
|
dc = GetDC(filter->window.hwnd);
|
2020-05-07 02:28:51 +02:00
|
|
|
StretchDIBits(dc, dst.left, dst.top, dst.right - dst.left, dst.bottom - dst.top,
|
|
|
|
src.left, src.top, src.right - src.left, src.bottom - src.top, pbSrcStream,
|
|
|
|
(BITMAPINFO *)get_bitmap_header(&filter->renderer.sink.pin.mt), DIB_RGB_COLORS, SRCCOPY);
|
2020-05-07 02:28:48 +02:00
|
|
|
ReleaseDC(filter->window.hwnd, dc);
|
2019-11-22 01:11:24 +01:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-03-11 02:23:37 +01:00
|
|
|
static HRESULT video_renderer_query_accept(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2020-05-06 02:03:41 +02:00
|
|
|
if (!IsEqualGUID(&mt->majortype, &MEDIATYPE_Video))
|
2005-10-10 12:44:54 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2020-05-06 02:03:41 +02:00
|
|
|
if (!IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_RGB32)
|
|
|
|
&& !IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_RGB24)
|
|
|
|
&& !IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_RGB565)
|
|
|
|
&& !IsEqualGUID(&mt->subtype, &MEDIASUBTYPE_RGB8))
|
|
|
|
return S_FALSE;
|
2005-10-10 12:44:54 +02:00
|
|
|
|
2020-05-06 02:03:41 +02:00
|
|
|
if (!IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo)
|
|
|
|
&& !IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo2))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
return S_OK;
|
2004-08-24 04:28:35 +02:00
|
|
|
}
|
|
|
|
|
2019-10-24 03:04:23 +02:00
|
|
|
static void video_renderer_destroy(struct strmbase_renderer *iface)
|
2019-06-04 17:01:18 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
|
2019-06-04 17:01:18 +02:00
|
|
|
|
2020-05-07 02:28:48 +02:00
|
|
|
video_window_cleanup(&filter->window);
|
2019-06-04 17:01:18 +02:00
|
|
|
strmbase_renderer_cleanup(&filter->renderer);
|
2020-04-02 06:01:01 +02:00
|
|
|
free(filter);
|
2019-06-04 17:01:18 +02:00
|
|
|
}
|
|
|
|
|
2019-10-24 03:04:23 +02:00
|
|
|
static HRESULT video_renderer_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
|
2019-06-04 17:01:18 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
|
2019-06-04 17:01:18 +02:00
|
|
|
|
|
|
|
if (IsEqualGUID(iid, &IID_IBasicVideo))
|
2020-05-07 02:28:52 +02:00
|
|
|
*out = &filter->window.IBasicVideo_iface;
|
2019-06-04 17:01:18 +02:00
|
|
|
else if (IsEqualGUID(iid, &IID_IVideoWindow))
|
2020-05-07 02:28:48 +02:00
|
|
|
*out = &filter->window.IVideoWindow_iface;
|
2019-06-04 17:01:18 +02:00
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown *)*out);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-10-24 03:04:23 +02:00
|
|
|
static HRESULT video_renderer_pin_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
|
2019-10-02 05:43:13 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
|
2019-10-02 05:43:13 +02:00
|
|
|
|
|
|
|
if (IsEqualGUID(iid, &IID_IOverlay))
|
|
|
|
*out = &filter->IOverlay_iface;
|
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown *)*out);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-10-24 03:04:23 +02:00
|
|
|
static void video_renderer_stop_stream(struct strmbase_renderer *iface)
|
2012-03-31 03:08:55 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *This = impl_from_strmbase_renderer(iface);
|
2010-10-07 21:48:01 +02:00
|
|
|
|
2012-03-31 03:08:55 +02:00
|
|
|
TRACE("(%p)->()\n", This);
|
2010-10-07 21:48:01 +02:00
|
|
|
|
2020-05-07 02:28:48 +02:00
|
|
|
if (This->window.AutoShow)
|
2012-03-31 03:08:55 +02:00
|
|
|
/* Black it out */
|
2020-05-07 02:28:48 +02:00
|
|
|
RedrawWindow(This->window.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
|
2010-10-07 21:48:01 +02:00
|
|
|
}
|
|
|
|
|
2019-10-24 03:04:23 +02:00
|
|
|
static void video_renderer_init_stream(struct strmbase_renderer *iface)
|
2010-10-07 21:48:01 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
|
2012-03-31 03:08:55 +02:00
|
|
|
|
2019-10-23 01:30:06 +02:00
|
|
|
VideoRenderer_AutoShowWindow(filter);
|
2010-10-07 21:48:01 +02:00
|
|
|
}
|
|
|
|
|
2020-05-06 02:03:42 +02:00
|
|
|
static HRESULT video_renderer_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
|
|
|
|
{
|
|
|
|
struct video_renderer *filter = impl_from_strmbase_renderer(iface);
|
|
|
|
const BITMAPINFOHEADER *bitmap_header = get_bitmap_header(mt);
|
2020-05-07 02:28:48 +02:00
|
|
|
HWND window = filter->window.hwnd;
|
2020-05-06 02:03:43 +02:00
|
|
|
RECT rect;
|
2020-05-06 02:03:42 +02:00
|
|
|
|
|
|
|
filter->VideoWidth = bitmap_header->biWidth;
|
|
|
|
filter->VideoHeight = abs(bitmap_header->biHeight);
|
2020-05-06 02:03:43 +02:00
|
|
|
SetRect(&rect, 0, 0, filter->VideoWidth, filter->VideoHeight);
|
2020-06-26 00:57:38 +02:00
|
|
|
filter->window.src = rect;
|
2020-05-06 02:03:43 +02:00
|
|
|
|
|
|
|
AdjustWindowRectEx(&rect, GetWindowLongW(window, GWL_STYLE), FALSE,
|
|
|
|
GetWindowLongW(window, GWL_EXSTYLE));
|
|
|
|
SetWindowPos(window, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
2020-06-26 00:57:38 +02:00
|
|
|
GetClientRect(window, &filter->window.dst);
|
2020-05-06 02:03:42 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-04-03 06:20:48 +02:00
|
|
|
static RECT video_renderer_get_default_rect(struct video_window *iface)
|
2012-03-31 03:08:45 +02:00
|
|
|
{
|
2020-04-03 06:20:48 +02:00
|
|
|
struct video_renderer *This = impl_from_video_window(iface);
|
2012-03-31 03:09:14 +02:00
|
|
|
static RECT defRect;
|
2012-03-31 03:08:45 +02:00
|
|
|
|
2016-04-13 13:45:54 +02:00
|
|
|
SetRect(&defRect, 0, 0, This->VideoWidth, This->VideoHeight);
|
2012-03-31 03:09:14 +02:00
|
|
|
|
|
|
|
return defRect;
|
2012-03-31 03:08:45 +02:00
|
|
|
}
|
|
|
|
|
2019-10-24 03:04:24 +02:00
|
|
|
static const struct strmbase_renderer_ops renderer_ops =
|
2019-07-03 05:25:45 +02:00
|
|
|
{
|
2021-03-11 02:23:37 +01:00
|
|
|
.renderer_query_accept = video_renderer_query_accept,
|
2021-03-12 00:21:56 +01:00
|
|
|
.renderer_render = video_renderer_render,
|
2019-10-23 01:30:06 +02:00
|
|
|
.renderer_init_stream = video_renderer_init_stream,
|
2019-07-03 05:25:47 +02:00
|
|
|
.renderer_stop_stream = video_renderer_stop_stream,
|
2019-07-03 05:25:45 +02:00
|
|
|
.renderer_destroy = video_renderer_destroy,
|
|
|
|
.renderer_query_interface = video_renderer_query_interface,
|
2019-10-02 05:43:13 +02:00
|
|
|
.renderer_pin_query_interface = video_renderer_pin_query_interface,
|
2020-05-06 02:03:42 +02:00
|
|
|
.renderer_connect = video_renderer_connect,
|
2010-10-13 18:02:01 +02:00
|
|
|
};
|
|
|
|
|
2020-05-07 02:28:52 +02:00
|
|
|
static HRESULT video_renderer_get_current_image(struct video_window *iface, LONG *size, LONG *image)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
2020-05-07 02:28:52 +02:00
|
|
|
struct video_renderer *filter = impl_from_video_window(iface);
|
2020-02-11 02:22:18 +01:00
|
|
|
const BITMAPINFOHEADER *bih;
|
|
|
|
size_t image_size;
|
|
|
|
BYTE *sample_data;
|
2012-03-31 03:09:22 +02:00
|
|
|
|
2021-01-19 04:57:20 +01:00
|
|
|
EnterCriticalSection(&filter->renderer.filter.stream_cs);
|
2012-03-31 03:09:22 +02:00
|
|
|
|
2020-05-06 02:03:41 +02:00
|
|
|
bih = get_bitmap_header(&filter->renderer.sink.pin.mt);
|
2020-02-11 02:22:18 +01:00
|
|
|
image_size = bih->biWidth * bih->biHeight * bih->biBitCount / 8;
|
2012-03-31 03:09:22 +02:00
|
|
|
|
2020-02-11 02:22:18 +01:00
|
|
|
if (!image)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
2021-01-19 04:57:20 +01:00
|
|
|
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
|
2020-02-11 02:22:18 +01:00
|
|
|
*size = sizeof(BITMAPINFOHEADER) + image_size;
|
|
|
|
return S_OK;
|
2012-03-31 03:09:22 +02:00
|
|
|
}
|
2020-02-11 02:22:18 +01:00
|
|
|
|
|
|
|
if (filter->renderer.filter.state != State_Paused)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
2021-01-19 04:57:20 +01:00
|
|
|
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
|
2020-02-11 02:22:18 +01:00
|
|
|
return VFW_E_NOT_PAUSED;
|
2012-03-31 03:09:22 +02:00
|
|
|
}
|
|
|
|
|
2021-03-11 02:23:34 +01:00
|
|
|
if (!filter->renderer.current_sample)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
2021-01-19 04:57:20 +01:00
|
|
|
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
|
2020-02-11 02:22:18 +01:00
|
|
|
return E_UNEXPECTED;
|
2012-03-31 03:09:22 +02:00
|
|
|
}
|
|
|
|
|
2020-02-11 02:22:18 +01:00
|
|
|
if (*size < sizeof(BITMAPINFOHEADER) + image_size)
|
2012-03-31 03:09:22 +02:00
|
|
|
{
|
2021-01-19 04:57:20 +01:00
|
|
|
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
|
2020-02-11 02:22:18 +01:00
|
|
|
return E_OUTOFMEMORY;
|
2012-03-31 03:09:22 +02:00
|
|
|
}
|
|
|
|
|
2020-02-11 02:22:18 +01:00
|
|
|
memcpy(image, bih, sizeof(BITMAPINFOHEADER));
|
2021-03-11 02:23:34 +01:00
|
|
|
IMediaSample_GetPointer(filter->renderer.current_sample, &sample_data);
|
2020-02-11 02:22:18 +01:00
|
|
|
memcpy((char *)image + sizeof(BITMAPINFOHEADER), sample_data, image_size);
|
2012-03-31 03:09:22 +02:00
|
|
|
|
2021-01-19 04:57:20 +01:00
|
|
|
LeaveCriticalSection(&filter->renderer.filter.stream_cs);
|
2012-03-31 03:09:22 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-05-07 02:28:52 +02:00
|
|
|
static const struct video_window_ops window_ops =
|
|
|
|
{
|
|
|
|
.get_default_rect = video_renderer_get_default_rect,
|
|
|
|
.get_current_image = video_renderer_get_current_image,
|
2012-03-31 03:09:22 +02:00
|
|
|
};
|
|
|
|
|
2012-11-27 09:15:08 +01:00
|
|
|
static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface,
|
|
|
|
LONG *FullScreenMode)
|
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *This = impl_from_IVideoWindow(iface);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2016-07-20 06:37:12 +02:00
|
|
|
TRACE("(%p/%p)->(%p): %d\n", This, iface, FullScreenMode, This->FullScreenMode);
|
|
|
|
|
|
|
|
if (!FullScreenMode)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*FullScreenMode = This->FullScreenMode;
|
2004-08-24 04:28:35 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-04-03 06:20:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG fullscreen)
|
2012-11-27 09:15:08 +01:00
|
|
|
{
|
2020-04-03 06:20:48 +02:00
|
|
|
struct video_renderer *filter = impl_from_IVideoWindow(iface);
|
2020-05-07 02:28:48 +02:00
|
|
|
HWND window = filter->window.hwnd;
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2020-04-03 06:20:48 +02:00
|
|
|
FIXME("filter %p, fullscreen %d.\n", filter, fullscreen);
|
2004-08-24 04:28:35 +02:00
|
|
|
|
2020-04-03 06:20:48 +02:00
|
|
|
if (fullscreen)
|
|
|
|
{
|
2020-05-07 02:28:48 +02:00
|
|
|
filter->saved_style = GetWindowLongW(window, GWL_STYLE);
|
|
|
|
ShowWindow(window, SW_HIDE);
|
|
|
|
SetParent(window, NULL);
|
|
|
|
SetWindowLongW(window, GWL_STYLE, WS_POPUP);
|
|
|
|
SetWindowPos(window, HWND_TOP, 0, 0,
|
2020-04-03 06:20:48 +02:00
|
|
|
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_SHOWWINDOW);
|
2020-05-07 02:28:52 +02:00
|
|
|
GetWindowRect(window, &filter->window.dst);
|
2020-04-03 06:20:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-07 02:28:48 +02:00
|
|
|
ShowWindow(window, SW_HIDE);
|
|
|
|
SetParent(window, filter->window.hwndOwner);
|
|
|
|
SetWindowLongW(window, GWL_STYLE, filter->saved_style);
|
2020-05-07 02:28:52 +02:00
|
|
|
GetClientRect(window, &filter->window.dst);
|
|
|
|
SetWindowPos(window, 0, filter->window.dst.left, filter->window.dst.top,
|
|
|
|
filter->window.dst.right, filter->window.dst.bottom, SWP_NOZORDER | SWP_SHOWWINDOW);
|
2010-11-25 00:11:53 +01:00
|
|
|
}
|
2020-04-03 06:20:48 +02:00
|
|
|
filter->FullScreenMode = fullscreen;
|
2010-11-25 00:11:53 +01:00
|
|
|
|
2004-08-24 04:28:35 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IVideoWindowVtbl IVideoWindow_VTable =
|
2004-08-24 04:28:35 +02:00
|
|
|
{
|
2019-06-12 01:54:39 +02:00
|
|
|
BaseControlWindowImpl_QueryInterface,
|
|
|
|
BaseControlWindowImpl_AddRef,
|
|
|
|
BaseControlWindowImpl_Release,
|
2012-03-31 03:09:14 +02:00
|
|
|
BaseControlWindowImpl_GetTypeInfoCount,
|
|
|
|
BaseControlWindowImpl_GetTypeInfo,
|
|
|
|
BaseControlWindowImpl_GetIDsOfNames,
|
|
|
|
BaseControlWindowImpl_Invoke,
|
|
|
|
BaseControlWindowImpl_put_Caption,
|
|
|
|
BaseControlWindowImpl_get_Caption,
|
|
|
|
BaseControlWindowImpl_put_WindowStyle,
|
|
|
|
BaseControlWindowImpl_get_WindowStyle,
|
|
|
|
BaseControlWindowImpl_put_WindowStyleEx,
|
|
|
|
BaseControlWindowImpl_get_WindowStyleEx,
|
|
|
|
BaseControlWindowImpl_put_AutoShow,
|
|
|
|
BaseControlWindowImpl_get_AutoShow,
|
|
|
|
BaseControlWindowImpl_put_WindowState,
|
|
|
|
BaseControlWindowImpl_get_WindowState,
|
|
|
|
BaseControlWindowImpl_put_BackgroundPalette,
|
|
|
|
BaseControlWindowImpl_get_BackgroundPalette,
|
|
|
|
BaseControlWindowImpl_put_Visible,
|
|
|
|
BaseControlWindowImpl_get_Visible,
|
|
|
|
BaseControlWindowImpl_put_Left,
|
|
|
|
BaseControlWindowImpl_get_Left,
|
|
|
|
BaseControlWindowImpl_put_Width,
|
|
|
|
BaseControlWindowImpl_get_Width,
|
|
|
|
BaseControlWindowImpl_put_Top,
|
|
|
|
BaseControlWindowImpl_get_Top,
|
|
|
|
BaseControlWindowImpl_put_Height,
|
|
|
|
BaseControlWindowImpl_get_Height,
|
|
|
|
BaseControlWindowImpl_put_Owner,
|
|
|
|
BaseControlWindowImpl_get_Owner,
|
|
|
|
BaseControlWindowImpl_put_MessageDrain,
|
|
|
|
BaseControlWindowImpl_get_MessageDrain,
|
|
|
|
BaseControlWindowImpl_get_BorderColor,
|
|
|
|
BaseControlWindowImpl_put_BorderColor,
|
2012-11-27 09:15:08 +01:00
|
|
|
VideoWindow_get_FullScreenMode,
|
|
|
|
VideoWindow_put_FullScreenMode,
|
2012-03-31 03:09:14 +02:00
|
|
|
BaseControlWindowImpl_SetWindowForeground,
|
|
|
|
BaseControlWindowImpl_NotifyOwnerMessage,
|
|
|
|
BaseControlWindowImpl_SetWindowPosition,
|
|
|
|
BaseControlWindowImpl_GetWindowPosition,
|
|
|
|
BaseControlWindowImpl_GetMinIdealImageSize,
|
|
|
|
BaseControlWindowImpl_GetMaxIdealImageSize,
|
|
|
|
BaseControlWindowImpl_GetRestorePosition,
|
|
|
|
BaseControlWindowImpl_HideCursor,
|
|
|
|
BaseControlWindowImpl_IsCursorHidden
|
2004-08-24 04:28:35 +02:00
|
|
|
};
|
2010-11-04 17:02:24 +01:00
|
|
|
|
2020-04-02 06:01:02 +02:00
|
|
|
static inline struct video_renderer *impl_from_IOverlay(IOverlay *iface)
|
2019-10-02 05:43:13 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct video_renderer, IOverlay_iface);
|
2019-10-02 05:43:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_QueryInterface(IOverlay *iface, REFIID iid, void **out)
|
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_IOverlay(iface);
|
2019-10-02 05:43:13 +02:00
|
|
|
return IPin_QueryInterface(&filter->renderer.sink.pin.IPin_iface, iid, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI overlay_AddRef(IOverlay *iface)
|
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_IOverlay(iface);
|
2019-10-02 05:43:13 +02:00
|
|
|
return IPin_AddRef(&filter->renderer.sink.pin.IPin_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI overlay_Release(IOverlay *iface)
|
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_IOverlay(iface);
|
2019-10-02 05:43:13 +02:00
|
|
|
return IPin_Release(&filter->renderer.sink.pin.IPin_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_GetPalette(IOverlay *iface, DWORD *count, PALETTEENTRY **palette)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, count %p, palette %p, stub!\n", iface, count, palette);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_SetPalette(IOverlay *iface, DWORD count, PALETTEENTRY *palette)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, count %u, palette %p, stub!\n", iface, count, palette);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_GetDefaultColorKey(IOverlay *iface, COLORKEY *key)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, key %p, stub!\n", iface, key);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_GetColorKey(IOverlay *iface, COLORKEY *key)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, key %p, stub!\n", iface, key);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_SetColorKey(IOverlay *iface, COLORKEY *key)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, key %p, stub!\n", iface, key);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_GetWindowHandle(IOverlay *iface, HWND *window)
|
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *filter = impl_from_IOverlay(iface);
|
2019-10-02 05:43:14 +02:00
|
|
|
|
|
|
|
TRACE("filter %p, window %p.\n", filter, window);
|
|
|
|
|
2020-05-07 02:28:48 +02:00
|
|
|
*window = filter->window.hwnd;
|
2019-10-02 05:43:14 +02:00
|
|
|
return S_OK;
|
2019-10-02 05:43:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_GetClipList(IOverlay *iface, RECT *source, RECT *dest, RGNDATA **region)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, source %p, dest %p, region %p, stub!\n", iface, source, dest, region);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_GetVideoPosition(IOverlay *iface, RECT *source, RECT *dest)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, source %p, dest %p, stub!\n", iface, source, dest);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_Advise(IOverlay *iface, IOverlayNotify *sink, DWORD flags)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, sink %p, flags %#x, stub!\n", iface, sink, flags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI overlay_Unadvise(IOverlay *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, stub!\n", iface);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOverlayVtbl overlay_vtbl =
|
|
|
|
{
|
|
|
|
overlay_QueryInterface,
|
|
|
|
overlay_AddRef,
|
|
|
|
overlay_Release,
|
|
|
|
overlay_GetPalette,
|
|
|
|
overlay_SetPalette,
|
|
|
|
overlay_GetDefaultColorKey,
|
|
|
|
overlay_GetColorKey,
|
|
|
|
overlay_SetColorKey,
|
|
|
|
overlay_GetWindowHandle,
|
|
|
|
overlay_GetClipList,
|
|
|
|
overlay_GetVideoPosition,
|
|
|
|
overlay_Advise,
|
|
|
|
overlay_Unadvise,
|
|
|
|
};
|
|
|
|
|
2020-03-12 03:10:10 +01:00
|
|
|
HRESULT video_renderer_create(IUnknown *outer, IUnknown **out)
|
2012-07-02 01:07:46 +02:00
|
|
|
{
|
2020-04-02 06:01:02 +02:00
|
|
|
struct video_renderer *object;
|
2012-07-02 01:07:46 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2020-04-02 06:01:01 +02:00
|
|
|
if (!(object = calloc(1, sizeof(*object))))
|
|
|
|
return E_OUTOFMEMORY;
|
2019-10-02 05:43:13 +02:00
|
|
|
|
2020-04-02 06:01:01 +02:00
|
|
|
strmbase_renderer_init(&object->renderer, outer, &CLSID_VideoRenderer, L"In", &renderer_ops);
|
|
|
|
object->IOverlay_iface.lpVtbl = &overlay_vtbl;
|
2012-07-02 01:07:46 +02:00
|
|
|
|
2020-05-07 02:28:48 +02:00
|
|
|
video_window_init(&object->window, &IVideoWindow_VTable,
|
2020-04-03 06:20:47 +02:00
|
|
|
&object->renderer.filter, &object->renderer.sink.pin, &window_ops);
|
2012-07-02 01:07:46 +02:00
|
|
|
|
2020-05-07 02:28:48 +02:00
|
|
|
if (FAILED(hr = video_window_create_window(&object->window)))
|
2020-04-06 02:49:42 +02:00
|
|
|
{
|
2020-05-07 02:28:48 +02:00
|
|
|
video_window_cleanup(&object->window);
|
2020-04-06 02:49:42 +02:00
|
|
|
strmbase_renderer_cleanup(&object->renderer);
|
|
|
|
free(object);
|
|
|
|
return hr;
|
|
|
|
}
|
2012-07-02 01:07:46 +02:00
|
|
|
|
2020-04-02 06:01:01 +02:00
|
|
|
TRACE("Created video renderer %p.\n", object);
|
|
|
|
*out = &object->renderer.filter.IUnknown_inner;
|
2012-07-02 01:07:46 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-03-12 03:10:10 +01:00
|
|
|
HRESULT video_renderer_default_create(IUnknown *outer, IUnknown **out)
|
2012-07-02 01:07:46 +02:00
|
|
|
{
|
2020-06-26 00:57:40 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = vmr7_create(outer, out)))
|
|
|
|
return hr;
|
|
|
|
|
2020-03-12 03:10:10 +01:00
|
|
|
return video_renderer_create(outer, out);
|
2012-07-02 01:07:46 +02:00
|
|
|
}
|