summaryrefslogtreecommitdiffstats
path: root/src/plugins/wmf/player/samplegrabber.h
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2016-10-07 15:34:53 +0300
committerYoann Lopes <yoann.lopes@qt.io>2016-11-02 13:41:47 +0000
commit9df63fd62e1932a7d650f8d99c2b92947a05a9f4 (patch)
tree1072a72f04b3412940c685c34a5197ec1c110d1f /src/plugins/wmf/player/samplegrabber.h
parent4e5eb169891fb52abe5683cb2d50f3ef280f1695 (diff)
WMF: make it possible to build only the audio decode service
The WMF plugin can now be built without the media player service. That enables the audio decode service even when DirectShow is used as media player backend. The default configuration on Windows is now: Camera, MediaPlayer -> DirectShow AudioDecode -> WMF Change-Id: Ic6f3c85ed849e0c603719cfb03794e6abd2d52fa Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/plugins/wmf/player/samplegrabber.h')
-rw-r--r--src/plugins/wmf/player/samplegrabber.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/plugins/wmf/player/samplegrabber.h b/src/plugins/wmf/player/samplegrabber.h
new file mode 100644
index 000000000..26bb32147
--- /dev/null
+++ b/src/plugins/wmf/player/samplegrabber.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SAMPLEGRABBER_H
+#define SAMPLEGRABBER_H
+
+#include <QtCore/qmutex.h>
+#include <QtCore/qlist.h>
+#include <QtMultimedia/qaudioformat.h>
+#include <mfapi.h>
+#include <mfidl.h>
+
+class MFAudioProbeControl;
+
+class SampleGrabberCallback : public IMFSampleGrabberSinkCallback
+{
+public:
+ // IUnknown methods
+ STDMETHODIMP QueryInterface(REFIID iid, void** ppv);
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+
+ // IMFClockStateSink methods
+ STDMETHODIMP OnClockStart(MFTIME hnsSystemTime, LONGLONG llClockStartOffset);
+ STDMETHODIMP OnClockStop(MFTIME hnsSystemTime);
+ STDMETHODIMP OnClockPause(MFTIME hnsSystemTime);
+ STDMETHODIMP OnClockRestart(MFTIME hnsSystemTime);
+ STDMETHODIMP OnClockSetRate(MFTIME hnsSystemTime, float flRate);
+
+ // IMFSampleGrabberSinkCallback methods
+ STDMETHODIMP OnSetPresentationClock(IMFPresentationClock* pClock);
+ STDMETHODIMP OnShutdown();
+
+protected:
+ SampleGrabberCallback() : m_cRef(1) {}
+
+public:
+ virtual ~SampleGrabberCallback() {}
+
+private:
+ long m_cRef;
+};
+
+class AudioSampleGrabberCallback: public SampleGrabberCallback {
+public:
+ void addProbe(MFAudioProbeControl* probe);
+ void removeProbe(MFAudioProbeControl* probe);
+ void setFormat(const QAudioFormat& format);
+
+ STDMETHODIMP OnProcessSample(REFGUID guidMajorMediaType, DWORD dwSampleFlags,
+ LONGLONG llSampleTime, LONGLONG llSampleDuration, const BYTE * pSampleBuffer,
+ DWORD dwSampleSize);
+
+private:
+ QList<MFAudioProbeControl*> m_audioProbes;
+ QMutex m_audioProbeMutex;
+ QAudioFormat m_format;
+};
+
+#endif // SAMPLEGRABBER_H