[PATCH 3/6] strmbase: Store the filter name and graph directly in the strmbase_filter structure.
Zebediah Figura
z.figura12 at gmail.com
Thu Jan 30 19:05:18 CST 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/qcap/avimux.c | 5 ++---
dlls/qcap/vfwcapture.c | 4 ++--
dlls/qedit/samplegrabber.c | 2 --
dlls/strmbase/filter.c | 40 ++++++++++++++++++++------------------
dlls/strmbase/renderer.c | 2 +-
include/wine/strmbase.h | 3 ++-
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c
index e402479fb17..91a0b17f8e1 100644
--- a/dlls/qcap/avimux.c
+++ b/dlls/qcap/avimux.c
@@ -772,8 +772,7 @@ static HRESULT WINAPI ConfigInterleaving_put_Mode(
if(This->mode != mode) {
if(This->source.pin.peer) {
- HRESULT hr = IFilterGraph_Reconnect(This->filter.filterInfo.pGraph,
- &This->source.pin.IPin_iface);
+ HRESULT hr = IFilterGraph_Reconnect(This->filter.graph, &This->source.pin.IPin_iface);
if(FAILED(hr))
return hr;
}
@@ -1152,7 +1151,7 @@ static HRESULT WINAPI AviMuxOut_AttemptConnection(struct strmbase_source *iface,
if (!filter->in[i]->pin.pin.peer)
continue;
- hr = IFilterGraph_Reconnect(filter->filter.filterInfo.pGraph, &filter->in[i]->pin.pin.IPin_iface);
+ hr = IFilterGraph_Reconnect(filter->filter.graph, &filter->in[i]->pin.pin.IPin_iface);
if (FAILED(hr))
{
IPin_Disconnect(&iface->pin.IPin_iface);
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index b4716bf1925..30869ede13e 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -216,9 +216,9 @@ AMStreamConfig_SetFormat(IAMStreamConfig *iface, AM_MEDIA_TYPE *pmt)
}
hr = qcap_driver_set_format(This->driver_info, pmt);
- if (SUCCEEDED(hr) && This->filter.filterInfo.pGraph && This->source.pin.peer)
+ if (SUCCEEDED(hr) && This->filter.graph && This->source.pin.peer)
{
- hr = IFilterGraph_Reconnect(This->filter.filterInfo.pGraph, &This->source.pin.IPin_iface);
+ hr = IFilterGraph_Reconnect(This->filter.graph, &This->source.pin.IPin_iface);
if (SUCCEEDED(hr))
TRACE("Reconnection completed, with new media format..\n");
}
diff --git a/dlls/qedit/samplegrabber.c b/dlls/qedit/samplegrabber.c
index edb814468a3..7652f70d958 100644
--- a/dlls/qedit/samplegrabber.c
+++ b/dlls/qedit/samplegrabber.c
@@ -80,8 +80,6 @@ static inline SG_Impl *impl_from_IMemInputPin(IMemInputPin *iface)
static void SampleGrabber_cleanup(SG_Impl *This)
{
TRACE("(%p)\n", This);
- if (This->filter.filterInfo.pGraph)
- WARN("(%p) still joined to filter graph %p\n", This, This->filter.filterInfo.pGraph);
if (This->allocator)
IMemAllocator_Release(This->allocator);
if (This->grabberIface)
diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c
index 43da4b3fb90..84521b80990 100644
--- a/dlls/strmbase/filter.c
+++ b/dlls/strmbase/filter.c
@@ -443,35 +443,37 @@ static HRESULT WINAPI filter_FindPin(IBaseFilter *iface, const WCHAR *id, IPin *
return VFW_E_NOT_FOUND;
}
-static HRESULT WINAPI filter_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *pInfo)
+static HRESULT WINAPI filter_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *info)
{
- struct strmbase_filter *This = impl_from_IBaseFilter(iface);
- TRACE("(%p)->(%p)\n", This, pInfo);
+ struct strmbase_filter *filter = impl_from_IBaseFilter(iface);
- lstrcpyW(pInfo->achName, This->filterInfo.achName);
- pInfo->pGraph = This->filterInfo.pGraph;
+ TRACE("filter %p, info %p.\n", filter, info);
- if (pInfo->pGraph)
- IFilterGraph_AddRef(pInfo->pGraph);
+ lstrcpyW(info->achName, filter->name);
+ info->pGraph = filter->graph;
+
+ if (info->pGraph)
+ IFilterGraph_AddRef(info->pGraph);
return S_OK;
}
-static HRESULT WINAPI filter_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *pGraph, const WCHAR *pName)
+static HRESULT WINAPI filter_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *graph, const WCHAR *name)
{
- struct strmbase_filter *This = impl_from_IBaseFilter(iface);
+ struct strmbase_filter *filter = impl_from_IBaseFilter(iface);
- TRACE("(%p)->(%p, %s)\n", This, pGraph, debugstr_w(pName));
+ TRACE("filter %p, graph %p, name %s.\n", filter, graph, debugstr_w(name));
- EnterCriticalSection(&This->csFilter);
- {
- if (pName)
- lstrcpynW(This->filterInfo.achName, pName, MAX_FILTER_NAME);
- else
- *This->filterInfo.achName = '\0';
- This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
- }
- LeaveCriticalSection(&This->csFilter);
+ EnterCriticalSection(&filter->csFilter);
+
+ if (name)
+ lstrcpynW(filter->name, name, ARRAY_SIZE(filter->name));
+ else
+ filter->name[0] = 0;
+ /* The graph references us, so we cannot also reference the graph. */
+ filter->graph = graph;
+
+ LeaveCriticalSection(&filter->csFilter);
return S_OK;
}
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c
index 1bc581963cf..974823b0466 100644
--- a/dlls/strmbase/renderer.c
+++ b/dlls/strmbase/renderer.c
@@ -199,7 +199,7 @@ static void sink_disconnect(struct strmbase_sink *iface)
static HRESULT sink_eos(struct strmbase_sink *iface)
{
struct strmbase_renderer *filter = impl_from_IPin(&iface->pin.IPin_iface);
- IFilterGraph *graph = filter->filter.filterInfo.pGraph;
+ IFilterGraph *graph = filter->filter.graph;
IMediaEventSink *event_sink;
HRESULT hr = S_OK;
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index abb04a8384a..ae0fadb391e 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -130,7 +130,8 @@ struct strmbase_filter
FILTER_STATE state;
IReferenceClock * pClock;
- FILTER_INFO filterInfo;
+ WCHAR name[128];
+ IFilterGraph *graph;
CLSID clsid;
LONG pin_version;
--
2.25.0
More information about the wine-devel
mailing list