1 /* This file is (c) 2018 Igor Kushnir <igorkuo@gmail.com>
2  * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
3 
4 #ifndef FFMPEGAUDIOPLAYER_HH_INCLUDED
5 #define FFMPEGAUDIOPLAYER_HH_INCLUDED
6 
7 #include "audioplayerinterface.hh"
8 #include "ffmpegaudio.hh"
9 
10 #ifdef MAKE_FFMPEG_PLAYER
11 
12 namespace Ffmpeg
13 {
14 
15 class AudioPlayer : public AudioPlayerInterface
16 {
17   Q_OBJECT
18 public:
AudioPlayer()19   AudioPlayer()
20   {
21     connect( &AudioService::instance(), SIGNAL( error( QString ) ),
22              this, SIGNAL( error( QString ) ) );
23   }
24 
~AudioPlayer()25   ~AudioPlayer()
26   {
27     stop();
28   }
29 
play(const char * data,int size)30   virtual QString play( const char * data, int size )
31   {
32     AudioService::instance().playMemory( data, size );
33     return QString();
34   }
35 
stop()36   virtual void stop()
37   {
38     AudioService::instance().stop();
39   }
40 };
41 
42 }
43 
44 #endif // MAKE_FFMPEG_PLAYER
45 
46 #endif // FFMPEGAUDIOPLAYER_HH_INCLUDED
47