Method GetFrame
From AVObjects Knowledge Base
(Difference between revisions)
(Created page with "{{This|interfaces/iavobject/GetFrame.html}} <!--SORT=9--> Method to get data from AV object == == <source lang=idl> HRESULT GetFrame( [in] int nStream, [in] BYTE* pbB...") |
|||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
{{This|interfaces/iavobject/GetFrame.html}} | {{This|interfaces/iavobject/GetFrame.html}} | ||
<!--SORT=9--> | <!--SORT=9--> | ||
− | + | __NOTOC__ | |
Method to get data from AV object | Method to get data from AV object | ||
== == | == == | ||
Line 36: | Line 36: | ||
</pre> | </pre> | ||
− | {{AVO Sample of | + | {{AVO Sample of copy stream}} |
− | [[Category: | + | [[Category:IAVObject]] |
Latest revision as of 08:52, 11 July 2014
This page is a copy of the original page on the AVObjects' web site and can also be viewed here.
Method to get data from AV object
HRESULT GetFrame( [in] int nStream, [in] BYTE* pbBuffer, [in] DWORD cbBuffer, [out] DWORD* pcbActual, [out] DWORD* pdwFlags, [out] REFERENCE_TIME* ptS, [out] REFERENCE_TIME* ptE, [out] BYTE** pbReserved );
Parameters:
nStream Number of stream pbBuffer Buffer for data cbBuffer Size of data in buffer in bytes. pcbActual Size of received data buffer in bytes. pdwFlags Library specific bitmap (see library description) ptS Start time ptE End time ppbReserved Library specific variable (see library description)
Returns:
S_OK Data in pbBuffer returned E_INVALIDARG One or more arguments are invalid E_FAIL Object not initialized yet or other failure.
Copy stream
//BYTE* pbBuffer - pointer to frame buffer //DWORD cbBuffer - size of frane buffer in bytes //int nStream - index of stream HRESULT hr = S_OK; while(1) { hr = spDest->CanPutFrame(nStream, INFINITE); if ( hr != S_OK ) return hr; hr = spSource->CanGetFrame(nStream, INFINITE); if (hr != S_OK) return hr; DWORD cbActual = 0; REFERENCE_TIME tS = 0, tE = 0; DWORD dwFlags = 0; hr = spSource->GetFrame(nStream, pbBuffer, cbBuffer, &cbActual, &dwFlags, &tS, &tE, NULL); if (hr == S_OK) { hr = spDest->PutFrame(nStream, m_pbBuffer, cbActual, dwFlags, tS, tE, NULL); } else if (hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF)) { // EOS, put empty frame to dest hr = spDest->PutFrame(nStream, NULL, 0, 0, 0, 0, NULL); if (hr == S_OK) return hr; } if (FAILED(hr)) return hr; }