forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from daschuer/1.12-shoutcast-fixes
Add missing file for 'src/engine/sidechain/networkstreamworker.h'
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |