2012-03-28 21:53:24 +02:00
|
|
|
/*
|
|
|
|
* Generic Implementation of strmbase video classes
|
|
|
|
*
|
|
|
|
* Copyright 2012 Aric Stewart, CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2019-05-09 17:12:32 +02:00
|
|
|
#include "strmbase_private.h"
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
|
|
|
|
|
|
|
|
static inline BaseControlVideo *impl_from_IBasicVideo(IBasicVideo *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, BaseControlVideo, IBasicVideo_iface);
|
|
|
|
}
|
|
|
|
|
2012-04-20 14:26:43 +02:00
|
|
|
HRESULT WINAPI BaseControlVideo_Destroy(BaseControlVideo *pControlVideo)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
2019-06-07 01:49:21 +02:00
|
|
|
return S_OK;
|
2012-04-20 14:26:43 +02:00
|
|
|
}
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:05 +01:00
|
|
|
static HRESULT BaseControlVideoImpl_CheckSourceRect(BaseControlVideo *This, RECT *pSourceRect)
|
|
|
|
{
|
|
|
|
LONG VideoWidth, VideoHeight;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (IsRectEmpty(pSourceRect))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
hr = IBasicVideo_GetVideoSize(&This->IBasicVideo_iface, &VideoWidth, &VideoHeight);
|
2016-11-24 17:10:05 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (pSourceRect->top < 0 || pSourceRect->left < 0 ||
|
|
|
|
pSourceRect->bottom > VideoHeight || pSourceRect->right > VideoWidth)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2016-11-24 17:10:07 +01:00
|
|
|
static HRESULT BaseControlVideoImpl_CheckTargetRect(BaseControlVideo *This, RECT *pTargetRect)
|
|
|
|
{
|
|
|
|
if (IsRectEmpty(pTargetRect))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_QueryInterface(IBasicVideo *iface, REFIID iid, void **out)
|
2019-06-12 01:54:35 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *video = impl_from_IBasicVideo(iface);
|
|
|
|
return IUnknown_QueryInterface(video->pFilter->outer_unk, iid, out);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static ULONG WINAPI basic_video_AddRef(IBasicVideo *iface)
|
2019-06-12 01:54:35 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *video = impl_from_IBasicVideo(iface);
|
|
|
|
return IUnknown_AddRef(video->pFilter->outer_unk);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static ULONG WINAPI basic_video_Release(IBasicVideo *iface)
|
2019-06-12 01:54:35 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *video = impl_from_IBasicVideo(iface);
|
|
|
|
return IUnknown_Release(video->pFilter->outer_unk);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetTypeInfoCount(IBasicVideo *iface, UINT *count)
|
2012-04-20 14:26:43 +02:00
|
|
|
{
|
2019-06-07 01:49:21 +02:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetTypeInfo(IBasicVideo *iface, UINT index,
|
2019-06-07 01:49:21 +02:00
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
2019-06-07 01:49:21 +02:00
|
|
|
TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
|
|
|
return strmbase_get_typeinfo(IBasicVideo_tid, typeinfo);
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetIDsOfNames(IBasicVideo *iface, REFIID iid,
|
2019-06-07 01:49:21 +02:00
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
2019-06-07 01:49:21 +02:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n",
|
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2019-06-07 01:49:21 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicVideo_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_Invoke(IBasicVideo *iface, DISPID id, REFIID iid, LCID lcid,
|
2019-06-07 01:49:21 +02:00
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
2019-06-07 01:49:21 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2015-10-19 10:57:50 +02:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2019-06-07 01:49:21 +02:00
|
|
|
TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicVideo_tid, &typeinfo)))
|
2012-04-20 14:26:43 +02:00
|
|
|
{
|
2019-06-07 01:49:21 +02:00
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
2012-04-20 14:26:43 +02:00
|
|
|
}
|
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_AvgTimePerFrame(IBasicVideo *iface, REFTIME *pAvgTimePerFrame)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *vih;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pAvgTimePerFrame)
|
|
|
|
return E_POINTER;
|
2019-09-27 04:40:53 +02:00
|
|
|
if (!This->pPin->peer)
|
2012-03-28 21:53:24 +02:00
|
|
|
return VFW_E_NOT_CONNECTED;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
|
|
|
|
|
|
|
|
vih = This->pFuncsTable->pfnGetVideoFormat(This);
|
|
|
|
*pAvgTimePerFrame = vih->AvgTimePerFrame;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_BitRate(IBasicVideo *iface, LONG *pBitRate)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *vih;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
|
|
|
|
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pBitRate)
|
|
|
|
return E_POINTER;
|
2019-09-27 04:40:53 +02:00
|
|
|
if (!This->pPin->peer)
|
2012-03-28 21:53:24 +02:00
|
|
|
return VFW_E_NOT_CONNECTED;
|
|
|
|
|
|
|
|
vih = This->pFuncsTable->pfnGetVideoFormat(This);
|
|
|
|
*pBitRate = vih->dwBitRate;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_BitErrorRate(IBasicVideo *iface, LONG *pBitErrorRate)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *vih;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
|
|
|
|
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pBitErrorRate)
|
|
|
|
return E_POINTER;
|
2019-09-27 04:40:53 +02:00
|
|
|
if (!This->pPin->peer)
|
2012-03-28 21:53:24 +02:00
|
|
|
return VFW_E_NOT_CONNECTED;
|
|
|
|
|
|
|
|
vih = This->pFuncsTable->pfnGetVideoFormat(This);
|
|
|
|
*pBitErrorRate = vih->dwBitErrorRate;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_VideoWidth(IBasicVideo *iface, LONG *pVideoWidth)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *vih;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pVideoWidth)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
vih = This->pFuncsTable->pfnGetVideoFormat(This);
|
|
|
|
*pVideoWidth = vih->bmiHeader.biWidth;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_VideoHeight(IBasicVideo *iface, LONG *pVideoHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *vih;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pVideoHeight)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
vih = This->pFuncsTable->pfnGetVideoFormat(This);
|
2012-04-24 20:47:08 +02:00
|
|
|
*pVideoHeight = abs(vih->bmiHeader.biHeight);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_SourceLeft(IBasicVideo *iface, LONG SourceLeft)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:05 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
|
2016-11-24 17:10:05 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
SourceRect.right = (SourceRect.right - SourceRect.left) + SourceLeft;
|
|
|
|
SourceRect.left = SourceLeft;
|
|
|
|
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:05 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_SourceLeft(IBasicVideo *iface, LONG *pSourceLeft)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pSourceLeft)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
*pSourceLeft = SourceRect.left;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_SourceWidth(IBasicVideo *iface, LONG SourceWidth)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:05 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
|
2016-11-24 17:10:05 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
SourceRect.right = SourceRect.left + SourceWidth;
|
|
|
|
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:05 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_SourceWidth(IBasicVideo *iface, LONG *pSourceWidth)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pSourceWidth)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
*pSourceWidth = SourceRect.right - SourceRect.left;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_SourceTop(IBasicVideo *iface, LONG SourceTop)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:05 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
|
2016-11-24 17:10:05 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
SourceRect.bottom = (SourceRect.bottom - SourceRect.top) + SourceTop;
|
|
|
|
SourceRect.top = SourceTop;
|
|
|
|
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:05 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_SourceTop(IBasicVideo *iface, LONG *pSourceTop)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pSourceTop)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
*pSourceTop = SourceRect.top;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_SourceHeight(IBasicVideo *iface, LONG SourceHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:05 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
|
2016-11-24 17:10:05 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
SourceRect.bottom = SourceRect.top + SourceHeight;
|
|
|
|
hr = BaseControlVideoImpl_CheckSourceRect(This, &SourceRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:05 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_SourceHeight(IBasicVideo *iface, LONG *pSourceHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pSourceHeight)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
|
|
|
|
*pSourceHeight = SourceRect.bottom - SourceRect.top;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_DestinationLeft(IBasicVideo *iface, LONG DestinationLeft)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:07 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
|
2016-11-24 17:10:07 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
DestRect.right = (DestRect.right - DestRect.left) + DestinationLeft;
|
|
|
|
DestRect.left = DestinationLeft;
|
|
|
|
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:07 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_DestinationLeft(IBasicVideo *iface, LONG *pDestinationLeft)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pDestinationLeft)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
*pDestinationLeft = DestRect.left;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_DestinationWidth(IBasicVideo *iface, LONG DestinationWidth)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:07 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
|
2016-11-24 17:10:07 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
DestRect.right = DestRect.left + DestinationWidth;
|
|
|
|
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:07 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_DestinationWidth(IBasicVideo *iface, LONG *pDestinationWidth)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pDestinationWidth)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
*pDestinationWidth = DestRect.right - DestRect.left;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_DestinationTop(IBasicVideo *iface, LONG DestinationTop)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:07 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
|
2016-11-24 17:10:07 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
DestRect.bottom = (DestRect.bottom - DestRect.top) + DestinationTop;
|
|
|
|
DestRect.top = DestinationTop;
|
|
|
|
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:07 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_DestinationTop(IBasicVideo *iface, LONG *pDestinationTop)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pDestinationTop)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
*pDestinationTop = DestRect.top;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_put_DestinationHeight(IBasicVideo *iface, LONG DestinationHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-24 17:10:07 +01:00
|
|
|
HRESULT hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
|
2016-11-24 17:10:07 +01:00
|
|
|
hr = This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
DestRect.bottom = DestRect.top + DestinationHeight;
|
|
|
|
hr = BaseControlVideoImpl_CheckTargetRect(This, &DestRect);
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2016-11-24 17:10:07 +01:00
|
|
|
return hr;
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_get_DestinationHeight(IBasicVideo *iface, LONG *pDestinationHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pDestinationHeight)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
2016-11-24 17:10:03 +01:00
|
|
|
*pDestinationHeight = DestRect.bottom - DestRect.top;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_SetSourcePosition(IBasicVideo *iface, LONG Left, LONG Top, LONG Width, LONG Height)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
|
2016-06-29 09:55:24 +02:00
|
|
|
|
|
|
|
SetRect(&SourceRect, Left, Top, Left + Width, Top + Height);
|
2016-11-24 17:10:05 +01:00
|
|
|
if (FAILED(BaseControlVideoImpl_CheckSourceRect(This, &SourceRect)))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
return This->pFuncsTable->pfnSetSourceRect(This, &SourceRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetSourcePosition(IBasicVideo *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT SourceRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pLeft || !pTop || !pWidth || !pHeight)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetSourceRect(This, &SourceRect);
|
|
|
|
|
|
|
|
*pLeft = SourceRect.left;
|
|
|
|
*pTop = SourceRect.top;
|
|
|
|
*pWidth = SourceRect.right - SourceRect.left;
|
|
|
|
*pHeight = SourceRect.bottom - SourceRect.top;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_SetDefaultSourcePosition(IBasicVideo *iface)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
return This->pFuncsTable->pfnSetDefaultSourceRect(This);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_SetDestinationPosition(IBasicVideo *iface, LONG Left, LONG Top, LONG Width, LONG Height)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
|
|
|
|
|
2016-06-29 09:55:24 +02:00
|
|
|
SetRect(&DestRect, Left, Top, Left + Width, Top + Height);
|
2016-11-24 17:10:07 +01:00
|
|
|
if (FAILED(BaseControlVideoImpl_CheckTargetRect(This, &DestRect)))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
return This->pFuncsTable->pfnSetTargetRect(This, &DestRect);
|
2012-03-28 21:53:24 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetDestinationPosition(IBasicVideo *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
RECT DestRect;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pLeft || !pTop || !pWidth || !pHeight)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
This->pFuncsTable->pfnGetTargetRect(This, &DestRect);
|
|
|
|
|
|
|
|
*pLeft = DestRect.left;
|
|
|
|
*pTop = DestRect.top;
|
|
|
|
*pWidth = DestRect.right - DestRect.left;
|
|
|
|
*pHeight = DestRect.bottom - DestRect.top;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_SetDefaultDestinationPosition(IBasicVideo *iface)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
return This->pFuncsTable->pfnSetDefaultTargetRect(This);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetVideoSize(IBasicVideo *iface, LONG *pWidth, LONG *pHeight)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *vih;
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pWidth || !pHeight)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
vih = This->pFuncsTable->pfnGetVideoFormat(This);
|
|
|
|
*pHeight = vih->bmiHeader.biHeight;
|
|
|
|
*pWidth = vih->bmiHeader.biWidth;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetVideoPaletteEntries(IBasicVideo *iface, LONG StartIndex, LONG Entries, LONG *pRetrieved, LONG *pPalette)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pRetrieved || !pPalette)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
2017-02-15 10:52:26 +01:00
|
|
|
*pRetrieved = 0;
|
2012-03-28 21:53:24 +02:00
|
|
|
return VFW_E_NO_PALETTE_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_GetCurrentImage(IBasicVideo *iface, LONG *pBufferSize, LONG *pDIBImage)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
2016-11-20 07:33:21 +01:00
|
|
|
if (!pBufferSize || !pDIBImage)
|
|
|
|
return E_POINTER;
|
2012-03-28 21:53:24 +02:00
|
|
|
|
|
|
|
return This->pFuncsTable->pfnGetStaticImage(This, pBufferSize, pDIBImage);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_IsUsingDefaultSource(IBasicVideo *iface)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
return This->pFuncsTable->pfnIsDefaultSourceRect(This);
|
|
|
|
}
|
|
|
|
|
2019-06-12 01:54:37 +02:00
|
|
|
static HRESULT WINAPI basic_video_IsUsingDefaultDestination(IBasicVideo *iface)
|
2012-03-28 21:53:24 +02:00
|
|
|
{
|
|
|
|
BaseControlVideo *This = impl_from_IBasicVideo(iface);
|
|
|
|
|
|
|
|
return This->pFuncsTable->pfnIsDefaultTargetRect(This);
|
|
|
|
}
|
2019-06-12 01:54:37 +02:00
|
|
|
|
|
|
|
static const IBasicVideoVtbl basic_video_vtbl =
|
|
|
|
{
|
|
|
|
basic_video_QueryInterface,
|
|
|
|
basic_video_AddRef,
|
|
|
|
basic_video_Release,
|
|
|
|
basic_video_GetTypeInfoCount,
|
|
|
|
basic_video_GetTypeInfo,
|
|
|
|
basic_video_GetIDsOfNames,
|
|
|
|
basic_video_Invoke,
|
|
|
|
basic_video_get_AvgTimePerFrame,
|
|
|
|
basic_video_get_BitRate,
|
|
|
|
basic_video_get_BitErrorRate,
|
|
|
|
basic_video_get_VideoWidth,
|
|
|
|
basic_video_get_VideoHeight,
|
|
|
|
basic_video_put_SourceLeft,
|
|
|
|
basic_video_get_SourceLeft,
|
|
|
|
basic_video_put_SourceWidth,
|
|
|
|
basic_video_get_SourceWidth,
|
|
|
|
basic_video_put_SourceTop,
|
|
|
|
basic_video_get_SourceTop,
|
|
|
|
basic_video_put_SourceHeight,
|
|
|
|
basic_video_get_SourceHeight,
|
|
|
|
basic_video_put_DestinationLeft,
|
|
|
|
basic_video_get_DestinationLeft,
|
|
|
|
basic_video_put_DestinationWidth,
|
|
|
|
basic_video_get_DestinationWidth,
|
|
|
|
basic_video_put_DestinationTop,
|
|
|
|
basic_video_get_DestinationTop,
|
|
|
|
basic_video_put_DestinationHeight,
|
|
|
|
basic_video_get_DestinationHeight,
|
|
|
|
basic_video_SetSourcePosition,
|
|
|
|
basic_video_GetSourcePosition,
|
|
|
|
basic_video_SetDefaultSourcePosition,
|
|
|
|
basic_video_SetDestinationPosition,
|
|
|
|
basic_video_GetDestinationPosition,
|
|
|
|
basic_video_SetDefaultDestinationPosition,
|
|
|
|
basic_video_GetVideoSize,
|
|
|
|
basic_video_GetVideoPaletteEntries,
|
|
|
|
basic_video_GetCurrentImage,
|
|
|
|
basic_video_IsUsingDefaultSource,
|
|
|
|
basic_video_IsUsingDefaultDestination
|
|
|
|
};
|
|
|
|
|
2019-08-29 03:24:30 +02:00
|
|
|
HRESULT WINAPI strmbase_video_init(BaseControlVideo *video, struct strmbase_filter *filter,
|
2019-09-24 02:33:24 +02:00
|
|
|
CRITICAL_SECTION *cs, struct strmbase_pin *pin, const BaseControlVideoFuncTable *func_table)
|
2019-06-12 01:54:37 +02:00
|
|
|
{
|
|
|
|
video->IBasicVideo_iface.lpVtbl = &basic_video_vtbl;
|
|
|
|
video->pFilter = filter;
|
|
|
|
video->pInterfaceLock = cs;
|
|
|
|
video->pPin = pin;
|
|
|
|
video->pFuncsTable = func_table;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|