SHARE
TWEET

Untitled

a guest Aug 20th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
  2.  
  3. // Send the sample to the Sink Writer.
  4. if (SUCCEEDED(hr))
  5. {
  6.     hr = pWriter->WriteSample(streamIndex, pSample);
  7. }
  8.  
  9. std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
  10. cout << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << endl;
  11.      
  12. HRESULT InitializeSinkWriter(IMFSinkWriter **ppWriter, DWORD *pStreamIndex)
  13. {
  14.     *ppWriter = NULL;
  15.     *pStreamIndex = NULL;
  16.  
  17.     IMFSinkWriter   *pSinkWriter = NULL;
  18.     IMFMediaType    *pMediaTypeOut = NULL;
  19.     IMFMediaType    *pMediaTypeIn = NULL;
  20.     IMFAttributes*  attr = NULL;
  21.     DWORD           streamIndex;
  22.     HRESULT hr;
  23.  
  24.     hr = MFCreateAttributes(&attr, 2);
  25.  
  26.     if (SUCCEEDED(hr))
  27.     {
  28.         hr = attr->SetUINT32(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, TRUE);
  29.     }
  30.  
  31.     if (SUCCEEDED(hr))
  32.     {
  33.         hr = attr->SetUINT32(MF_SINK_WRITER_DISABLE_THROTTLING, TRUE);
  34.     }
  35.  
  36.     if (SUCCEEDED(hr))
  37.     {
  38.         hr = MFCreateSinkWriterFromURL(L"output.wmv", NULL, attr, &pSinkWriter);
  39.     }
  40.     // ... the same as in the code sample
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top