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
qgstappsource_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#include <QtCore/qmutex.h>
27
28#include <common/qgst_p.h>
29#include <gst/app/gstappsrc.h>
30
32
33class QGstAppSource : public QObject
34{
36public:
37 static QMaybe<QGstAppSource *> create(QObject *parent = nullptr);
39
40 bool setup(QIODevice *stream = nullptr, qint64 offset = 0);
41 void setAudioFormat(const QAudioFormat &f);
42
43 void setExternalAppSrc(QGstAppSrc);
44 QGstElement element() const;
45
46 void write(const char *data, qsizetype size);
47
48 bool canAcceptMoreData() const;
49
50 void suspend();
51 void resume();
52
54 void bytesProcessed(int bytes);
55 void noMoreData();
56
57private Q_SLOTS:
58 void pushData();
59 bool doSeek(qint64);
60 void onDataReady();
61
62 void streamDestroyed();
63private:
64 QGstAppSource(QGstAppSrc appsrc, QObject *parent);
65
66 bool setStream(QIODevice *, qint64 offset);
67 bool isStreamValid() const;
68
69 static gboolean on_seek_data(GstAppSrc *element, guint64 arg0, gpointer userdata);
70 static void on_enough_data(GstAppSrc *element, gpointer userdata);
71 static void on_need_data(GstAppSrc *element, uint arg0, gpointer userdata);
72
73 void sendEOS();
74 void eosOrIdle();
75
76 mutable QMutex m_mutex;
77
78 QIODevice *m_stream = nullptr;
79 QRingBuffer m_buffer;
80 QAudioFormat m_format;
81
82 QGstAppSrc m_appSrc;
83 bool m_sequential = true;
84 bool m_suspended = false;
85 bool m_noMoreData = false;
86 GstAppStreamType m_streamType = GST_APP_STREAM_TYPE_RANDOM_ACCESS;
87 qint64 m_offset = 0;
88 qint64 m_maxBytes = 0;
89 qint64 bytesReadSoFar = 0;
90 QAtomicInteger<unsigned int> m_dataRequestSize = 0;
91 int streamedSamples = 0;
92};
93
95
96#endif
The QAudioFormat class stores audio stream parameter information.
void bytesProcessed(int bytes)
bool setup(QIODevice *stream=nullptr, qint64 offset=0)
void setAudioFormat(const QAudioFormat &f)
static QMaybe< QGstAppSource * > create(QObject *parent=nullptr)
QGstElement element() const
void noMoreData()
void write(const char *data, qsizetype size)
void setExternalAppSrc(QGstAppSrc)
bool canAcceptMoreData() const
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
Combined button and popup list for selecting options.
EGLStreamKHR stream
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum GLuint GLintptr offset
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
long long qint64
Definition qtypes.h:60