Commit 7bcb8e74 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap: Reimplement COM registration and vending locally.

parent cf376c96
......@@ -8,7 +8,6 @@ C_SRCS = \
avico.c \
avimux.c \
capturegraph.c \
dllfunc.c \
filter.c \
mediatype.c \
pin.c \
......@@ -18,3 +17,6 @@ C_SRCS = \
vfwcapture.c
RC_SRCS = version.rc
IDL_SRCS = \
qcap_classes.idl
......@@ -154,22 +154,18 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl =
PPB_Save
};
IUnknown* WINAPI QCAP_createAudioCaptureFilter(IUnknown *outer, HRESULT *phr)
HRESULT audio_record_create(IUnknown *outer, IUnknown **out)
{
AudioRecord *This = NULL;
AudioRecord *object;
FIXME("(%p, %p): the entire CLSID_AudioRecord implementation is just stubs\n", outer, phr);
if (!(object = CoTaskMemAlloc(sizeof(*object))))
return E_OUTOFMEMORY;
memset(object, 0, sizeof(*object));
This = CoTaskMemAlloc(sizeof(*This));
if (This == NULL) {
*phr = E_OUTOFMEMORY;
return NULL;
}
memset(This, 0, sizeof(*This));
This->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
strmbase_filter_init(&This->filter, outer, &CLSID_AudioRecord, &filter_ops);
object->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
strmbase_filter_init(&object->filter, outer, &CLSID_AudioRecord, &filter_ops);
*phr = S_OK;
return &This->filter.IUnknown_inner;
TRACE("Created audio recorder %p.\n", object);
*out = &object->filter.IUnknown_inner;
return S_OK;
}
......@@ -480,25 +480,22 @@ static const struct strmbase_source_ops source_ops =
.pfnDecideAllocator = AVICompressorOut_DecideAllocator,
};
IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
HRESULT avi_compressor_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR source_name[] = {'O','u','t',0};
static const WCHAR sink_name[] = {'I','n',0};
AVICompressor *compressor;
AVICompressor *object;
compressor = heap_alloc_zero(sizeof(*compressor));
if(!compressor) {
*phr = E_NOINTERFACE;
return NULL;
}
strmbase_filter_init(&compressor->filter, outer, &CLSID_AVICo, &filter_ops);
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
strmbase_filter_init(&object->filter, outer, &CLSID_AVICo, &filter_ops);
object->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
strmbase_sink_init(&compressor->sink, &compressor->filter, sink_name, &sink_ops, NULL);
strmbase_source_init(&compressor->source, &compressor->filter, source_name, &source_ops);
strmbase_sink_init(&object->sink, &object->filter, sink_name, &sink_ops, NULL);
strmbase_source_init(&object->source, &object->filter, source_name, &source_ops);
*phr = S_OK;
return &compressor->filter.IUnknown_inner;
TRACE("Created AVI compressor %p.\n", object);
*out = &object->filter.IUnknown_inner;
return S_OK;
}
......@@ -1835,7 +1835,7 @@ static HRESULT create_input_pin(AviMux *avimux)
return S_OK;
}
IUnknown * WINAPI QCAP_createAVIMux(IUnknown *outer, HRESULT *phr)
HRESULT avi_mux_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR output_name[] = {'A','V','I',' ','O','u','t',0};
......@@ -1843,11 +1843,8 @@ IUnknown * WINAPI QCAP_createAVIMux(IUnknown *outer, HRESULT *phr)
PIN_INFO info;
HRESULT hr;
avimux = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AviMux));
if(!avimux) {
*phr = E_OUTOFMEMORY;
return NULL;
}
if (!(avimux = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AviMux))))
return E_OUTOFMEMORY;
strmbase_filter_init(&avimux->filter, outer, &CLSID_AviDest, &filter_ops);
avimux->IConfigAviMux_iface.lpVtbl = &ConfigAviMuxVtbl;
......@@ -1870,13 +1867,13 @@ IUnknown * WINAPI QCAP_createAVIMux(IUnknown *outer, HRESULT *phr)
strmbase_source_cleanup(&avimux->source);
strmbase_filter_cleanup(&avimux->filter);
HeapFree(GetProcessHeap(), 0, avimux);
*phr = hr;
return NULL;
return hr;
}
avimux->interleave = 10000000;
TRACE("Created AVI mux %p.\n", avimux);
ObjectRefCount(TRUE);
*phr = S_OK;
return &avimux->filter.IUnknown_inner;
*out = &avimux->filter.IUnknown_inner;
return S_OK;
}
......@@ -74,33 +74,27 @@ static inline CaptureGraphImpl *impl_from_ICaptureGraphBuilder2(ICaptureGraphBui
}
IUnknown * CALLBACK QCAP_createCaptureGraphBuilder2(IUnknown *pUnkOuter,
HRESULT *phr)
HRESULT capture_graph_create(IUnknown *outer, IUnknown **out)
{
CaptureGraphImpl * pCapture = NULL;
CaptureGraphImpl *object;
TRACE("(%p, %p)\n", pUnkOuter, phr);
if (outer)
return CLASS_E_NOAGGREGATION;
*phr = CLASS_E_NOAGGREGATION;
if (pUnkOuter)
{
return NULL;
}
*phr = E_OUTOFMEMORY;
if (!(object = CoTaskMemAlloc(sizeof(*object))))
return E_OUTOFMEMORY;
pCapture = CoTaskMemAlloc(sizeof(CaptureGraphImpl));
if (pCapture)
{
pCapture->ICaptureGraphBuilder2_iface.lpVtbl = &builder2_Vtbl;
pCapture->ICaptureGraphBuilder_iface.lpVtbl = &builder_Vtbl;
pCapture->ref = 1;
pCapture->mygraph = NULL;
InitializeCriticalSection(&pCapture->csFilter);
pCapture->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": CaptureGraphImpl.csFilter");
*phr = S_OK;
ObjectRefCount(TRUE);
}
return (IUnknown *)&pCapture->ICaptureGraphBuilder_iface;
object->ICaptureGraphBuilder2_iface.lpVtbl = &builder2_Vtbl;
object->ICaptureGraphBuilder_iface.lpVtbl = &builder_Vtbl;
object->ref = 1;
object->mygraph = NULL;
InitializeCriticalSection(&object->csFilter);
object->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": CaptureGraphImpl.csFilter");
TRACE("Created capture graph builder %p.\n", object);
ObjectRefCount(TRUE);
*out = (IUnknown *)&object->ICaptureGraphBuilder_iface;
return S_OK;
}
static HRESULT WINAPI
......
/*
* COM classes for qcap
*
* Copyright 2019 Zebediah Figura
*
* 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
*/
#pragma makedep register
[
helpstring("Audio Capture Filter"),
threading(both),
uuid(e30629d2-27e5-11ce-875d-00608cb78066)
]
coclass AudioRecord {}
[
helpstring("Audio Capture Filter"),
threading(both),
uuid(d76e2820-1563-11cf-ac98-00aa004c0fa9)
]
coclass AVICo {}
[
helpstring("AVI mux"),
threading(both),
uuid(e2510970-f137-11ce-8b67-00aa00a3f1a6)
]
coclass AviDest {}
[
helpstring("Capture Graph Builder"),
threading(both),
uuid(bf87b6e0-8c27-11d0-b3f0-00aa003761c5)
]
coclass CaptureGraphBuilder {}
[
helpstring("Capture Graph Builder 2"),
threading(both),
uuid(bf87b6e1-8c27-11d0-b3f0-00aa003761c5)
]
coclass CaptureGraphBuilder2 {}
[
helpstring("Smart Tee Filter"),
threading(both),
uuid(cc58e280-8aa1-11d1-b3f1-00aa003761c5)
]
coclass SmartTee {}
[
helpstring("VFW Capture Filter"),
threading(both),
uuid(1b544c22-fd0b-11ce-8c63-00aa0044b51e)
]
coclass VfwCapture {}
......@@ -25,18 +25,11 @@
extern DWORD ObjectRefCount(BOOL increment) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAudioCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAVICompressor(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createVFWCaptureFilterPropertyPage(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAVICompressor(IUnknown*,HRESULT*) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAVIMux(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAVIMuxPropertyPage(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAVIMuxPropertyPage1(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createFileWriter(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createCaptureGraphBuilder2(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createInfinitePinTeeFilter(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createSmartTeeFilter(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
extern IUnknown * WINAPI QCAP_createAudioInputMixerPropertyPage(IUnknown *pUnkOuter, HRESULT *phr) DECLSPEC_HIDDEN;
HRESULT audio_record_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT avi_compressor_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT avi_mux_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT capture_graph_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT smart_tee_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
#endif /* _QCAP_MAIN_H_DEFINED */
......@@ -321,7 +321,7 @@ static const struct strmbase_source_ops preview_ops =
.pfnDecideAllocator = SmartTeeFilterPreview_DecideAllocator,
};
IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
HRESULT smart_tee_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR captureW[] = {'C','a','p','t','u','r','e',0};
static const WCHAR previewW[] = {'P','r','e','v','i','e','w',0};
......@@ -330,10 +330,7 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
HRESULT hr;
if (!(object = CoTaskMemAlloc(sizeof(*object))))
{
*phr = E_OUTOFMEMORY;
return NULL;
}
return E_OUTOFMEMORY;
memset(object, 0, sizeof(*object));
strmbase_filter_init(&object->filter, outer, &CLSID_SmartTee, &filter_ops);
......@@ -342,14 +339,15 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
&IID_IMemAllocator, (void **)&object->sink.pAllocator);
if (FAILED(hr))
{
*phr = hr;
strmbase_filter_cleanup(&object->filter);
return NULL;
CoTaskMemFree(object);
return hr;
}
strmbase_source_init(&object->capture, &object->filter, captureW, &capture_ops);
strmbase_source_init(&object->preview, &object->filter, previewW, &preview_ops);
*phr = S_OK;
return &object->filter.IUnknown_inner;
TRACE("Created smart tee %p.\n", object);
*out = &object->filter.IUnknown_inner;
return S_OK;
}
......@@ -563,16 +563,13 @@ static const struct strmbase_source_ops source_ops =
.pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator,
};
IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr)
HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
{
static const WCHAR source_name[] = {'O','u','t','p','u','t',0};
VfwCapture *object;
if (!(object = CoTaskMemAlloc(sizeof(*object))))
{
*phr = E_OUTOFMEMORY;
return NULL;
}
return E_OUTOFMEMORY;
strmbase_filter_init(&object->filter, outer, &CLSID_VfwCapture, &filter_ops);
......@@ -587,6 +584,6 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr)
TRACE("Created VFW capture filter %p.\n", object);
ObjectRefCount(TRUE);
*phr = S_OK;
return &object->filter.IUnknown_inner;
*out = &object->filter.IUnknown_inner;
return S_OK;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment