14 ComPtr<IMFMediaType> mediaType;
15 m_sourceReader.Reset();
20 ComPtr<IMFAttributes> attr;
21 MFCreateAttributes(attr.GetAddressOf(), 1);
22 if (FAILED(attr->SetUnknown(MF_SOURCE_READER_ASYNC_CALLBACK,
this)))
24 if (FAILED(attr->SetUINT32(MF_SOURCE_READER_DISCONNECT_MEDIASOURCE_ON_SHUTDOWN, TRUE)))
27 HRESULT hr = MFCreateSourceReaderFromMediaSource(
source, attr.Get(), m_sourceReader.GetAddressOf());
29 qWarning() <<
"MFDecoderSourceReader: failed to set up source reader: "
30 << std::system_category().message(hr).c_str();
34 m_sourceReader->SetStreamSelection(DWORD(MF_SOURCE_READER_ALL_STREAMS), FALSE);
35 m_sourceReader->SetStreamSelection(DWORD(MF_SOURCE_READER_FIRST_AUDIO_STREAM), TRUE);
37 ComPtr<IMFMediaType> pPartialType;
38 MFCreateMediaType(pPartialType.GetAddressOf());
39 pPartialType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
40 pPartialType->SetGUID(MF_MT_SUBTYPE, sampleFormat ==
QAudioFormat::Float ? MFAudioFormat_Float : MFAudioFormat_PCM);
41 m_sourceReader->SetCurrentMediaType(DWORD(MF_SOURCE_READER_FIRST_AUDIO_STREAM),
nullptr, pPartialType.Get());
42 m_sourceReader->GetCurrentMediaType(DWORD(MF_SOURCE_READER_FIRST_AUDIO_STREAM), mediaType.GetAddressOf());
44 m_sourceReader->SetStreamSelection(DWORD(MF_SOURCE_READER_FIRST_AUDIO_STREAM), TRUE);
52 m_sourceReader->ReadSample(MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, NULL, NULL, NULL, NULL);
60 if (
riid == IID_IMFSourceReaderCallback) {
61 *ppvObject =
static_cast<IMFSourceReaderCallback*
>(
this);
62 }
else if (
riid == IID_IUnknown) {
63 *ppvObject =
static_cast<IUnknown*
>(
this);
74 return InterlockedIncrement(&m_cRef);
79 LONG cRef = InterlockedDecrement(&m_cRef);
88 DWORD dwStreamFlags, LONGLONG llTimestamp, IMFSample *pSample)
95 }
else if ((dwStreamFlags & MF_SOURCE_READERF_ENDOFSTREAM) == MF_SOURCE_READERF_ENDOFSTREAM) {
103#include "moc_mfdecodersourcereader_p.cpp"
ComPtr< IMFMediaType > setSource(IMFMediaSource *source, QAudioFormat::SampleFormat)
STDMETHODIMP OnReadSample(HRESULT hrStatus, DWORD dwStreamIndex, DWORD dwStreamFlags, LONGLONG llTimestamp, IMFSample *pSample) override
STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject) override
void newSample(ComPtr< IMFSample >)
void deleteLater()
\threadsafe
STDMETHODIMP_(ULONG) MFDecoderSourceReader
Combined button and popup list for selecting options.
GLsizei GLsizei GLchar * source
IUIViewSettingsInterop __RPC__in REFIID riid