Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009-2013 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef QMMPAUDIOENGINE_P_H 00022 #define QMMPAUDIOENGINE_P_H 00023 00024 #include <QQueue> 00025 #include <QHash> 00026 #include "abstractengine.h" 00027 #include "audioparameters.h" 00028 00029 class QIODevice; 00030 class OutputWriter; 00031 class Effect; 00032 class DecoderFactory; 00033 class StateHandler; 00034 class Decoder; 00035 class InputSource; 00036 class EffectFactory; 00037 class ReplayGain; 00038 class QmmpSettings; 00039 00043 class QmmpAudioEngine : public AbstractEngine 00044 { 00045 Q_OBJECT 00046 public: 00047 QmmpAudioEngine(QObject *parent); 00048 ~QmmpAudioEngine(); 00049 00050 bool play(); 00051 bool enqueue(InputSource *source); 00052 void seek(qint64 time); 00053 void stop(); 00054 void pause(); 00055 void setMuted(bool muted); 00056 void addEffect(EffectFactory *factory); 00057 void removeEffect(EffectFactory *factory); 00058 00059 static QmmpAudioEngine *instance(); 00060 00061 private slots: 00062 void finish(); 00063 void updateReplayGainSettings(); 00064 00065 private: 00066 void run(); 00067 void reset(); 00068 void clearDecoders(); 00069 void flush(bool = false); 00070 void addOffset(); 00071 qint64 produceSound(char *data, qint64 size, quint32 brate); 00072 void sendMetaData(); 00073 OutputWriter *createOutput(); 00074 void prepareEffects(Decoder *d); 00075 00076 DecoderFactory *m_factory; 00077 QList <Effect*> m_effects; 00078 QList <Effect*> m_blockedEffects; 00079 OutputWriter *m_output; 00080 00081 bool m_done, m_finish, m_user_stop; 00082 uint m_bks; 00083 qint64 m_seekTime; 00084 qint64 m_output_at, m_output_size; 00085 int m_bitrate; 00086 unsigned char *m_output_buf; 00087 Decoder *m_decoder; 00088 QQueue <Decoder*> m_decoders; 00089 QHash <Decoder*, InputSource*> m_inputs; 00090 AudioParameters m_ap; 00091 bool m_next; 00092 bool m_muted; 00093 static QmmpAudioEngine *m_instance; 00094 ReplayGain *m_replayGain; 00095 QmmpSettings *m_settings; 00096 }; 00097 00098 #endif // QMMPAUDIOENGINE_P_H