|
Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2012-2017 by Ilya Kotov * 00003 * forkotov02@ya.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 OUTPUTWRITER_P_H 00022 #define OUTPUTWRITER_P_H 00023 00024 #include <QThread> 00025 #include <QMutex> 00026 #include "recycler_p.h" 00027 #include "audioparameters.h" 00028 #include "channelmap.h" 00029 00030 class QTimer; 00031 class QmmpSettings; 00032 class StateHandler; 00033 class Output; 00034 class Effect; 00035 class AudioConverter; 00036 class ChannelConverter; 00037 00042 class OutputWriter : public QThread 00043 { 00044 Q_OBJECT 00045 public: 00046 explicit OutputWriter(QObject *parent = 0); 00047 00048 virtual ~OutputWriter(); 00055 bool initialize(quint32 freq, ChannelMap map); 00059 void pause(); 00063 void stop(); 00068 void setMuted(bool muted); 00072 void finish(); 00078 void seek(qint64 pos, bool reset = false); 00082 Recycler *recycler(); 00086 QMutex *mutex(); 00090 AudioParameters audioParameters() const; 00094 quint32 sampleRate(); 00098 int channels(); 00102 Qmmp::AudioFormat format() const; 00103 const ChannelMap channelMap() const; 00107 int sampleSize() const; 00108 void updateEqSettings(); 00109 00110 private: 00111 void run(); //thread run function 00112 void status(); 00113 void dispatch(qint64 elapsed, int bitrate); 00114 void dispatch(const Qmmp::State &state); 00115 void dispatch(const AudioParameters &p); 00116 void dispatchVisual(Buffer *buffer); 00117 bool prepareConverters(); 00118 void startVisualization(); 00119 void stopVisualization(); 00120 00121 bool m_skip; 00122 QMutex m_mutex; 00123 Recycler m_recycler; 00124 StateHandler *m_handler; 00125 quint32 m_frequency; 00126 int m_channels, m_kbps; 00127 ChannelMap m_chan_map; 00128 Qmmp::AudioFormat m_format; 00129 qint64 m_bytesPerMillisecond; 00130 bool m_user_stop, m_pause; 00131 bool m_prev_pause; 00132 bool m_finish; 00133 bool m_useEq; 00134 qint64 m_totalWritten, m_currentMilliseconds; 00135 QmmpSettings *m_settings; 00136 Output *m_output; 00137 bool m_muted; 00138 AudioParameters m_in_params; 00139 AudioConverter *m_format_converter; 00140 ChannelConverter *m_channel_converter; 00141 unsigned char *m_output_buf; 00142 size_t m_output_size; //samples 00143 }; 00144 00145 #endif // OUTPUTWRITER_P_H
1.7.6.1