124 lines
4.2 KiB
Plaintext
124 lines
4.2 KiB
Plaintext
// wndClass.hbrBackground =(HBRUSH)COLOR_APPWORKSPACE;
|
|
// wndClass.hbrBackground =(HBRUSH)(COLOR_WINDOWFRAME);
|
|
|
|
|
|
/*
|
|
if (IDM_OPTIONS_SAVEGRAPH == LOWORD (wparam))
|
|
{
|
|
ofn.lpstrFilter = TEXT("Filter Graph\0*.grf\0\0");
|
|
ofn.lpstrTitle = TEXT("Set FilterGraph File Name");
|
|
ofn.lpstrFile = g_FilterGraphFileName;
|
|
}
|
|
else if (IDM_SETOUTPUT == LOWORD (wparam))
|
|
{
|
|
ofn.lpstrFilter = TEXT("Microsoft AVI\0*.avi\0\0");
|
|
ofn.lpstrTitle = TEXT("Set output File Name");
|
|
ofn.lpstrFile = g_OutputFileName;
|
|
}
|
|
else
|
|
{
|
|
ofn.lpstrFilter = TEXT("Microsoft AVI\0*.avi\0\0");
|
|
ofn.lpstrTitle = TEXT("Set input File Name");
|
|
ofn.lpstrFile = g_InputFileName;
|
|
}
|
|
|
|
if (GetOpenFileName(&ofn))
|
|
{
|
|
if (IDM_OPTIONS_SAVEGRAPH == LOWORD (wparam))
|
|
{
|
|
lstrcpy(g_FilterGraphFileName, ofn.lpstrFile);
|
|
// Save the current built filter graph to a *.grf file
|
|
if(g_pGraph != NULL)
|
|
g_pGraph->SaveGraphToFile(g_FilterGraphFileName);
|
|
|
|
}
|
|
else if (IDM_SETOUTPUT == LOWORD (wparam))
|
|
{
|
|
lstrcpy(g_OutputFileName, ofn.lpstrFile);
|
|
}
|
|
else
|
|
{
|
|
lstrcpy(g_InputFileName, ofn.lpstrFile);
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// ******************************************************************************************
|
|
|
|
/*
|
|
HRESULT CDVGraph::NukeFilters(IBaseFilter *pFilter, BOOL bNukeDownStream)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
IPin *pPin = NULL;
|
|
IPin *pToPin = NULL;
|
|
IEnumPins *pEnumPins = NULL;
|
|
|
|
ULONG uFetched = 0;
|
|
PIN_INFO PinInfo;
|
|
LONG lDelayCount = 100;
|
|
|
|
ASSERT(m_pGraph);
|
|
|
|
// Validating the the pointer to the Filter is not null
|
|
if(!pFilter)
|
|
{
|
|
Dump( TEXT("CAVCGraph::NukeFilters():: Invalid Argument:: Invalid filter to nuke from") );
|
|
return E_FAIL;
|
|
}
|
|
|
|
// enumerate all the pins on this filter
|
|
// reset the enumerator to the first pin
|
|
hr = pFilter->EnumPins(&pEnumPins);
|
|
CHECK_ERROR( TEXT("CAVCGraph::NukeFilters():: Could not enumerate pins on the filter to be nuked fro."), hr);
|
|
pEnumPins->Reset();
|
|
|
|
// Loop through all the pins of the filter
|
|
while( SUCCEEDED(pEnumPins->Next(1, &pPin, &uFetched)) && pPin )
|
|
{
|
|
// Get the pin & its pin_info struct that this filter's pin is connected to
|
|
hr = pPin->ConnectedTo(&pToPin);
|
|
if(SUCCEEDED(hr) &&pToPin )
|
|
{
|
|
hr = pToPin->QueryPinInfo(&PinInfo);
|
|
CHECK_ERROR( TEXT("pToPin->QueryPinInfo failed."), hr);
|
|
|
|
// Check that this ConnectedTo Pin is a input pin thus validating that our filter's pin is an output pin
|
|
if(PinInfo.dir == PINDIR_INPUT && bNukeDownStream)
|
|
{
|
|
// thus we have a pin on the downstream filter so nuke everything downstream of that filter recursively
|
|
NukeFilters(PinInfo.pFilter, bNukeDownStream);
|
|
// Disconnect the two pins and remove the downstream filter
|
|
m_pGraph->Disconnect(pToPin);
|
|
m_pGraph->Disconnect(pPin);
|
|
//always leave the Camera filter in the graph
|
|
if (PinInfo.pFilter != m_pDeviceFilter)
|
|
{
|
|
if(FAILED(m_pGraph->RemoveFilter(PinInfo.pFilter)))
|
|
{
|
|
Dump(TEXT("CAVCGraph::NukeFilters():: The Filter cannot be removed from the filtergraph"));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
SAFE_RELEASE(PinInfo.pFilter);
|
|
SAFE_RELEASE(pToPin);
|
|
Dump(TEXT("CAVCGraph::NukeFilters():: release ToPin\n"));
|
|
}
|
|
SAFE_RELEASE(pPin);
|
|
}
|
|
|
|
SAFE_RELEASE(pEnumPins);
|
|
return S_OK;
|
|
}
|
|
|
|
*/ |