File indexing completed on 2025-01-05 03:57:27
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-01-14 0007 * Description : QtAVPlayer audio integration class. 0008 * 0009 * SPDX-FileCopyrightText: 2023-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_DAUDIO_PLAYER_H 0016 #define DIGIKAM_DAUDIO_PLAYER_H 0017 0018 // Qt includes 0019 0020 #include <QObject> 0021 #include <QUrl> 0022 0023 // QtAVPlayer includes 0024 0025 #include "qavplayer.h" 0026 #include "qavaudioframe.h" 0027 #include "qavaudiooutput.h" 0028 0029 // Local includes 0030 0031 #include "digikam_export.h" 0032 0033 namespace Digikam 0034 { 0035 0036 /** 0037 * A simple audio only player to render soundtracks.based on QtAVPlayer API. 0038 */ 0039 class DIGIKAM_EXPORT DAudioPlayer : public QObject 0040 { 0041 Q_OBJECT 0042 0043 public: 0044 0045 explicit DAudioPlayer(QObject* const parent); 0046 ~DAudioPlayer(); 0047 0048 QAVPlayer* player() const; 0049 QAVAudioOutput* audioOutput() const; 0050 0051 /** 0052 * This functions prevent to change codes in QtAVPlayer to export synbols. 0053 * all is delegate to this class, as it mostly used in plugins. 0054 */ 0055 void pause(); 0056 void play(); 0057 void stop(); 0058 void setSource(const QUrl&); 0059 qint64 position() const; 0060 qint64 duration() const; 0061 void setVolume(qreal v); 0062 QAVPlayer::State state() const; 0063 QAVPlayer::MediaStatus mediaStatus() const; 0064 0065 Q_SIGNALS: 0066 0067 void positionChanged(qint64); 0068 0069 private Q_SLOTS: 0070 0071 void slotAudioFrame(const QAVAudioFrame& frame); 0072 0073 private: 0074 0075 class Private; 0076 Private* const d; 0077 }; 0078 0079 } // namespace Digikam 0080 0081 #endif // DIGIKAM_DAUDIO_PLAYER_H