Skip to content

Commit

Permalink
Merge pull request #7 from daschuer/1.12-shoutcast-fixes
Browse files Browse the repository at this point in the history
Add missing file for 'src/engine/sidechain/networkstreamworker.h'
  • Loading branch information
illuusio committed Sep 29, 2015
2 parents 2ea06af + 59bd2b0 commit 1b5104f
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions src/engine/sidechain/networkstreamworker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#ifndef NETWORKSTREAMWORKER_H
#define NETWORKSTREAMWORKER_H

#include "util/types.h"
#include "util/fifo.h"

/*
* States:
* Error Something errornous has happened and can't go on
* New First state before init
* Init Initing state don't feed anything in this state
* Waiting Waiting something not ready yet
* Busy Is busy doing something can't process anything new
* Ready Functioning ok
* Reading Reading something and can't do anything else
* Writing Writing something and can't do anything else
* Connected Is connected to storage or server
* Connecting Trying to connect storage or server
* Disconnected Ain't connected to storage or server
*
* First state should be NETWORKSTREAMWORKER_STATE_UNKNOWN and
* if state handling ain't supported by NetworkStreamWorker-class
* then 'NETWORKSTREAMWORKER_STATE_NEW' should be treated as
* NETWORKSTREAMWORKER_STATE_READY. Newly written SideChainWorker-class
* should support state handling at least this NETWORKSTREAMWORKER_STATE_READY state.
*/

enum NetworkStreamWorkerStates {
NETWORKSTREAMWORKER_STATE_ERROR = -1,
NETWORKSTREAMWORKER_STATE_NEW,
NETWORKSTREAMWORKER_STATE_INIT,
NETWORKSTREAMWORKER_STATE_WAITING,
NETWORKSTREAMWORKER_STATE_BUSY,
NETWORKSTREAMWORKER_STATE_READY,
NETWORKSTREAMWORKER_STATE_READING,
NETWORKSTREAMWORKER_STATE_WRITING,
NETWORKSTREAMWORKER_STATE_CONNECTED,
NETWORKSTREAMWORKER_STATE_CONNECTING,
NETWORKSTREAMWORKER_STATE_DISCONNECTED
};

class NetworkStreamWorker {
public:
NetworkStreamWorker()
: m_networkStreamWorkerState(NETWORKSTREAMWORKER_STATE_NEW) {
}
virtual ~NetworkStreamWorker() { }
virtual void process(const CSAMPLE* pBuffer, const int iBufferSize) = 0;
virtual void shutdown() = 0;
virtual void outputAvailable() {
};
virtual void setOutputFifo(FIFO<CSAMPLE>* pOutputFifo) {
Q_UNUSED(pOutputFifo);
};
virtual bool threadWaiting() {
return false;
}
virtual int getState() {
return m_networkStreamWorkerState;
}
protected:
virtual void setState(int state) {
m_networkStreamWorkerState = state;
}
private:
int m_networkStreamWorkerState;
};

#endif /* NETWORKSTREAMWORKER_H */

0 comments on commit 1b5104f

Please sign in to comment.