Method CanPutFrame

From AVObjects Knowledge Base
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{This|interfaces/iavobject/CanPutFrame.html}} <!--SORT=6--> The method checks the ability to send data to AV object. == == <source lang=cpp> HRESULT CanPutFrame( [in] i...")
 
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{This|interfaces/iavobject/CanPutFrame.html}}
 
{{This|interfaces/iavobject/CanPutFrame.html}}
 
<!--SORT=6-->
 
<!--SORT=6-->
 
+
__NOTOC__
The method checks the ability to send data to AV object.
+
The method checks the ability to put data to AV object.
  
 
== ==
 
== ==
<source lang=cpp>
+
<source lang=idl>
 
HRESULT CanPutFrame(
 
HRESULT CanPutFrame(
 
     [in] int nStream,
 
     [in] int nStream,
Line 15: Line 15:
 
<pre>
 
<pre>
 
nStream Number of stream
 
nStream Number of stream
nWait  Время ожидания ответа в мкс.
+
nWait  Response time in microseconds.
 
</pre>
 
</pre>
  
Line 25: Line 25:
 
E_INVALIDARG                        One or more arguments are invalid
 
E_INVALIDARG                        One or more arguments are invalid
 
E_FAIL                              Object not initialized yet or other failure.
 
E_FAIL                              Object not initialized yet or other failure.
 +
</pre>
 +
 +
{{AVO Sample of copy stream}}
 +
[[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.

The method checks the ability to put data to AV object.

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