![]() |
Mixxx
|
00001 /*************************************************************************** 00002 engineshoutcast.h - description 00003 ------------------- 00004 copyright : (C) 2007 by John Sully 00005 (C) 2007 by Albert Santoni 00006 (C) 2007 by Wesley Stessens 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef ENGINESHOUTCAST_H 00019 #define ENGINESHOUTCAST_H 00020 00021 #include <QObject> 00022 #include <QMutex> 00023 #include <QMessageBox> 00024 00025 #include <shout/shout.h> 00026 00027 #include "engineabstractrecord.h" 00028 #include "configobject.h" 00029 #include "controlobject.h" 00030 #include "controlobjectthreadmain.h" 00031 #include "trackinfoobject.h" 00032 #include "errordialoghandler.h" 00033 #include "recording/encoder.h" 00034 00035 class EncoderVorbis; 00036 00037 class EngineShoutcast : public EngineAbstractRecord { 00038 Q_OBJECT 00039 public: 00040 EngineShoutcast(ConfigObject<ConfigValue> *_config); 00041 virtual ~EngineShoutcast(); 00042 00043 void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); 00045 void write(unsigned char *header, unsigned char *body, 00046 int headerLen, int bodyLen); 00048 bool serverConnect(); 00049 bool serverDisconnect(); 00050 bool isConnected(); 00051 void shutdown() { 00052 m_bQuit = true; 00053 } 00054 public slots: 00056 void updateFromPreferences(); 00057 // static void wrapper2writePage(); 00058 //private slots: 00059 // void writePage(unsigned char *header, unsigned char *body, 00060 // int headerLen, int bodyLen, int count); 00061 private: 00062 int getActiveTracks(); 00063 bool metaDataHasChanged(); 00064 void updateMetaData(); 00065 00066 TrackPointer m_pMetaData; 00067 shout_t *m_pShout; 00068 shout_metadata_t *m_pShoutMetaData; 00069 int m_iMetaDataLife; 00070 long m_iShoutStatus; 00071 long m_iShoutFailures; 00072 ConfigObject<ConfigValue> *m_pConfig; 00073 Encoder *m_encoder; 00074 ControlObject* m_pShoutcastNeedUpdateFromPrefs; 00075 ControlObjectThreadMain* m_pUpdateShoutcastFromPrefs; 00076 ControlObjectThread* m_pMasterSamplerate; 00077 volatile bool m_bQuit; 00078 QMutex m_shoutMutex; 00080 bool m_custom_metadata; 00081 QByteArray m_baCustom_artist; 00082 QByteArray m_baCustom_title; 00083 QByteArray m_baFormat; 00084 /* Standard error dialog */ 00085 void errorDialog(QString text, QString detailedError); 00087 bool m_firstCall; 00088 }; 00089 00090 #endif