33    qCDebug(qLcAppSrc) << 
"~QGstAppSrc";
 
   44    auto *appSrc = GST_APP_SRC(m_appSrc.
element());
 
   45    GstAppSrcCallbacks m_callbacks;
 
   46    memset(&m_callbacks, 0, 
sizeof(GstAppSrcCallbacks));
 
   47    m_callbacks.need_data   = &QGstAppSrc::on_need_data;
 
   48    m_callbacks.enough_data = &QGstAppSrc::on_enough_data;
 
   49    m_callbacks.seek_data   = &QGstAppSrc::on_seek_data;
 
   50    gst_app_src_set_callbacks(appSrc, (GstAppSrcCallbacks*)&m_callbacks, 
this, 
nullptr);
 
   52    m_maxBytes = gst_app_src_get_max_bytes(appSrc);
 
   56        m_streamType = GST_APP_STREAM_TYPE_STREAM;
 
   58        m_streamType = GST_APP_STREAM_TYPE_RANDOM_ACCESS;
 
   59    gst_app_src_set_stream_type(appSrc, m_streamType);
 
   60    gst_app_src_set_size(appSrc, m_sequential ? -1 : m_stream->
size() - m_offset);
 
   62    m_networkReply = qobject_cast<QNetworkReply *>(m_stream);
 
   76    m_appSrc.
set(
"caps", caps);
 
   77    m_appSrc.
set(
"format", GST_FORMAT_TIME);
 
   93    m_dataRequestSize = 0;
 
  117    qCDebug(qLcAppSrc) << 
"write" << 
size << m_noMoreData << m_dataRequestSize;
 
  122    m_noMoreData = 
false;
 
  126void QGstAppSrc::onDataReady()
 
  132void QGstAppSrc::streamDestroyed()
 
  134    qCDebug(qLcAppSrc) << 
"stream destroyed";
 
  136    m_dataRequestSize = 0;
 
  141void QGstAppSrc::pushData()
 
  143    if (m_appSrc.
isNull() || !m_dataRequestSize || m_suspended) {
 
  144        qCDebug(qLcAppSrc) << 
"push data: return immediately" << m_appSrc.
isNull() << m_dataRequestSize << m_suspended;
 
  148    qCDebug(qLcAppSrc) << 
"pushData" << (m_stream ? m_stream : 
nullptr) << m_buffer.
size();
 
  149    if ((m_stream && m_stream->
atEnd())) {
 
  151        qCDebug(qLcAppSrc) << 
"end pushData" << (m_stream ? m_stream : 
nullptr) << m_buffer.
size();
 
  161    if (!m_dataRequestSize)
 
  162        m_dataRequestSize = m_maxBytes;
 
  164    qCDebug(qLcAppSrc) << 
"    reading" << 
size << 
"bytes" << 
size << m_dataRequestSize;
 
  166    GstBuffer* 
buffer = gst_buffer_new_and_alloc(
size);
 
  168    if (m_sequential || !m_stream)
 
  169        buffer->offset = bytesReadSoFar;
 
  177        GST_BUFFER_TIMESTAMP(
buffer) = gst_util_uint64_scale(streamedSamples, GST_SECOND, m_format.
sampleRate());
 
  178        GST_BUFFER_DURATION(
buffer) = gst_util_uint64_scale(nSamples, GST_SECOND, m_format.
sampleRate());
 
  179        streamedSamples += nSamples;
 
  183    gst_buffer_map(
buffer, &mapInfo, GST_MAP_WRITE);
 
  184    void* bufferData = mapInfo.data;
 
  188        bytesRead = m_stream->
read((
char*)bufferData, 
size);
 
  190        bytesRead = m_buffer.
read((
char*)bufferData, 
size);
 
  192    bytesReadSoFar += bytesRead;
 
  194    gst_buffer_unmap(
buffer, &mapInfo);
 
  195    qCDebug(qLcAppSrc) << 
"pushing bytes into gstreamer" << 
buffer->offset << bytesRead;
 
  196    if (bytesRead == 0) {
 
  199        qCDebug(qLcAppSrc) << 
"end pushData" << (m_stream ? m_stream : 
nullptr) << m_buffer.
size();
 
  202    m_noMoreData = 
false;
 
  205    GstFlowReturn 
ret = gst_app_src_push_buffer(GST_APP_SRC(m_appSrc.
element()), 
buffer);
 
  206    if (
ret == GST_FLOW_ERROR) {
 
  207        qWarning() << 
"QGstAppSrc: push buffer error";
 
  208    } 
else if (
ret == GST_FLOW_FLUSHING) {
 
  209        qWarning() << 
"QGstAppSrc: push buffer wrong state";
 
  211    qCDebug(qLcAppSrc) << 
"end pushData" << (m_stream ? m_stream : 
nullptr) << m_buffer.
size();
 
  223gboolean QGstAppSrc::on_seek_data(GstAppSrc *, guint64 arg0, gpointer userdata)
 
  226    if (arg0 == std::numeric_limits<quint64>::max())
 
  231    if (
self->m_sequential)
 
  238void QGstAppSrc::on_enough_data(GstAppSrc *, gpointer userdata)
 
  240    qCDebug(qLcAppSrc) << 
"on_enough_data";
 
  243    self->m_dataRequestSize = 0;
 
  246void QGstAppSrc::on_need_data(GstAppSrc *, guint arg0, gpointer userdata)
 
  248    qCDebug(qLcAppSrc) << 
"on_need_data requesting bytes" << arg0;
 
  251    self->m_dataRequestSize = arg0;
 
  253    qCDebug(qLcAppSrc) << 
"done on_need_data";
 
  256void QGstAppSrc::sendEOS()
 
  258    qCDebug(qLcAppSrc) << 
"sending EOS";
 
  262    gst_app_src_end_of_stream(GST_APP_SRC(m_appSrc.
element()));
 
  265void QGstAppSrc::eosOrIdle()
 
  267    qCDebug(qLcAppSrc) << 
"eosOrIdle";
 
  277    qCDebug(qLcAppSrc) << 
"    idle!";
 
  284#include "moc_qgstappsrc_p.cpp" 
void setAudioFormat(const QAudioFormat &f)
void setExternalAppSrc(const QGstElement &appsrc)
void bytesProcessed(int bytes)
bool setup(QIODevice *stream=nullptr, qint64 offset=0)
void write(const char *data, qsizetype size)
GstElement * element() const
bool setStateSync(GstState state)
void set(const char *property, const char *str)
\inmodule QtCore \reentrant
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from.
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success,...
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i....
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
Q_CORE_EXPORT void append(const char *data, qint64 size)
Q_CORE_EXPORT qint64 read(char *data, qint64 maxLength)
Q_MULTIMEDIA_EXPORT QGstCaps capsForAudioFormat(const QAudioFormat &format)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QString errorMessageCannotFindElement(std::string_view element)
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
#define Q_ARG(Type, data)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent