Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qgstappsrc_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 QGSTAPPSRC_H
5#define QGSTAPPSRC_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 <private/qtmultimediaglobal_p.h>
19#include <private/qmultimediautils_p.h>
20#include <qaudioformat.h>
21
22#include <QtCore/qobject.h>
23#include <QtCore/qiodevice.h>
24#include <QtCore/private/qringbuffer_p.h>
25#include <QtCore/qatomic.h>
26
27#include <qgst_p.h>
28#include <gst/app/gstappsrc.h>
29
31
32class QNetworkReply;
33
34class Q_MULTIMEDIA_EXPORT QGstAppSrc : public QObject
35{
37public:
40
41 bool setup(QIODevice *stream = nullptr, qint64 offset = 0);
42 void setAudioFormat(const QAudioFormat &f);
43
44 void setExternalAppSrc(const QGstElement &appsrc);
45 QGstElement element();
46
47 void write(const char *data, qsizetype size);
48
49 bool canAcceptMoreData() { return m_noMoreData || m_dataRequestSize != 0; }
50
51 void suspend() { m_suspended = true; }
52 void resume() { m_suspended = false; m_noMoreData = true; }
53
55 void bytesProcessed(int bytes);
56 void noMoreData();
57
58private Q_SLOTS:
59 void pushData();
60 bool doSeek(qint64);
61 void onDataReady();
62
63 void streamDestroyed();
64private:
66
67 bool setStream(QIODevice *, qint64 offset);
68 bool isStreamValid() const
69 {
70 return m_stream != nullptr && m_stream->isOpen();
71 }
72
73 static gboolean on_seek_data(GstAppSrc *element, guint64 arg0, gpointer userdata);
74 static void on_enough_data(GstAppSrc *element, gpointer userdata);
75 static void on_need_data(GstAppSrc *element, uint arg0, gpointer userdata);
76
77 void sendEOS();
78 void eosOrIdle();
79
80 QIODevice *m_stream = nullptr;
81 QNetworkReply *m_networkReply = nullptr;
82 QRingBuffer m_buffer;
83 QAudioFormat m_format;
84
85 QGstElement m_appSrc;
86 bool m_sequential = true;
87 bool m_suspended = false;
88 bool m_noMoreData = false;
89 GstAppStreamType m_streamType = GST_APP_STREAM_TYPE_RANDOM_ACCESS;
90 qint64 m_offset = 0;
91 qint64 m_maxBytes = 0;
92 qint64 bytesReadSoFar = 0;
93 QAtomicInteger<unsigned int> m_dataRequestSize = 0;
94 int streamedSamples = 0;
95};
96
98
99#endif
\inmodule QtCore
Definition qatomic.h:18
The QAudioFormat class stores audio stream parameter information.
bool canAcceptMoreData()
void suspend()
void bytesProcessed(int bytes)
void resume()
void noMoreData()
static QMaybe< QGstAppSrc * > create(QObject *parent=nullptr)
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
\inmodule QtCore
Definition qobject.h:90
Combined button and popup list for selecting options.
EGLStreamKHR stream
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat GLfloat f
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
long long qint64
Definition qtypes.h:55
gzip write("uncompressed data")
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent