Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
mfstream_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef MFSTREAM_H
5#define MFSTREAM_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qcoreevent.h>
19#include <QtCore/qiodevice.h>
20#include <QtCore/qmutex.h>
21#include <QtCore/qpointer.h>
22
23#include <QtCore/private/qcomobject_p.h>
24#include <QtCore/private/qcomptr_p.h>
25
26#include <mfapi.h>
27#include <mfidl.h>
28
30
31class MFStream : public QObject, public QComObjectWithDeleteLater<MFStream, IMFByteStream>
32{
33 Q_OBJECT
34public:
35 MFStream(QIODevice *stream, bool ownStream, bool synchronous = false);
36
37 ~MFStream();
38
39 //from IMFByteStream
40 STDMETHODIMP GetCapabilities(DWORD *pdwCapabilities) override;
41
42 STDMETHODIMP GetLength(QWORD *pqwLength) override;
43
44 STDMETHODIMP SetLength(QWORD) override;
45
46 STDMETHODIMP GetCurrentPosition(QWORD *pqwPosition) override;
47
48 STDMETHODIMP SetCurrentPosition(QWORD qwPosition) override;
49
50 STDMETHODIMP IsEndOfStream(BOOL *pfEndOfStream) override;
51
52 STDMETHODIMP Read(BYTE *pb, ULONG cb, ULONG *pcbRead) override;
53
54 STDMETHODIMP BeginRead(BYTE *pb, ULONG cb, IMFAsyncCallback *pCallback,
55 IUnknown *punkState) override;
56
57 STDMETHODIMP EndRead(IMFAsyncResult* pResult, ULONG *pcbRead) override;
58
59 STDMETHODIMP Write(const BYTE *, ULONG, ULONG *) override;
60
61 STDMETHODIMP BeginWrite(const BYTE *, ULONG ,
62 IMFAsyncCallback *,
63 IUnknown *) override;
64
65 STDMETHODIMP EndWrite(IMFAsyncResult *,
66 ULONG *) override;
67
68 STDMETHODIMP Seek(
69 MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
70 LONGLONG llSeekOffset,
71 DWORD,
72 QWORD *pqwCurrentPosition) override;
73
74 STDMETHODIMP Flush() override;
75
76 STDMETHODIMP Close() override;
77
78private:
79 class AsyncReadState : public QComObject<IUnknown>
80 {
81 public:
82 AsyncReadState(BYTE *pb, ULONG cb);
83
84 BYTE* pb() const;
85 ULONG cb() const;
86 ULONG bytesRead() const;
87
88 void setBytesRead(ULONG cbRead);
89
90 private:
91 BYTE *m_pb;
92 ULONG m_cb;
93 ULONG m_cbRead;
94 };
95
96 QPointer<QIODevice> m_stream;
97 bool m_ownStream;
98 bool m_synchronous;
99 DWORD m_workQueueId;
100 QMutex m_mutex;
101
102 void doRead();
103 ULONG m_syncReadCount = 0;
104
105protected:
106 void customEvent(QEvent *event) override;
107 ComPtr<IMFAsyncResult> m_currentReadResult;
108};
109
110QT_END_NAMESPACE
111
112#endif
bool canReadQrc() const override
void setAudioFormat(const QAudioFormat &format) override
bool bufferAvailable() const override
QUrl source() const override
void setSourceDevice(QIODevice *device) override
QAudioFormat audioFormat() const override
QAudioBuffer read() override
void setSource(const QUrl &fileName) override
QIODevice * sourceDevice() const override
q23::expected< QPlatformVideoSink *, QString > createVideoSink(QVideoSink *sink) override
QPlatformMediaFormatInfo * createFormatInfo() override
q23::expected< QPlatformAudioDecoder *, QString > createAudioDecoder(QAudioDecoder *decoder) override
q23::expected< QPlatformCamera *, QString > createCamera(QCamera *camera) override
q23::expected< QPlatformImageCapture *, QString > createImageCapture(QImageCapture *imageCapture) override
QPlatformVideoDevices * createVideoDevices() override
q23::expected< QPlatformMediaRecorder *, QString > createRecorder(QMediaRecorder *recorder) override
q23::expected< QPlatformMediaPlayer *, QString > createPlayer(QMediaPlayer *parent) override
q23::expected< QPlatformMediaCaptureSession *, QString > createCaptureSession() override
ComPtr< IMFMediaSource > mediaSource() const
void mediaSourceReady()
void load(const QUrl &url, QIODevice *stream)
Combined button and popup list for selecting options.