MCPcopy Create free account
hub / github.com/cmauri/eviacam / SaveGraphFile

Method SaveGraphFile

creavision/videoInput.cpp:2217–2256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2215// ----------------------------------------------------------------------
2216
2217HRESULT videoInput::SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) {
2218 const WCHAR wszStreamName[] = L"ActiveMovieGraph";
2219 HRESULT hr;
2220 IStorage *pStorage = NULL;
2221
2222 // First, create a document file which will hold the GRF file
2223 hr = StgCreateDocfile(
2224 wszPath,
2225 STGM_CREATE | STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
2226 0, &pStorage);
2227 if(FAILED(hr))
2228 {
2229 return hr;
2230 }
2231
2232 // Next, create a stream to store.
2233 IStream *pStream;
2234 hr = pStorage->CreateStream(
2235 wszStreamName,
2236 STGM_WRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
2237 0, 0, &pStream);
2238 if (FAILED(hr))
2239 {
2240 pStorage->Release();
2241 return hr;
2242 }
2243
2244 // The IPersistStream converts a stream into a persistent object.
2245 IPersistStream *pPersist = NULL;
2246 pGraph->QueryInterface(IID_IPersistStream, reinterpret_cast<void**>(&pPersist));
2247 hr = pPersist->Save(pStream, TRUE);
2248 pStream->Release();
2249 pPersist->Release();
2250 if (SUCCEEDED(hr))
2251 {
2252 hr = pStorage->Commit(STGC_DEFAULT);
2253 }
2254 pStorage->Release();
2255 return hr;
2256}
2257
2258
2259// ----------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

ReleaseMethod · 0.80
QueryInterfaceMethod · 0.80

Tested by

no test coverage detected