mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 07:24:07 +00:00
fb71eb4ce1
When the current audio player instance changes, the destroyed player's playback must be stopped for consistency between implementations and to avoid surprises. Note that this residual playback could be stopped only by switching back to the Ffmpeg player or by exiting the application.
47 lines
856 B
C++
47 lines
856 B
C++
/* This file is (c) 2018 Igor Kushnir <igorkuo@gmail.com>
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
#ifndef FFMPEGAUDIOPLAYER_HH_INCLUDED
|
|
#define FFMPEGAUDIOPLAYER_HH_INCLUDED
|
|
|
|
#include "audioplayerinterface.hh"
|
|
#include "ffmpegaudio.hh"
|
|
|
|
#ifdef MAKE_FFMPEG_PLAYER
|
|
|
|
namespace Ffmpeg
|
|
{
|
|
|
|
class AudioPlayer : public AudioPlayerInterface
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
AudioPlayer()
|
|
{
|
|
connect( &AudioService::instance(), SIGNAL( error( QString ) ),
|
|
this, SIGNAL( error( QString ) ) );
|
|
}
|
|
|
|
~AudioPlayer()
|
|
{
|
|
stop();
|
|
}
|
|
|
|
virtual QString play( const char * data, int size )
|
|
{
|
|
AudioService::instance().playMemory( data, size );
|
|
return QString();
|
|
}
|
|
|
|
virtual void stop()
|
|
{
|
|
AudioService::instance().stop();
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif // MAKE_FFMPEG_PLAYER
|
|
|
|
#endif // FFMPEGAUDIOPLAYER_HH_INCLUDED
|