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
qqnxaudiosink_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Research In Motion
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 QNXAUDIOOUTPUT_H
5#define QNXAUDIOOUTPUT_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/qaudiosystem_p.h"
19
21
22#include <QElapsedTimer>
23#include <QTimer>
24#include <QIODevice>
25#include <QSocketNotifier>
26
27#include <sys/asoundlib.h>
28#include <sys/neutrino.h>
29
31
32class QnxPushIODevice;
33
35{
37
38public:
41
42 void start(QIODevice *source) override;
43 QIODevice *start() override;
44 void stop() override;
45 void reset() override;
46 void suspend() override;
47 void resume() override;
48 qsizetype bytesFree() const override;
49 void setBufferSize(qsizetype) override;
50 qsizetype bufferSize() const override;
51 qint64 processedUSecs() const override;
52 QAudio::State state() const override;
53 qint64 pushData(const char *data, qint64 len);
54
55private slots:
56 void pullData();
57 void pcmNotifierActivated(int socket);
58
59private:
60 bool open();
61 void close();
62 void changeState(QAudio::State state, QAudio::Error error);
63
64 void addPcmEventFilter();
65 void createPcmNotifiers();
66 void destroyPcmNotifiers();
67
68 void suspendInternal(QAudio::State suspendState);
69 void resumeInternal();
70
71 void updateState();
72
73 qint64 write(const char *data, qint64 len);
74
75 QIODevice *m_source;
76 bool m_pushSource;
77 QTimer *m_timer;
78
79 QAudio::State m_state;
80 QAudio::State m_suspendedInState;
81 int m_periodSize;
82
83 QnxAudioUtils::HandleUniquePtr m_pcmHandle;
84 qint64 m_bytesWritten;
85
86 int m_requestedBufferSize;
87
88 QSocketNotifier *m_pcmNotifier;
89};
90
92{
94public:
97
98 qint64 readData(char *data, qint64 len);
99 qint64 writeData(const char *data, qint64 len);
100
101 bool isSequential() const override;
102
103private:
104 QQnxAudioSink *m_output;
105};
106
107QT_END_NAMESPACE
108
109#endif
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
qint64 writeData(const char *data, qint64 len) override
Writes up to maxSize bytes from data to the device.
qint64 readData(char *data, qint64 len) override
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
\inmodule QtCore
Definition qdir.h:22
QPlatformAudioSink * createAudioSink(const QAudioDevice &, const QAudioFormat &, QObject *parent) override
QList< QAudioDevice > findAudioInputs() const override
QList< QAudioDevice > findAudioOutputs() const override
QPlatformAudioSource * createAudioSource(const QAudioDevice &, const QAudioFormat &, QObject *parent) override
QLatin1String backendName() const override
QAudio::State state() const override
qint64 pushData(const char *data, qint64 len)
void setBufferSize(qsizetype) override
void reset() override
qsizetype bufferSize() const override
qsizetype bytesFree() const override
QIODevice * start() override
void resume() override
void stop() override
void suspend() override
void start(QIODevice *source) override
qint64 processedUSecs() const override
void suspend() override
qsizetype bytesReady() const override
QAudio::State state() const override
QIODevice * start() override
void resume() override
void setBufferSize(qsizetype) override
void stop() override
qsizetype bufferSize() const override
void reset() override
qint64 processedUSecs() const override
void start(QIODevice *) override
qint64 writeData(const char *data, qint64 len)
Writes up to maxSize bytes from data to the device.
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
qint64 readData(char *data, qint64 len)
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
State
Definition qaudio.h:31
Error
Definition qaudio.h:23
std::unique_ptr< snd_pcm_t, HandleDeleter > HandleUniquePtr
static QT_BEGIN_NAMESPACE QList< QAudioDevice > enumeratePcmDevices(QAudioDevice::Mode mode)