blob: 25ce6501b0b3a49d9b477c1e891d4fa761f2132b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef AUDIODECODER_H
#define AUDIODECODER_H
#include <QAudioDecoder>
#include <QSoundEffect>
#include <QTextStream>
#include <QWaveDecoder>
class AudioDecoder : public QObject
{
Q_OBJECT
public:
AudioDecoder(bool isPlayback, bool isDelete, const QString &targetFileName);
~AudioDecoder();
void setSource(const QString &fileName);
void start();
void stop();
QAudioDecoder::Error getError();
void setTargetFilename(const QString &fileName);
signals:
void done();
public slots:
void bufferReady();
void error(QAudioDecoder::Error error);
void isDecodingChanged(bool isDecoding);
void finished();
void playbackStatusChanged();
void playingChanged();
private slots:
void updateProgress();
private:
bool m_isPlayback;
bool m_isDelete;
QAudioDecoder m_decoder;
QTextStream m_cout;
QString m_targetFilename;
QWaveDecoder *m_waveDecoder = nullptr;
QSoundEffect m_soundEffect;
qreal m_progress;
};
#endif // AUDIODECODER_H
|