Template:AVO Sample of copying

From AVObjects Knowledge Base
(Difference between revisions)
Jump to: navigation, search
(Created page with "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->CanG...")
 
Line 1: Line 1:
 +
==Sample==
 +
 +
<source lang=cpp>
 
for(int n = 0; n < nStreams; n++)
 
for(int n = 0; n < nStreams; n++)
 
{
 
{
Line 29: Line 32:
 
     return hr;
 
     return hr;
 
}
 
}
 +
</source>

Revision as of 15:09, 8 July 2014

Sample

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;
}
Personal tools