Qmmp
/usr/src/RPM/BUILD/qmmp-0.11-svn/src/qmmp/qmmpaudioengine_p.h
00001 /***************************************************************************
00002  *   Copyright (C) 2009-2017 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 <QSharedPointer>
00027 #include "abstractengine.h"
00028 #include "audioparameters.h"
00029 
00030 class QIODevice;
00031 class OutputWriter;
00032 class Effect;
00033 class DecoderFactory;
00034 class StateHandler;
00035 class Decoder;
00036 class InputSource;
00037 class EffectFactory;
00038 class ReplayGain;
00039 class QmmpSettings;
00040 class AudioConverter;
00041 class Dithering;
00042 
00046 class QmmpAudioEngine : public AbstractEngine
00047 {
00048 Q_OBJECT
00049 public:
00050     QmmpAudioEngine(QObject *parent);
00051     ~QmmpAudioEngine();
00052 
00053     bool play();
00054     bool enqueue(InputSource *source);
00055     void seek(qint64 time);
00056     void stop();
00057     void pause();
00058     void setMuted(bool muted);
00059     void addEffect(EffectFactory *factory);
00060     void removeEffect(EffectFactory *factory);
00061 
00062     static QmmpAudioEngine *instance();
00063 
00064 private slots:
00065     void finish();
00066     void updateReplayGainSettings();
00067     void updateAudioSettings();
00068     void updateEqSettings();
00069 
00070 private:
00071     void run();
00072     void reset();
00073     void clearDecoders();
00074     void flush(bool = false);
00075     void addOffset();
00076     qint64 produceSound(unsigned char *data, qint64 size, quint32 brate);
00077     void sendMetaData();
00078     OutputWriter *createOutput();
00079     void prepareEffects(Decoder *d);
00080 
00081     DecoderFactory *m_factory;
00082     QList <Effect*> m_effects;
00083     QList <Effect*> m_blockedEffects;
00084     OutputWriter *m_output;
00085 
00086     bool m_done, m_finish, m_user_stop;
00087     uint m_bks, m_sample_size;
00088     qint64 m_seekTime;
00089     quint64 m_output_at, m_output_size;
00090     int m_bitrate;
00091     unsigned char *m_output_buf;
00092     Decoder *m_decoder;
00093     QQueue <Decoder*> m_decoders;
00094     QHash <Decoder*, InputSource*> m_inputs;
00095     AudioParameters m_ap;
00096     bool m_next;
00097     bool m_muted;
00098     QSharedPointer<QMap<Qmmp::MetaData, QString> > m_metaData;
00099     static QmmpAudioEngine *m_instance;
00100     ReplayGain *m_replayGain;
00101     QmmpSettings *m_settings;
00102     AudioConverter *m_converter;
00103     Dithering *m_dithering;
00104 };
00105 
00106 #endif // QMMPAUDIOENGINE_P_H
 All Classes Functions Variables Enumerations Enumerator