我有直接顯示過濾器,它接受輸入並對其進行處理並將結果提供給輸出引腳。如何從directshow濾波器輸出引腳獲取數據?
我想寫這個過濾器輸出數據到一個文件...我想在它的過濾器class.So我想獲得輸出引腳緩衝區數據。
很快如何達到其濾波器輸出引腳的最終數據?我該怎麼做?
不:輸出引腳從CBaseOutputPin.This導出是一個開源的過濾它「神奇」 :-)把賴特數據到其輸出引腳,我無法弄清楚如何尚未...
更新:
這裏是siutuation:GFilter的
Media Source ----> GFilter ----> FileWriter
我的源代碼...我的FileWriter沒有源代碼......我想什麼做的是使GFilter編寫它自己的數據...我調試GFilter得到一些洞察如何其轉換數據,但我試圖寫這個數據結果與錯誤的數據...所以我現在欺騙如何簡單地在其輸出引腳獲取數據...
更新[2]
在篩選outputpin somwhere濾波器作家通過文件寫入器銷IStreamPtr可變...寄託都似乎寫入到可變m_pIStream其是[IStreamPtr]
GFilterOutput::CompleteConnect(IPin *pReceivePin)
{
// make sure that this is the file writer, supporting
// IStream, or we will not be able to write out the metadata
// at stop time
// m_pIStream is IStreamPtr type
m_pIStream = pReceivePin;
if (m_pIStream == NULL)
{
return E_NOINTERFACE;
}
return CBaseOutputPin::CompleteConnect(pReceivePin);
}
類型
...
GFilterOutput::Replace(LONGLONG pos, const BYTE* pBuffer, long cBytes)
{
//OutputDebugStringA("DEBUG: Now at MuxOutput Replace");
// all media content is written when the graph is running,
// using IMemInputPin. On stop (during our stop, but after the
// file writer has stopped), we switch to IStream for the metadata.
// The in-memory index is updated after a successful call to this function, so
// any data not written on completion of Stop will not be in the index.
CAutoLock lock(&m_csWrite);
HRESULT hr = S_OK;
if (m_bUseIStream)
{
IStreamPtr pStream = GetConnected();
if (m_pIStream == NULL)
{
hr = E_NOINTERFACE;
} else {
LARGE_INTEGER liTo;
liTo.QuadPart = pos;
ULARGE_INTEGER uliUnused;
hr = m_pIStream->Seek(liTo, STREAM_SEEK_SET, &uliUnused);
if (SUCCEEDED(hr))
{
ULONG cActual;
hr = m_pIStream->Write(pBuffer, cBytes, &cActual);
if (SUCCEEDED(hr) && ((long)cActual != cBytes))
{
hr = E_FAIL;
}
}
}
} else {
// where the buffer boundaries lie is not important in this
// case, so break writes up into the buffers.
while (cBytes && (hr == S_OK))
{
IMediaSamplePtr pSample;
hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0);
if (SUCCEEDED(hr))
{
long cThis = min(pSample->GetSize(), cBytes);
BYTE* pDest;
pSample->GetPointer(&pDest);
CopyMemory(pDest, pBuffer, cThis);
pSample->SetActualDataLength(cThis);
// time stamps indicate file position in bytes
LONGLONG tStart = pos;
LONGLONG tEnd = pos + cThis;
pSample->SetTime(&tStart, &tEnd);
hr = Deliver(pSample);
if (SUCCEEDED(hr))
{
pBuffer += cThis;
cBytes -= cThis;
pos += cThis;
}
}
}
}
return hr;
}
更新我的信息..它似乎這是無效的在我的情況下... GFilter類InputPin有接收方法,但GFilter輸出pi沒有..而我無法調試第三方過濾器可能是調用接收我的過濾。我想要在GFilter中訪問這個... – Novalis
「我有GFilter的源代碼」,所以你有代碼。您不需要FileWriter的代碼,只需在FileWriter的'IPin :: Receive'被調用之前在GFilter中儘可能晚地轉儲數據。 –
那麼,過濾器與文件編寫器通過IStream接口說話...我只是無法弄清楚它在哪裏調用FireWriter IPin ::接收...我甚至在源代碼中搜索接收關鍵字... :-) – Novalis