Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgstreameraudiodecoder_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 QGSTREAMERAUDIODECODERCONTROL_H
5#define QGSTREAMERAUDIODECODERCONTROL_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 <QtMultimedia/private/qmultimediautils_p.h>
19#include <QtMultimedia/private/qplatformaudiodecoder_p.h>
20#include <QtMultimedia/private/qtmultimediaglobal_p.h>
21#include <QtMultimedia/qaudiodecoder.h>
22#include <QtCore/qobject.h>
23#include <QtCore/qmutex.h>
24#include <QtCore/qurl.h>
25
27#include <common/qgst_p.h>
28
29#if QT_CONFIG(gstreamer_app)
31#endif
32
33#include <gst/app/gstappsink.h>
34
36
38
40{
42
43public:
44 static QMaybe<QPlatformAudioDecoder *> create(QAudioDecoder *parent);
46
47 QUrl source() const override;
48 void setSource(const QUrl &fileName) override;
49
50 QIODevice *sourceDevice() const override;
51 void setSourceDevice(QIODevice *device) override;
52
53 void start() override;
54 void stop() override;
55
56 QAudioFormat audioFormat() const override;
57 void setAudioFormat(const QAudioFormat &format) override;
58
59 QAudioBuffer read() override;
60
61 qint64 position() const override;
62 qint64 duration() const override;
63
64 // GStreamerBusMessageFilter interface
65 bool processBusMessage(const QGstreamerMessage &message) override;
66
67private slots:
68 void updateDuration();
69
70private:
72
73#if QT_CONFIG(gstreamer_app)
74 static GstFlowReturn new_sample(GstAppSink *sink, gpointer user_data);
75 GstFlowReturn newSample(GstAppSink *sink);
76
77 static void configureAppSrcElement(GObject *, GObject *, GParamSpec *,
79#endif
80
81 void setAudioFlags(bool wantNativeAudio);
82 void addAppSink();
83 void removeAppSink();
84
85 bool handlePlaybinMessage(const QGstreamerMessage &);
86
87 void processInvalidMedia(QAudioDecoder::Error errorCode, const QString &errorString);
88 static qint64 getPositionFromBuffer(GstBuffer* buffer);
89
90 QGstPipeline m_playbin;
91 QGstBin m_outputBin;
92 QGstElement m_audioConvert;
93 QGstAppSink m_appSink;
94 QGstAppSource *m_appSrc = nullptr;
95
96 QUrl mSource;
97 QIODevice *mDevice = nullptr;
98 QAudioFormat mFormat;
99
100 int m_buffersAvailable = 0;
101 qint64 m_position = -1;
102 qint64 m_duration = -1;
103
104 int m_durationQueries = 0;
105
106 qint32 m_currentSessionId{};
107
108 QGObjectHandlerScopedConnection m_deepNotifySourceConnection;
109};
110
112
113#endif // QGSTREAMERPLAYERSESSION_H
IOBluetoothDevice * device
\inmodule QtMultimedia
The QAudioDecoder class implements decoding audio.
Error
Defines a media player error condition.
The QAudioFormat class stores audio stream parameter information.
void setSourceDevice(QIODevice *device) override
QAudioFormat audioFormat() const override
QIODevice * sourceDevice() const override
void setSource(const QUrl &fileName) override
qint64 duration() const override
void setAudioFormat(const QAudioFormat &format) override
QAudioBuffer read() override
qint64 position() const override
bool processBusMessage(const QGstreamerMessage &message) override
\inmodule QtCore \reentrant
Definition qiodevice.h:34
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void * user_data
GLenum GLuint buffer
GLuint GLsizei const GLchar * message
GLint GLsizei GLsizei GLenum format
GLsizei GLenum GLboolean sink
#define Q_OBJECT
#define slots
int qint32
Definition qtypes.h:49
long long qint64
Definition qtypes.h:60
view create()