File indexing completed on 2025-01-19 03:57:03

0001 /*********************************************************
0002  * Copyright (C) 2020, Val Doroshchuk <valbok@gmail.com> *
0003  *                                                       *
0004  * This file is part of QtAVPlayer.                      *
0005  * Free Qt Media Player based on FFmpeg.                 *
0006  *********************************************************/
0007 
0008 #ifndef QAVAUDIOOUTPUT_H
0009 #define QAVAUDIOOUTPUT_H
0010 
0011 #include <QtAVPlayer/qavaudioframe.h>
0012 #include <QtAVPlayer/qtavplayerglobal.h>
0013 #include <QAudioFormat>
0014 #include <QObject>
0015 #include <memory>
0016 
0017 QT_BEGIN_NAMESPACE
0018 
0019 class QAVAudioOutputPrivate;
0020 class QAVAudioOutput : public QObject
0021 {
0022 public:
0023     QAVAudioOutput(QObject *parent = nullptr);
0024     ~QAVAudioOutput();
0025 
0026     void setVolume(qreal v);
0027     qreal volume() const;
0028     void setBufferSize(int bytes);
0029     int bufferSize() const;
0030 #if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
0031     void setChannelConfig(QAudioFormat::ChannelConfig);
0032     QAudioFormat::ChannelConfig channelConfig() const;
0033 #endif
0034 
0035     bool play(const QAVAudioFrame &frame);
0036 
0037 protected:
0038     std::unique_ptr<QAVAudioOutputPrivate> d_ptr;
0039 
0040 private:
0041     Q_DISABLE_COPY(QAVAudioOutput)
0042     Q_DECLARE_PRIVATE(QAVAudioOutput)
0043 };
0044 
0045 QT_END_NAMESPACE
0046 
0047 #endif