Author: akhaldi
Date: Fri Oct 11 13:12:40 2013
New Revision: 60605
URL:
http://svn.reactos.org/svn/reactos?rev=60605&view=rev
Log:
[QEDIT]
* Sync with Wine 1.7.1.
CORE-7469
Added:
trunk/reactos/dll/directx/wine/qedit/qedit.rc (with props)
trunk/reactos/dll/directx/wine/qedit/qedit_classes.idl (with props)
trunk/reactos/dll/directx/wine/qedit/qedit_classes.rgs (with props)
Removed:
trunk/reactos/dll/directx/wine/qedit/regsvr.c
Modified:
trunk/reactos/dll/directx/wine/qedit/CMakeLists.txt
trunk/reactos/dll/directx/wine/qedit/main.c
trunk/reactos/dll/directx/wine/qedit/mediadet.c
trunk/reactos/dll/directx/wine/qedit/qedit_private.h
trunk/reactos/dll/directx/wine/qedit/samplegrabber.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/directx/wine/qedit/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/CMa…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/qedit/CMakeLists.txt [iso-8859-1] Fri Oct 11 13:12:40
2013
@@ -1,35 +1,17 @@
add_definitions(-D__WINESRC__)
-
-remove_definitions(-D_WIN32_WINNT=0x502)
-add_definitions(-D_WIN32_WINNT=0x600)
-
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
-
spec2def(qedit.dll qedit.spec)
-add_library(qedit SHARED
+list(APPEND SOURCE
main.c
mediadet.c
- regsvr.c
samplegrabber.c
${CMAKE_CURRENT_BINARY_DIR}/qedit.def)
-set_module_type(qedit win32dll UNICODE)
-
-target_link_libraries(qedit
- strmiids
- uuid
- wine)
-
-add_importlibs(qedit
- msvcrt
- advapi32
- ole32
- oleaut32
- kernel32
- ntdll)
-
+add_library(qedit SHARED ${SOURCE} qedit.rc)
+set_module_type(qedit win32dll)
+target_link_libraries(qedit strmiids uuid wine)
+add_importlibs(qedit ole32 oleaut32 msvcrt kernel32 ntdll)
add_pch(qedit qedit_private.h)
-add_dependencies(qedit dxsdk)
add_cd_file(TARGET qedit DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/directx/wine/qedit/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/mai…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/qedit/main.c [iso-8859-1] Fri Oct 11 13:12:40 2013
@@ -18,18 +18,20 @@
*/
#include "qedit_private.h"
+#include <rpcproxy.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(qedit);
+
+static HINSTANCE instance;
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
+ instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
- case DLL_PROCESS_DETACH:
- break;
}
return TRUE;
}
@@ -38,12 +40,16 @@
* DirectShow ClassFactory
*/
typedef struct {
- IClassFactory ITF_IClassFactory;
-
+ IClassFactory IClassFactory_iface;
LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
} IClassFactoryImpl;
+static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
+}
+
struct object_creation_info
{
const CLSID *clsid;
@@ -56,34 +62,30 @@
{ &CLSID_SampleGrabber, SampleGrabber_create },
};
-static HRESULT WINAPI
-DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-
+static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void
**ppobj)
+{
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IClassFactory))
{
IClassFactory_AddRef(iface);
- *ppobj = This;
+ *ppobj = iface;
return S_OK;
}
*ppobj = NULL;
- WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+ WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
-static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+static ULONG WINAPI DSCF_AddRef(IClassFactory *iface)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
-static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-
+static ULONG WINAPI DSCF_Release(IClassFactory *iface)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
@@ -92,15 +94,19 @@
return ref;
}
-static HRESULT WINAPI DSCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID
riid, LPVOID *ppobj)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID
riid,
+ void **ppobj)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
HRESULT hres;
LPUNKNOWN punk;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
*ppobj = NULL;
+ if (pOuter && !IsEqualGUID(&IID_IUnknown, riid))
+ return E_INVALIDARG;
+
hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk);
if (SUCCEEDED(hres)) {
hres = IUnknown_QueryInterface(punk, riid, ppobj);
@@ -109,9 +115,9 @@
return hres;
}
-static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
@@ -131,7 +137,7 @@
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
- return S_OK;
+ return S_FALSE;
}
/*******************************************************************************
@@ -175,11 +181,27 @@
factory = CoTaskMemAlloc(sizeof(*factory));
if (factory == NULL) return E_OUTOFMEMORY;
- factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl;
+ factory->IClassFactory_iface.lpVtbl = &DSCF_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
- *ppv = &(factory->ITF_IClassFactory);
+ *ppv = &factory->IClassFactory_iface;
return S_OK;
}
+
+/***********************************************************************
+ * DllRegisterServer (QEDIT.@)
+ */
+HRESULT WINAPI DllRegisterServer(void)
+{
+ return __wine_register_resources( instance );
+}
+
+/***********************************************************************
+ * DllUnregisterServer (QEDIT.@)
+ */
+HRESULT WINAPI DllUnregisterServer(void)
+{
+ return __wine_unregister_resources( instance );
+}
Modified: trunk/reactos/dll/directx/wine/qedit/mediadet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/med…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/mediadet.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/qedit/mediadet.c [iso-8859-1] Fri Oct 11 13:12:40 2013
@@ -33,8 +33,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(qedit);
typedef struct MediaDetImpl {
- const IMediaDetVtbl *MediaDet_Vtbl;
- LONG refCount;
+ IUnknown IUnknown_inner;
+ IMediaDet IMediaDet_iface;
+ IUnknown *outer_unk;
+ LONG ref;
IGraphBuilder *graph;
IBaseFilter *source;
IBaseFilter *splitter;
@@ -42,6 +44,16 @@
LONG cur_stream;
IPin *cur_pin;
} MediaDetImpl;
+
+static inline MediaDetImpl *impl_from_IUnknown(IUnknown *iface)
+{
+ return CONTAINING_RECORD(iface, MediaDetImpl, IUnknown_inner);
+}
+
+static inline MediaDetImpl *impl_from_IMediaDet(IMediaDet *iface)
+{
+ return CONTAINING_RECORD(iface, MediaDetImpl, IMediaDet_iface);
+}
static void MD_cleanup(MediaDetImpl *This)
{
@@ -57,64 +69,98 @@
This->cur_stream = 0;
}
-static ULONG WINAPI MediaDet_AddRef(IMediaDet* iface)
-{
- MediaDetImpl *This = (MediaDetImpl *)iface;
- ULONG refCount = InterlockedIncrement(&This->refCount);
- TRACE("(%p)->() AddRef from %d\n", This, refCount - 1);
- return refCount;
-}
-
-static ULONG WINAPI MediaDet_Release(IMediaDet* iface)
-{
- MediaDetImpl *This = (MediaDetImpl *)iface;
- ULONG refCount = InterlockedDecrement(&This->refCount);
- TRACE("(%p)->() Release from %d\n", This, refCount + 1);
-
- if (refCount == 0)
+/* MediaDet inner IUnknown */
+static HRESULT WINAPI MediaDet_inner_QueryInterface(IUnknown *iface, REFIID riid, void
**ppv)
+{
+ MediaDetImpl *This = impl_from_IUnknown(iface);
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+
+ *ppv = NULL;
+ if (IsEqualIID(riid, &IID_IUnknown))
+ *ppv = &This->IUnknown_inner;
+ else if (IsEqualIID(riid, &IID_IMediaDet))
+ *ppv = &This->IMediaDet_iface;
+ else
+ WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv);
+
+ if (!*ppv)
+ return E_NOINTERFACE;
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI MediaDet_inner_AddRef(IUnknown *iface)
+{
+ MediaDetImpl *This = impl_from_IUnknown(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) new ref = %u\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI MediaDet_inner_Release(IUnknown *iface)
+{
+ MediaDetImpl *This = impl_from_IUnknown(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) new ref = %u\n", This, ref);
+
+ if (ref == 0)
{
MD_cleanup(This);
CoTaskMemFree(This);
return 0;
}
- return refCount;
-}
-
-static HRESULT WINAPI MediaDet_QueryInterface(IMediaDet* iface, REFIID riid,
- void **ppvObject)
-{
- MediaDetImpl *This = (MediaDetImpl *)iface;
- TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
-
- if (IsEqualIID(riid, &IID_IUnknown) ||
- IsEqualIID(riid, &IID_IMediaDet)) {
- MediaDet_AddRef(iface);
- *ppvObject = This;
- return S_OK;
- }
- *ppvObject = NULL;
- WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
- return E_NOINTERFACE;
+ return ref;
+}
+
+static const IUnknownVtbl mediadet_vtbl =
+{
+ MediaDet_inner_QueryInterface,
+ MediaDet_inner_AddRef,
+ MediaDet_inner_Release,
+};
+
+/* IMediaDet implementation */
+static HRESULT WINAPI MediaDet_QueryInterface(IMediaDet *iface, REFIID riid, void **ppv)
+{
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
+ return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
+}
+
+static ULONG WINAPI MediaDet_AddRef(IMediaDet *iface)
+{
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
+ return IUnknown_AddRef(This->outer_unk);
+}
+
+static ULONG WINAPI MediaDet_Release(IMediaDet *iface)
+{
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
+ return IUnknown_Release(This->outer_unk);
}
static HRESULT WINAPI MediaDet_get_Filter(IMediaDet* iface, IUnknown **pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%p): not implemented!\n", This, pVal);
return E_NOTIMPL;
}
static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%p): not implemented!\n", This, newVal);
return E_NOTIMPL;
}
static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, LONG *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
IEnumPins *pins;
IPin *pin;
HRESULT hr;
@@ -158,7 +204,7 @@
static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, LONG *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
TRACE("(%p)\n", This);
if (!pVal)
@@ -211,7 +257,7 @@
static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, LONG newVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
HRESULT hr;
TRACE("(%p)->(%d)\n", This, newVal);
@@ -237,28 +283,28 @@
static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet* iface, GUID *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
- FIXME("(%p)->(%p): not implemented!\n", This, debugstr_guid(pVal));
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
+ FIXME("(%p)->(%s): not implemented!\n", This, debugstr_guid(pVal));
return E_NOTIMPL;
}
static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet* iface, BSTR *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%p): not implemented!\n", This, pVal);
return E_NOTIMPL;
}
static HRESULT WINAPI MediaDet_get_StreamLength(IMediaDet* iface, double *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p): stub!\n", This);
return VFW_E_INVALIDMEDIATYPE;
}
static HRESULT WINAPI MediaDet_get_Filename(IMediaDet* iface, BSTR *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
IFileSourceFilter *file;
LPOLESTR name;
HRESULT hr;
@@ -378,52 +424,56 @@
if (FAILED(hr))
return hr;
- hr = IEnumMoniker_Next(filters, 1, &mon, NULL);
+ hr = E_NOINTERFACE;
+ while (IEnumMoniker_Next(filters, 1, &mon, NULL) == S_OK)
+ {
+ hr = GetFilterInfo(mon, &clsid, &var);
+ IMoniker_Release(mon);
+ if (FAILED(hr))
+ continue;
+
+ hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IBaseFilter, (void **) &splitter);
+ if (FAILED(hr))
+ {
+ VariantClear(&var);
+ continue;
+ }
+
+ hr = IGraphBuilder_AddFilter(This->graph, splitter,
+ V_UNION(&var, bstrVal));
+ VariantClear(&var);
+ This->splitter = splitter;
+ if (FAILED(hr))
+ goto retry;
+
+ hr = IBaseFilter_EnumPins(This->source, &pins);
+ if (FAILED(hr))
+ goto retry;
+ IEnumPins_Next(pins, 1, &source_pin, NULL);
+ IEnumPins_Release(pins);
+
+ hr = IBaseFilter_EnumPins(splitter, &pins);
+ if (FAILED(hr))
+ {
+ IPin_Release(source_pin);
+ goto retry;
+ }
+ IEnumPins_Next(pins, 1, &splitter_pin, NULL);
+ IEnumPins_Release(pins);
+
+ hr = IPin_Connect(source_pin, splitter_pin, NULL);
+ IPin_Release(source_pin);
+ IPin_Release(splitter_pin);
+ if (SUCCEEDED(hr))
+ break;
+
+retry:
+ IBaseFilter_Release(splitter);
+ This->splitter = NULL;
+ }
+
IEnumMoniker_Release(filters);
- if (hr != S_OK) /* No matches, what do we do? */
- return E_NOINTERFACE;
-
- hr = GetFilterInfo(mon, &clsid, &var);
- IMoniker_Release(mon);
- if (FAILED(hr))
- return hr;
-
- hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
- &IID_IBaseFilter, (void **) &splitter);
- if (FAILED(hr))
- {
- VariantClear(&var);
- return hr;
- }
-
- hr = IGraphBuilder_AddFilter(This->graph, splitter,
- V_UNION(&var, bstrVal));
- VariantClear(&var);
- if (FAILED(hr))
- {
- IBaseFilter_Release(splitter);
- return hr;
- }
- This->splitter = splitter;
-
- hr = IBaseFilter_EnumPins(This->source, &pins);
- if (FAILED(hr))
- return hr;
- IEnumPins_Next(pins, 1, &source_pin, NULL);
- IEnumPins_Release(pins);
-
- hr = IBaseFilter_EnumPins(splitter, &pins);
- if (FAILED(hr))
- {
- IPin_Release(source_pin);
- return hr;
- }
- IEnumPins_Next(pins, 1, &splitter_pin, NULL);
- IEnumPins_Release(pins);
-
- hr = IPin_Connect(source_pin, splitter_pin, NULL);
- IPin_Release(source_pin);
- IPin_Release(splitter_pin);
if (FAILED(hr))
return hr;
@@ -433,7 +483,7 @@
static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal)
{
static const WCHAR reader[] =
{'R','e','a','d','e','r',0};
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
IGraphBuilder *gb;
IBaseFilter *bf;
HRESULT hr;
@@ -472,7 +522,7 @@
LONG *pBufferSize, char *pBuffer,
LONG Width, LONG Height)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%f %p %p %d %d): not implemented!\n", This, StreamTime,
pBufferSize, pBuffer,
Width, Height);
return E_NOTIMPL;
@@ -482,7 +532,7 @@
double StreamTime, LONG Width,
LONG Height, BSTR Filename)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%f %d %d %p): not implemented!\n", This, StreamTime,
Width, Height, Filename);
return E_NOTIMPL;
}
@@ -490,7 +540,7 @@
static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet* iface,
AM_MEDIA_TYPE *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
IEnumMediaTypes *types;
AM_MEDIA_TYPE *pmt;
HRESULT hr;
@@ -524,14 +574,14 @@
static HRESULT WINAPI MediaDet_GetSampleGrabber(IMediaDet* iface,
ISampleGrabber **ppVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%p): not implemented!\n", This, ppVal);
return E_NOTIMPL;
}
static HRESULT WINAPI MediaDet_get_FrameRate(IMediaDet* iface, double *pVal)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
AM_MEDIA_TYPE mt;
VIDEOINFOHEADER *vh;
HRESULT hr;
@@ -561,7 +611,7 @@
static HRESULT WINAPI MediaDet_EnterBitmapGrabMode(IMediaDet* iface,
double SeekTime)
{
- MediaDetImpl *This = (MediaDetImpl *)iface;
+ MediaDetImpl *This = impl_from_IMediaDet(iface);
FIXME("(%p)->(%f): not implemented!\n", This, SeekTime);
return E_NOTIMPL;
}
@@ -594,9 +644,6 @@
TRACE("(%p,%p)\n", ppv, pUnkOuter);
- if (pUnkOuter)
- return CLASS_E_NOAGGREGATION;
-
obj = CoTaskMemAlloc(sizeof(MediaDetImpl));
if (NULL == obj) {
*ppv = NULL;
@@ -604,8 +651,9 @@
}
ZeroMemory(obj, sizeof(MediaDetImpl));
- obj->refCount = 1;
- obj->MediaDet_Vtbl = &IMediaDet_VTable;
+ obj->ref = 1;
+ obj->IUnknown_inner.lpVtbl = &mediadet_vtbl;
+ obj->IMediaDet_iface.lpVtbl = &IMediaDet_VTable;
obj->graph = NULL;
obj->source = NULL;
obj->splitter = NULL;
@@ -614,5 +662,11 @@
obj->cur_stream = 0;
*ppv = obj;
- return S_OK;
-}
+ if (pUnkOuter)
+ obj->outer_unk = pUnkOuter;
+ else
+ obj->outer_unk = &obj->IUnknown_inner;
+
+ *ppv = &obj->IUnknown_inner;
+ return S_OK;
+}
Added: trunk/reactos/dll/directx/wine/qedit/qedit.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/qed…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/qedit.rc (added)
+++ trunk/reactos/dll/directx/wine/qedit/qedit.rc [iso-8859-1] Fri Oct 11 13:12:40 2013
@@ -0,0 +1 @@
+1 WINE_REGISTRY qedit_classes.rgs
Propchange: trunk/reactos/dll/directx/wine/qedit/qedit.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/directx/wine/qedit/qedit_classes.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/qed…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/qedit_classes.idl (added)
+++ trunk/reactos/dll/directx/wine/qedit/qedit_classes.idl [iso-8859-1] Fri Oct 11
13:12:40 2013
@@ -0,0 +1,32 @@
+/*
+ * COM Classes for qedit
+ *
+ * Copyright 2010 Alexandre Julliard
+ *
+ * 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
+ */
+
+[
+ threading(both),
+ uuid(65bd0711-24d2-4ff7-9324-ed2e5d3abafa)
+]
+coclass MediaDet { interface IMediaDet; }
+
+[
+ helpstring("Sample Grabber"),
+ threading(both),
+ uuid(c1f400a0-3f08-11d3-9f0b-006008039e37)
+]
+coclass SampleGrabber { interface ISampleGrabber; }
Propchange: trunk/reactos/dll/directx/wine/qedit/qedit_classes.idl
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/directx/wine/qedit/qedit_classes.rgs
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/qed…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/qedit_classes.rgs (added)
+++ trunk/reactos/dll/directx/wine/qedit/qedit_classes.rgs [iso-8859-1] Fri Oct 11
13:12:40 2013
@@ -0,0 +1,17 @@
+HKCR
+{
+ NoRemove Interface
+ {
+ }
+ NoRemove CLSID
+ {
+ '{65BD0711-24D2-4FF7-9324-ED2E5D3ABAFA}' = s 'MediaDet'
+ {
+ InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
+ }
+ '{C1F400A0-3F08-11D3-9F0B-006008039E37}' = s 'Sample Grabber'
+ {
+ InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
+ }
+ }
+}
Propchange: trunk/reactos/dll/directx/wine/qedit/qedit_classes.rgs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/directx/wine/qedit/qedit_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/qed…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/qedit_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/qedit/qedit_private.h [iso-8859-1] Fri Oct 11 13:12:40
2013
@@ -1,9 +1,6 @@
/* DirectShow Editing Services (qedit.dll)
*
* Copyright 2008 Google (Lei Zhang)
- *
- * This file contains the (internal) driver registration functions,
- * driver enumeration APIs and DirectDraw creation functions.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -43,7 +40,7 @@
#define __WINE_DDRAW_H /* ROS HACK */
#include <qedit.h>
-HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppObj);
-HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppObj);
+HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
+HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
#endif /* __QEDIT_PRIVATE_INCLUDED__ */
Removed: trunk/reactos/dll/directx/wine/qedit/regsvr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/reg…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/regsvr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/qedit/regsvr.c (removed)
@@ -1,330 +0,0 @@
-/*
- * self-registerable dll functions for qedit.dll
- *
- * Copyright (C) 2008 Google (Lei Zhang)
- *
- * 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
- */
-
-#include "qedit_private.h"
-//#include "winreg.h"
-
-#include <wine/debug.h>
-
-WINE_DEFAULT_DEBUG_CHANNEL(qedit);
-
-struct regsvr_coclass
-{
- CLSID const *clsid; /* NULL for end of list */
- LPCSTR name; /* can be NULL to omit */
- LPCSTR ips; /* can be NULL to omit */
- LPCSTR ips32; /* can be NULL to omit */
- LPCSTR ips32_tmodel; /* can be NULL to omit */
- LPCSTR progid; /* can be NULL to omit */
- LPCSTR viprogid; /* can be NULL to omit */
- LPCSTR progid_extra; /* can be NULL to omit */
-};
-
-static HRESULT register_coclasses(struct regsvr_coclass const *list);
-static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
-
-/***********************************************************************
- * static string constants
- */
-static WCHAR const clsid_keyname[6] = {
- 'C', 'L', 'S', 'I', 'D', 0 };
-static WCHAR const curver_keyname[7] = {
- 'C', 'u', 'r', 'V', 'e', 'r', 0 };
-static WCHAR const ips_keyname[13] = {
- 'I', 'n', 'P', 'r', 'o', 'c',
'S', 'e', 'r', 'v', 'e', 'r', 0 };
-static WCHAR const ips32_keyname[15] = {
- 'I', 'n', 'P', 'r', 'o', 'c',
'S', 'e', 'r', 'v', 'e', 'r', '3',
'2', 0 };
-static WCHAR const progid_keyname[7] = {
- 'P', 'r', 'o', 'g', 'I', 'D', 0 };
-static WCHAR const viprogid_keyname[25] = {
- 'V', 'e', 'r', 's', 'i', 'o',
'n', 'I', 'n', 'd', 'e', 'p',
- 'e', 'n', 'd', 'e', 'n', 't',
'P', 'r', 'o', 'g', 'I', 'D',
- 0 };
-static char const tmodel_valuename[] = "ThreadingModel";
-
-/***********************************************************************
- * static helper functions
- */
-static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
- WCHAR const *value);
-static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
- char const *value);
-static LONG register_progid(WCHAR const *clsid,
- char const *progid, char const *curver_progid,
- char const *name, char const *extra);
-
-
-
-/***********************************************************************
- * register_coclasses
- */
-static HRESULT register_coclasses(struct regsvr_coclass const *list)
-{
- LONG res = ERROR_SUCCESS;
- HKEY coclass_key;
-
- res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
- if (res != ERROR_SUCCESS) goto error_return;
-
- for (; res == ERROR_SUCCESS && list->clsid; ++list) {
- WCHAR buf[39];
- HKEY clsid_key;
-
- StringFromGUID2(list->clsid, buf, 39);
- res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
- if (res != ERROR_SUCCESS) goto error_close_coclass_key;
-
- if (list->name) {
- res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
- (CONST BYTE*)(list->name),
- strlen(list->name) + 1);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
- }
-
- if (list->ips) {
- res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
- }
-
- if (list->ips32) {
- HKEY ips32_key;
-
- res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL,
- &ips32_key, NULL);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
-
- res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
- (CONST BYTE*)list->ips32,
- lstrlenA(list->ips32) + 1);
- if (res == ERROR_SUCCESS && list->ips32_tmodel)
- res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
- (CONST BYTE*)list->ips32_tmodel,
- strlen(list->ips32_tmodel) + 1);
- RegCloseKey(ips32_key);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
- }
-
- if (list->progid) {
- res = register_key_defvalueA(clsid_key, progid_keyname,
- list->progid);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
-
- res = register_progid(buf, list->progid, NULL,
- list->name, list->progid_extra);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
- }
-
- if (list->viprogid) {
- res = register_key_defvalueA(clsid_key, viprogid_keyname,
- list->viprogid);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
-
- res = register_progid(buf, list->viprogid, list->progid,
- list->name, list->progid_extra);
- if (res != ERROR_SUCCESS) goto error_close_clsid_key;
- }
-
-error_close_clsid_key:
- RegCloseKey(clsid_key);
- }
-
-error_close_coclass_key:
- RegCloseKey(coclass_key);
-error_return:
- return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
-}
-
-/***********************************************************************
- * unregister_coclasses
- */
-static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
-{
- LONG res = ERROR_SUCCESS;
- HKEY coclass_key;
-
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
- KEY_READ | KEY_WRITE, &coclass_key);
- if (res == ERROR_FILE_NOT_FOUND) return S_OK;
- if (res != ERROR_SUCCESS) goto error_return;
-
- for (; res == ERROR_SUCCESS && list->clsid; ++list) {
- WCHAR buf[39];
-
- StringFromGUID2(list->clsid, buf, 39);
- res = RegDeleteTreeW(coclass_key, buf);
- if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
- if (res != ERROR_SUCCESS) goto error_close_coclass_key;
-
- if (list->progid) {
- res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
- if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
- if (res != ERROR_SUCCESS) goto error_close_coclass_key;
- }
-
- if (list->viprogid) {
- res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid);
- if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
- if (res != ERROR_SUCCESS) goto error_close_coclass_key;
- }
- }
-
-error_close_coclass_key:
- RegCloseKey(coclass_key);
-error_return:
- return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
-}
-
-/***********************************************************************
- * regsvr_key_defvalueW
- */
-static LONG register_key_defvalueW(
- HKEY base,
- WCHAR const *name,
- WCHAR const *value)
-{
- LONG res;
- HKEY key;
-
- res = RegCreateKeyExW(base, name, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &key, NULL);
- if (res != ERROR_SUCCESS) return res;
- res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
- (lstrlenW(value) + 1) * sizeof(WCHAR));
- RegCloseKey(key);
- return res;
-}
-
-/***********************************************************************
- * regsvr_key_defvalueA
- */
-static LONG register_key_defvalueA(
- HKEY base,
- WCHAR const *name,
- char const *value)
-{
- LONG res;
- HKEY key;
-
- res = RegCreateKeyExW(base, name, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &key, NULL);
- if (res != ERROR_SUCCESS) return res;
- res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
- lstrlenA(value) + 1);
- RegCloseKey(key);
- return res;
-}
-
-/***********************************************************************
- * regsvr_progid
- */
-static LONG register_progid(
- WCHAR const *clsid,
- char const *progid,
- char const *curver_progid,
- char const *name,
- char const *extra)
-{
- LONG res;
- HKEY progid_key;
-
- res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
- NULL, 0, KEY_READ | KEY_WRITE, NULL,
- &progid_key, NULL);
- if (res != ERROR_SUCCESS) return res;
-
- if (name) {
- res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
- (CONST BYTE*)name, strlen(name) + 1);
- if (res != ERROR_SUCCESS) goto error_close_progid_key;
- }
-
- if (clsid) {
- res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
- if (res != ERROR_SUCCESS) goto error_close_progid_key;
- }
-
- if (curver_progid) {
- res = register_key_defvalueA(progid_key, curver_keyname,
- curver_progid);
- if (res != ERROR_SUCCESS) goto error_close_progid_key;
- }
-
- if (extra) {
- HKEY extra_key;
-
- res = RegCreateKeyExA(progid_key, extra, 0,
- NULL, 0, KEY_READ | KEY_WRITE, NULL,
- &extra_key, NULL);
- if (res == ERROR_SUCCESS)
- RegCloseKey(extra_key);
- }
-
-error_close_progid_key:
- RegCloseKey(progid_key);
- return res;
-}
-
-/***********************************************************************
- * coclass list
- */
-static struct regsvr_coclass const coclass_list[] = {
- { &CLSID_MediaDet,
- "MediaDet",
- NULL,
- "qedit.dll",
- "Both"
- },
- { &CLSID_SampleGrabber,
- "Sample Grabber",
- NULL,
- "qedit.dll",
- "Both"
- },
- { NULL } /* list terminator */
-};
-
-/***********************************************************************
- * DllRegisterServer (QEDIT.@)
- */
-HRESULT WINAPI DllRegisterServer(void)
-{
- HRESULT hr;
-
- TRACE("\n");
-
- hr = register_coclasses(coclass_list);
- return hr;
-}
-
-/***********************************************************************
- * DllUnregisterServer (QEDIT.@)
- */
-HRESULT WINAPI DllUnregisterServer(void)
-{
- HRESULT hr;
-
- TRACE("\n");
-
- hr = unregister_coclasses(coclass_list);
- return hr;
-}
Modified: trunk/reactos/dll/directx/wine/qedit/samplegrabber.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/qedit/sam…
==============================================================================
--- trunk/reactos/dll/directx/wine/qedit/samplegrabber.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/qedit/samplegrabber.c [iso-8859-1] Fri Oct 11 13:12:40
2013
@@ -32,12 +32,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(qedit);
-static WCHAR const vendor_name[] = { 'W', 'i', 'n', 'e',
0 };
-static WCHAR const pin_in_name[] = { 'I', 'n', 0 };
-static WCHAR const pin_out_name[] = { 'O', 'u', 't', 0 };
-
-IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
-IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype);
+static const WCHAR vendor_name[] = { 'W', 'i', 'n', 'e',
0 };
+static const WCHAR pin_in_name[] = { 'I', 'n', 0 };
+static const WCHAR pin_out_name[] = { 'O', 'u', 't', 0 };
+
+static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
+static IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype);
/* Fixed pins enumerator, holds filter referenced */
typedef struct _PE_Impl {
@@ -88,7 +88,7 @@
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IEnumPins)) {
Fixed_IEnumPins_AddRef(iface);
- *ppvObject = &(This->pins);
+ *ppvObject = This->pins;
return S_OK;
}
*ppvObject = NULL;
@@ -171,7 +171,7 @@
Fixed_IEnumPins_Clone,
};
-IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
+static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
{
ULONG len = sizeof(PE_Impl) + (pinCount * sizeof(IPin *));
PE_Impl *obj = CoTaskMemAlloc(len);
@@ -324,7 +324,7 @@
Single_IEnumMediaTypes_Clone,
};
-IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype)
+static IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype)
{
ME_Impl *obj = CoTaskMemAlloc(sizeof(ME_Impl));
if (obj) {
@@ -351,20 +351,29 @@
/* Sample Grabber pin implementation */
typedef struct _SG_Pin {
- const IPinVtbl* lpVtbl;
+ IPin IPin_iface;
PIN_DIRECTION dir;
WCHAR const *name;
struct _SG_Impl *sg;
IPin *pair;
} SG_Pin;
+static inline SG_Pin *impl_from_IPin(IPin *iface)
+{
+ return CONTAINING_RECORD(iface, SG_Pin, IPin_iface);
+}
+
/* Sample Grabber filter implementation */
typedef struct _SG_Impl {
- const IBaseFilterVtbl* IBaseFilter_Vtbl;
- const ISampleGrabberVtbl* ISampleGrabber_Vtbl;
- const IMemInputPinVtbl* IMemInputPin_Vtbl;
- /* TODO: IMediaPosition, IMediaSeeking, IQualityControl */
- LONG refCount;
+ IUnknown IUnknown_inner;
+ IBaseFilter IBaseFilter_iface;
+ ISampleGrabber ISampleGrabber_iface;
+ IMemInputPin IMemInputPin_iface;
+ /* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
+ IUnknown* seekthru_unk;
+ /* TODO: IQualityControl */
+ IUnknown *outer_unk;
+ LONG ref;
CRITICAL_SECTION critSect;
FILTER_INFO info;
FILTER_STATE state;
@@ -387,20 +396,24 @@
OneShot_Past,
};
-/* Get the SampleGrabber implementation This pointer from various interface pointers */
+static inline SG_Impl *impl_from_IUnknown(IUnknown *iface)
+{
+ return CONTAINING_RECORD(iface, SG_Impl, IUnknown_inner);
+}
+
static inline SG_Impl *impl_from_IBaseFilter(IBaseFilter *iface)
{
- return (SG_Impl *)((char*)iface - FIELD_OFFSET(SG_Impl, IBaseFilter_Vtbl));
+ return CONTAINING_RECORD(iface, SG_Impl, IBaseFilter_iface);
}
static inline SG_Impl *impl_from_ISampleGrabber(ISampleGrabber *iface)
{
- return (SG_Impl *)((char*)iface - FIELD_OFFSET(SG_Impl, ISampleGrabber_Vtbl));
+ return CONTAINING_RECORD(iface, SG_Impl, ISampleGrabber_iface);
}
static inline SG_Impl *impl_from_IMemInputPin(IMemInputPin *iface)
{
- return (SG_Impl *)((char*)iface - FIELD_OFFSET(SG_Impl, IMemInputPin_Vtbl));
+ return CONTAINING_RECORD(iface, SG_Impl, IMemInputPin_iface);
}
@@ -422,65 +435,77 @@
CoTaskMemFree(This->mtype.pbFormat);
if (This->bufferData)
CoTaskMemFree(This->bufferData);
+ if(This->seekthru_unk)
+ IUnknown_Release(This->seekthru_unk);
This->critSect.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->critSect);
}
-/* Common helper AddRef called from all interfaces */
-static ULONG SampleGrabber_addref(SG_Impl *This)
-{
- ULONG refCount = InterlockedIncrement(&This->refCount);
- TRACE("(%p) new ref = %u\n", This, refCount);
- return refCount;
-}
-
-/* Common helper Release called from all interfaces */
-static ULONG SampleGrabber_release(SG_Impl *This)
-{
- ULONG refCount = InterlockedDecrement(&This->refCount);
- TRACE("(%p) new ref = %u\n", This, refCount);
- if (refCount == 0)
+/* SampleGrabber inner IUnknown */
+static HRESULT WINAPI SampleGrabber_QueryInterface(IUnknown *iface, REFIID riid, void
**ppv)
+{
+ SG_Impl *This = impl_from_IUnknown(iface);
+
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+
+ *ppv = NULL;
+ if (IsEqualIID(riid, &IID_IUnknown))
+ *ppv = &This->IUnknown_inner;
+ else if (IsEqualIID(riid, &IID_IPersist) || IsEqualIID(riid,
&IID_IMediaFilter) ||
+ IsEqualIID(riid, &IID_IBaseFilter))
+ *ppv = &This->IBaseFilter_iface;
+ else if (IsEqualIID(riid, &IID_ISampleGrabber))
+ *ppv = &This->ISampleGrabber_iface;
+ else if (IsEqualIID(riid, &IID_IMemInputPin))
+ *ppv = &This->IMemInputPin_iface;
+ else if (IsEqualIID(riid, &IID_IMediaPosition))
+ return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
+ else if (IsEqualIID(riid, &IID_IMediaSeeking))
+ return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
+ else if (IsEqualIID(riid, &IID_IQualityControl))
+ FIXME("IQualityControl not implemented\n");
+ else
+ WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv);
+
+ if (!*ppv)
+ return E_NOINTERFACE;
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI SampleGrabber_AddRef(IUnknown *iface)
+{
+ SG_Impl *This = impl_from_IUnknown(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) new ref = %u\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI SampleGrabber_Release(IUnknown *iface)
+{
+ SG_Impl *This = impl_from_IUnknown(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) new ref = %u\n", This, ref);
+
+ if (ref == 0)
{
SampleGrabber_cleanup(This);
CoTaskMemFree(This);
return 0;
}
- return refCount;
-}
-
-/* Common helper QueryInterface called from all interfaces */
-static HRESULT SampleGrabber_query(SG_Impl *This, REFIID riid, void **ppvObject)
-{
- TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
-
- if (IsEqualIID(riid, &IID_IUnknown) ||
- IsEqualIID(riid, &IID_IPersist) ||
- IsEqualIID(riid, &IID_IMediaFilter) ||
- IsEqualIID(riid, &IID_IBaseFilter)) {
- SampleGrabber_addref(This);
- *ppvObject = &(This->IBaseFilter_Vtbl);
- return S_OK;
- }
- else if (IsEqualIID(riid, &IID_ISampleGrabber)) {
- SampleGrabber_addref(This);
- *ppvObject = &(This->ISampleGrabber_Vtbl);
- return S_OK;
- }
- else if (IsEqualIID(riid, &IID_IMemInputPin)) {
- SampleGrabber_addref(This);
- *ppvObject = &(This->IMemInputPin_Vtbl);
- return S_OK;
- }
- else if (IsEqualIID(riid, &IID_IMediaPosition))
- FIXME("IMediaPosition not implemented\n");
- else if (IsEqualIID(riid, &IID_IMediaSeeking))
- FIXME("IMediaSeeking not implemented\n");
- else if (IsEqualIID(riid, &IID_IQualityControl))
- FIXME("IQualityControl not implemented\n");
- *ppvObject = NULL;
- WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
- return E_NOINTERFACE;
-}
+ return ref;
+}
+
+static const IUnknownVtbl samplegrabber_vtbl =
+{
+ SampleGrabber_QueryInterface,
+ SampleGrabber_AddRef,
+ SampleGrabber_Release,
+};
/* Helper that buffers data and/or calls installed sample callbacks */
static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
@@ -546,23 +571,26 @@
/* IUnknown */
static HRESULT WINAPI
-SampleGrabber_IBaseFilter_QueryInterface(IBaseFilter *iface, REFIID riid, void
**ppvObject)
-{
- return SampleGrabber_query(impl_from_IBaseFilter(iface), riid, ppvObject);
+SampleGrabber_IBaseFilter_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppv)
+{
+ SG_Impl *This = impl_from_IBaseFilter(iface);
+ return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_IBaseFilter_AddRef(IBaseFilter *iface)
{
- return SampleGrabber_addref(impl_from_IBaseFilter(iface));
+ SG_Impl *This = impl_from_IBaseFilter(iface);
+ return IUnknown_AddRef(This->outer_unk);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_IBaseFilter_Release(IBaseFilter *iface)
{
- return SampleGrabber_release(impl_from_IBaseFilter(iface));
+ SG_Impl *This = impl_from_IBaseFilter(iface);
+ return IUnknown_Release(This->outer_unk);
}
/* IPersist */
@@ -658,8 +686,8 @@
TRACE("(%p)->(%p)\n", This, pins);
if (!pins)
return E_POINTER;
- pin[0] = (IPin*)&This->pin_in.lpVtbl;
- pin[1] = (IPin*)&This->pin_out.lpVtbl;
+ pin[0] = &This->pin_in.IPin_iface;
+ pin[1] = &This->pin_out.IPin_iface;
*pins = pinsenum_create(iface, pin, 2);
return *pins ? S_OK : E_OUTOFMEMORY;
}
@@ -674,14 +702,14 @@
return E_POINTER;
if (!lstrcmpiW(id,pin_in_name))
{
- SampleGrabber_addref(This);
- *pin = (IPin*)&(This->pin_in.lpVtbl);
+ *pin = &This->pin_in.IPin_iface;
+ IPin_AddRef(*pin);
return S_OK;
}
else if (!lstrcmpiW(id,pin_out_name))
{
- SampleGrabber_addref(This);
- *pin = (IPin*)&(This->pin_out.lpVtbl);
+ *pin = &This->pin_out.IPin_iface;
+ IPin_AddRef(*pin);
return S_OK;
}
*pin = NULL;
@@ -732,23 +760,26 @@
/* IUnknown */
static HRESULT WINAPI
-SampleGrabber_ISampleGrabber_QueryInterface(ISampleGrabber *iface, REFIID riid, void
**ppvObject)
-{
- return SampleGrabber_query(impl_from_ISampleGrabber(iface), riid, ppvObject);
+SampleGrabber_ISampleGrabber_QueryInterface(ISampleGrabber *iface, REFIID riid, void
**ppv)
+{
+ SG_Impl *This = impl_from_ISampleGrabber(iface);
+ return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_ISampleGrabber_AddRef(ISampleGrabber *iface)
{
- return SampleGrabber_addref(impl_from_ISampleGrabber(iface));
+ SG_Impl *This = impl_from_ISampleGrabber(iface);
+ return IUnknown_AddRef(This->outer_unk);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_ISampleGrabber_Release(ISampleGrabber *iface)
{
- return SampleGrabber_release(impl_from_ISampleGrabber(iface));
+ SG_Impl *This = impl_from_ISampleGrabber(iface);
+ return IUnknown_Release(This->outer_unk);
}
/* ISampleGrabber */
@@ -879,23 +910,26 @@
/* IUnknown */
static HRESULT WINAPI
-SampleGrabber_IMemInputPin_QueryInterface(IMemInputPin *iface, REFIID riid, void
**ppvObject)
-{
- return SampleGrabber_query(impl_from_IMemInputPin(iface), riid, ppvObject);
+SampleGrabber_IMemInputPin_QueryInterface(IMemInputPin *iface, REFIID riid, void **ppv)
+{
+ SG_Impl *This = impl_from_IMemInputPin(iface);
+ return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_IMemInputPin_AddRef(IMemInputPin *iface)
{
- return SampleGrabber_addref(impl_from_IMemInputPin(iface));
+ SG_Impl *This = impl_from_IMemInputPin(iface);
+ return IUnknown_AddRef(This->outer_unk);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_IMemInputPin_Release(IMemInputPin *iface)
{
- return SampleGrabber_release(impl_from_IMemInputPin(iface));
+ SG_Impl *This = impl_from_IMemInputPin(iface);
+ return IUnknown_Release(This->outer_unk);
}
/* IMemInputPin */
@@ -994,37 +1028,41 @@
static ULONG WINAPI
SampleGrabber_IPin_AddRef(IPin *iface)
{
- return SampleGrabber_addref(((SG_Pin *)iface)->sg);
+ SG_Pin *This = impl_from_IPin(iface);
+ return ISampleGrabber_AddRef(&This->sg->ISampleGrabber_iface);
}
/* IUnknown */
static ULONG WINAPI
SampleGrabber_IPin_Release(IPin *iface)
{
- return SampleGrabber_release(((SG_Pin *)iface)->sg);
-}
-
-/* IUnknown */
-static HRESULT WINAPI
-SampleGrabber_IPin_QueryInterface(IPin *iface, REFIID riid, void **ppvObject)
-{
- SG_Pin *This = (SG_Pin *)iface;
- TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
-
- if (IsEqualIID(riid, &IID_IUnknown) ||
- IsEqualIID(riid, &IID_IPin)) {
- SampleGrabber_addref(This->sg);
- *ppvObject = This;
- return S_OK;
- }
- else if (IsEqualIID(riid, &IID_IMemInputPin)) {
- SampleGrabber_addref(This->sg);
- *ppvObject = &(This->sg->IMemInputPin_Vtbl);
- return S_OK;
- }
- *ppvObject = NULL;
- WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
- return E_NOINTERFACE;
+ SG_Pin *This = impl_from_IPin(iface);
+ return ISampleGrabber_Release(&This->sg->ISampleGrabber_iface);
+}
+
+/* IUnknown */
+static HRESULT WINAPI
+SampleGrabber_IPin_QueryInterface(IPin *iface, REFIID riid, void **ppv)
+{
+ SG_Pin *This = impl_from_IPin(iface);
+ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+
+ *ppv = NULL;
+ if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin))
+ *ppv = iface;
+ else if (IsEqualIID(riid, &IID_IMemInputPin))
+ *ppv = &This->sg->IMemInputPin_iface;
+ else if (IsEqualIID(riid, &IID_IMediaSeeking))
+ return IUnknown_QueryInterface(&This->sg->IUnknown_inner, riid, ppv);
+ else if (IsEqualIID(riid, &IID_IMediaPosition))
+ return IUnknown_QueryInterface(&This->sg->IUnknown_inner, riid, ppv);
+ else {
+ WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
}
/* IPin - input pin */
@@ -1039,8 +1077,9 @@
static HRESULT WINAPI
SampleGrabber_Out_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE *type)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
HRESULT hr;
+
TRACE("(%p)->(%p, %p)\n", This, receiver, type);
if (!receiver)
return E_POINTER;
@@ -1070,7 +1109,7 @@
!IsEqualGUID(&type->formattype, &GUID_NULL) &&
!type->pbFormat)
return VFW_E_TYPE_NOT_ACCEPTED;
- hr = IPin_ReceiveConnection(receiver,(IPin*)&This->lpVtbl,type);
+ hr = IPin_ReceiveConnection(receiver, &This->IPin_iface, type);
if (FAILED(hr))
return hr;
This->pair = receiver;
@@ -1087,7 +1126,8 @@
static HRESULT WINAPI
SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_MEDIA_TYPE
*type)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p, %p)\n", This, connector, type);
if (!connector)
return E_POINTER;
@@ -1142,7 +1182,8 @@
static HRESULT WINAPI
SampleGrabber_In_IPin_Disconnect(IPin *iface)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->() pair = %p\n", This, This->pair);
if (This->sg->state != State_Stopped)
return VFW_E_NOT_STOPPED;
@@ -1157,7 +1198,8 @@
static HRESULT WINAPI
SampleGrabber_Out_IPin_Disconnect(IPin *iface)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->() pair = %p\n", This, This->pair);
if (This->sg->state != State_Stopped)
return VFW_E_NOT_STOPPED;
@@ -1176,7 +1218,8 @@
static HRESULT WINAPI
SampleGrabber_IPin_ConnectedTo(IPin *iface, IPin **pin)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p) pair = %p\n", This, pin, This->pair);
if (!pin)
return E_POINTER;
@@ -1192,7 +1235,8 @@
static HRESULT WINAPI
SampleGrabber_IPin_ConnectionMediaType(IPin *iface, AM_MEDIA_TYPE *mtype)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p)\n", This, mtype);
if (!mtype)
return E_POINTER;
@@ -1210,12 +1254,13 @@
static HRESULT WINAPI
SampleGrabber_IPin_QueryPinInfo(IPin *iface, PIN_INFO *info)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p)\n", This, info);
if (!info)
return E_POINTER;
- SampleGrabber_addref(This->sg);
- info->pFilter = (IBaseFilter *)This->sg;
+ IBaseFilter_AddRef(&This->sg->IBaseFilter_iface);
+ info->pFilter = &This->sg->IBaseFilter_iface;
info->dir = This->dir;
lstrcpynW(info->achName,This->name,MAX_PIN_NAME);
return S_OK;
@@ -1225,7 +1270,8 @@
static HRESULT WINAPI
SampleGrabber_IPin_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p)\n", This, dir);
if (!dir)
return E_POINTER;
@@ -1237,7 +1283,8 @@
static HRESULT WINAPI
SampleGrabber_IPin_QueryId(IPin *iface, LPWSTR *id)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
int len;
TRACE("(%p)->(%p)\n", This, id);
if (!id)
@@ -1260,7 +1307,8 @@
static HRESULT WINAPI
SampleGrabber_IPin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **mtypes)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p)\n", This, mtypes);
if (!mtypes)
return E_POINTER;
@@ -1272,15 +1320,16 @@
static HRESULT WINAPI
SampleGrabber_In_IPin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *nPins)
{
- SG_Pin *This = (SG_Pin *)iface;
+ SG_Pin *This = impl_from_IPin(iface);
+
TRACE("(%p)->(%p, %p) size = %u\n", This, pins, nPins, (nPins ? *nPins :
0));
if (!nPins)
return E_POINTER;
if (*nPins) {
if (!pins)
return E_POINTER;
- IPin_AddRef((IPin*)&This->sg->pin_out.lpVtbl);
- *pins = (IPin*)&This->sg->pin_out.lpVtbl;
+ IPin_AddRef(&This->sg->pin_out.IPin_iface);
+ *pins = &This->sg->pin_out.IPin_iface;
*nPins = 1;
return S_OK;
}
@@ -1426,11 +1475,10 @@
HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
{
SG_Impl* obj = NULL;
+ ISeekingPassThru *passthru;
+ HRESULT hr;
TRACE("(%p,%p)\n", ppv, pUnkOuter);
-
- if (pUnkOuter)
- return CLASS_E_NOAGGREGATION;
obj = CoTaskMemAlloc(sizeof(SG_Impl));
if (NULL == obj) {
@@ -1439,16 +1487,17 @@
}
ZeroMemory(obj, sizeof(SG_Impl));
- obj->refCount = 1;
- obj->IBaseFilter_Vtbl = &IBaseFilter_VTable;
- obj->ISampleGrabber_Vtbl = &ISampleGrabber_VTable;
- obj->IMemInputPin_Vtbl = &IMemInputPin_VTable;
- obj->pin_in.lpVtbl = &IPin_In_VTable;
+ obj->ref = 1;
+ obj->IUnknown_inner.lpVtbl = &samplegrabber_vtbl;
+ obj->IBaseFilter_iface.lpVtbl = &IBaseFilter_VTable;
+ obj->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable;
+ obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable;
+ obj->pin_in.IPin_iface.lpVtbl = &IPin_In_VTable;
obj->pin_in.dir = PINDIR_INPUT;
obj->pin_in.name = pin_in_name;
obj->pin_in.sg = obj;
obj->pin_in.pair = NULL;
- obj->pin_out.lpVtbl = &IPin_Out_VTable;
+ obj->pin_out.IPin_iface.lpVtbl = &IPin_Out_VTable;
obj->pin_out.dir = PINDIR_OUTPUT;
obj->pin_out.name = pin_out_name;
obj->pin_out.sg = obj;
@@ -1469,7 +1518,19 @@
obj->oneShot = OneShot_None;
obj->bufferLen = -1;
obj->bufferData = NULL;
- *ppv = obj;
-
- return S_OK;
-}
+
+ if (pUnkOuter)
+ obj->outer_unk = pUnkOuter;
+ else
+ obj->outer_unk = &obj->IUnknown_inner;
+
+ hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)obj,
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&obj->seekthru_unk);
+ if(hr)
+ return hr;
+ IUnknown_QueryInterface(obj->seekthru_unk, &IID_ISeekingPassThru,
(void**)&passthru);
+ ISeekingPassThru_Init(passthru, FALSE, &obj->pin_in.IPin_iface);
+ ISeekingPassThru_Release(passthru);
+
+ *ppv = &obj->IUnknown_inner;
+ return S_OK;
+}
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Oct 11 13:12:40 2013
@@ -44,7 +44,7 @@
reactos/dll/directx/wine/dxdiagn # Synced to Wine-1.7.1
reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.1
reactos/dll/directx/wine/msdmo # Synced to Wine-1.7.1
-reactos/dll/directx/wine/qedit # Autosync
+reactos/dll/directx/wine/qedit # Synced to Wine-1.7.1
reactos/dll/directx/wine/quartz # Synced to Wine-1.5.26
reactos/dll/directx/wine/wined3d # Synced to Wine-1.7.1