Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
- // Send the sample to the Sink Writer.
- if (SUCCEEDED(hr))
- {
- hr = pWriter->WriteSample(streamIndex, pSample);
- }
- std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
- cout << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << endl;
- HRESULT InitializeSinkWriter(IMFSinkWriter **ppWriter, DWORD *pStreamIndex)
- {
- *ppWriter = NULL;
- *pStreamIndex = NULL;
- IMFSinkWriter *pSinkWriter = NULL;
- IMFMediaType *pMediaTypeOut = NULL;
- IMFMediaType *pMediaTypeIn = NULL;
- IMFAttributes* attr = NULL;
- DWORD streamIndex;
- HRESULT hr;
- hr = MFCreateAttributes(&attr, 2);
- if (SUCCEEDED(hr))
- {
- hr = attr->SetUINT32(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, TRUE);
- }
- if (SUCCEEDED(hr))
- {
- hr = attr->SetUINT32(MF_SINK_WRITER_DISABLE_THROTTLING, TRUE);
- }
- if (SUCCEEDED(hr))
- {
- hr = MFCreateSinkWriterFromURL(L"output.wmv", NULL, attr, &pSinkWriter);
- }
- // ... the same as in the code sample
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement