Method CanPutFrame
From AVObjects Knowledge Base
(Difference between revisions)
Line 26: | Line 26: | ||
E_FAIL Object not initialized yet or other failure. | E_FAIL Object not initialized yet or other failure. | ||
</pre> | </pre> | ||
+ | |||
+ | {{AVO Sample of copying}} | ||
[[Category:IAVObject]] | [[Category:IAVObject]] |
Revision as of 15:10, 8 July 2014
This page is a copy of the original page on the AVObjects' web site and can also be viewed here.
The method checks the ability to send data to AV object.
Contents |
HRESULT CanPutFrame( [in] int nStream, [in] DWORD nWait );
Parameters:
nStream Number of stream nWait Response time in microseconds.
Returns:
S_OK Object ready for receive data S_FALSE Object is busy HRESULT_FROM_WIN32(ERROR_HANDLE_EOF) End of stream E_INVALIDARG One or more arguments are invalid E_FAIL Object not initialized yet or other failure.
Copy frames for all streams from source object to dest object
for(int n = 0; n < nStreams; n++) { HRESULT hr = spDest->CanPutFrame(n, 0); if ( FAILED(hr) ) return hr; else if (hr != S_OK) continue; hr = spSource->CanGetFrame(n, 0); if ( FAILED(hr) ) return hr; else if (hr != S_OK) continue; DWORD cbActual = 0; REFERENCE_TIME tS = 0, tE = 0; DWORD dwFlags = 0; hr = spSource->GetFrame(n, m_pbBuffer, m_cbBuffer, &cbActual, &dwFlags, &tS, &tE, NULL); if (hr == S_OK) { hr = spDest->PutFrame(n, m_pbBuffer, cbActual, dwFlags, tS, tE, NULL); } else if (hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF)) { hr = spDest->PutFrame(n, NULL, 0, 0, 0, 0, NULL); } if (FAILED(hr)) return hr; }