00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <Alloc.hh>
00024 #include <Condition.hh>
00025 #include <Mutex.hh>
00026 #ifdef USE_RWLOCK
00027 #include <RWLock.hh>
00028 #endif
00029 #ifdef USE_FLAC
00030 #include <FLAC/all.h>
00031 #endif
00032
00033 #include "Config.h"
00034 #include "LocalMsg.h"
00035 #include "CfgFile.hh"
00036 #include "LogFile.hh"
00037 #include "Messages.hh"
00038 #include "SockClie.hh"
00039 #include "SockOp.hh"
00040 #include "SockServ.hh"
00041
00042
00043 #ifndef STREAMDIST_HH
00044 #define STREAMDIST_HH
00045
00046 #define SD_LOGENTRY_SIZE 256
00047 #define SD_HOSTADDR_MAX 256
00048
00049
00055 class clStreamDist
00056 {
00057 volatile bool bRun;
00058 volatile int iFragmentSize;
00059 volatile int iAudioBufSize;
00060 volatile int iBlockCntr;
00061 stRawDataFirst sHdr;
00062 #ifdef USE_FLAC
00063 FLAC__StreamDecoder *spFLACDec;
00064 #endif
00065 clCfgFile Cfg;
00066 clAlloc AudioBuf;
00067 clMutex MtxAudio;
00068 #ifdef USE_RWLOCK
00069 clRWLock RWLAudio;
00070 #endif
00071 #ifdef USE_FLAC
00072 clSockOp *InSOp;
00073 #endif
00074 clCondition CndAudio;
00075 void CopyChannel (GDT *, const GDT *, int);
00076 bool InitCompress (int);
00077 public:
00078 clLogFile Log;
00079 clStreamDist ();
00080 ~clStreamDist ();
00081 int Main (int, char **);
00082 void *AudioInThread (void *);
00083 void *ServeClientThread (void *);
00084 void Stop () { bRun = false; }
00085 #ifdef USE_FLAC
00086 FLAC__StreamDecoderReadStatus FLACRead (
00087 const FLAC__StreamDecoder *, FLAC__byte *, unsigned *);
00088 FLAC__StreamDecoderWriteStatus FLACWrite (
00089 const FLAC__StreamDecoder *, const FLAC__Frame *,
00090 const FLAC__int32 * const *);
00091 void FLACMetaData (
00092 const FLAC__StreamDecoder *, const FLAC__StreamMetadata *);
00093 void FLACError (
00094 const FLAC__StreamDecoder *, FLAC__StreamDecoderErrorStatus);
00095 #endif
00096 };
00097
00098 #endif
00099