2018-03-29 17:00:53 +00:00
|
|
|
/* This file is (c) 2018 Igor Kushnir <igorkuo@gmail.com>
|
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef MULTIMEDIAAUDIOPLAYER_HH_INCLUDED
|
|
|
|
#define MULTIMEDIAAUDIOPLAYER_HH_INCLUDED
|
|
|
|
|
|
|
|
#ifdef MAKE_QTMULTIMEDIA_PLAYER
|
|
|
|
|
|
|
|
#include <QBuffer>
|
|
|
|
#include <QMediaPlayer>
|
|
|
|
#include "audioplayerinterface.hh"
|
2022-02-27 05:17:37 +00:00
|
|
|
#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
|
|
|
|
#include <QAudioOutput>
|
|
|
|
#endif
|
2023-02-13 01:23:13 +00:00
|
|
|
#include <QPointer>
|
2023-07-20 08:02:22 +00:00
|
|
|
|
2018-03-29 17:00:53 +00:00
|
|
|
class MultimediaAudioPlayer: public AudioPlayerInterface
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-07-20 08:02:22 +00:00
|
|
|
|
2018-03-29 17:00:53 +00:00
|
|
|
public:
|
|
|
|
MultimediaAudioPlayer();
|
|
|
|
|
|
|
|
virtual QString play( const char * data, int size );
|
|
|
|
virtual void stop();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onMediaPlayerError();
|
|
|
|
|
|
|
|
private:
|
2023-02-13 01:23:13 +00:00
|
|
|
QPointer< QBuffer > audioBuffer;
|
2018-03-29 17:00:53 +00:00
|
|
|
QMediaPlayer player; ///< Depends on audioBuffer.
|
2022-02-27 05:17:37 +00:00
|
|
|
#if ( QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) )
|
|
|
|
QAudioOutput audioOutput;
|
|
|
|
#endif
|
2018-03-29 17:00:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAKE_QTMULTIMEDIA_PLAYER
|
|
|
|
|
|
|
|
#endif // MULTIMEDIAAUDIOPLAYER_HH_INCLUDED
|