Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009-2016 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 class AudioConverter; 00040 class Dithering; 00041 00045 class QmmpAudioEngine : public AbstractEngine 00046 { 00047 Q_OBJECT 00048 public: 00049 QmmpAudioEngine(QObject *parent); 00050 ~QmmpAudioEngine(); 00051 00052 bool play(); 00053 bool enqueue(InputSource *source); 00054 void seek(qint64 time); 00055 void stop(); 00056 void pause(); 00057 void setMuted(bool muted); 00058 void addEffect(EffectFactory *factory); 00059 void removeEffect(EffectFactory *factory); 00060 00061 static QmmpAudioEngine *instance(); 00062 00063 private slots: 00064 void finish(); 00065 void updateReplayGainSettings(); 00066 void updateAudioSettings(); 00067 void updateEqSettings(); 00068 00069 private: 00070 void run(); 00071 void reset(); 00072 void clearDecoders(); 00073 void flush(bool = false); 00074 void addOffset(); 00075 qint64 produceSound(unsigned char *data, qint64 size, quint32 brate); 00076 void sendMetaData(); 00077 OutputWriter *createOutput(); 00078 void prepareEffects(Decoder *d); 00079 00080 DecoderFactory *m_factory; 00081 QList <Effect*> m_effects; 00082 QList <Effect*> m_blockedEffects; 00083 OutputWriter *m_output; 00084 00085 bool m_done, m_finish, m_user_stop; 00086 uint m_bks, m_sample_size; 00087 qint64 m_seekTime; 00088 quint64 m_output_at, m_output_size; 00089 int m_bitrate; 00090 unsigned char *m_output_buf; 00091 Decoder *m_decoder; 00092 QQueue <Decoder*> m_decoders; 00093 QHash <Decoder*, InputSource*> m_inputs; 00094 AudioParameters m_ap; 00095 bool m_next; 00096 bool m_muted; 00097 static QmmpAudioEngine *m_instance; 00098 ReplayGain *m_replayGain; 00099 QmmpSettings *m_settings; 00100 AudioConverter *m_converter; 00101 Dithering *m_dithering; 00102 }; 00103 00104 #endif // QMMPAUDIOENGINE_P_H