00001
00002
00003
00004
00005
00006
00007
#ifndef __WVSYNCSTREAM_H
00008
#define __WVSYNCSTREAM_H
00009
00010
#ifndef _WIN32
00011
#include <sys/time.h>
00012
#endif
00013
#include <time.h>
00014
#include "wvstream.h"
00015
#include "wvstreamclone.h"
00016
00017
00018
00019
00020
00021
00022 class WvSyncStream :
public WvStreamClone
00023 {
00024 size_t bps;
00025 size_t avgchunk;
00026 size_t maxchunk;
00027 size_t availchunk;
00028 size_t usedchunk;
00029 size_t lowater, hiwater;
00030
bool waiting;
00031
00032
struct timeval reference;
00033
00034
public:
00035
00036
00037
00038
00039
00040
00041
00042
00043
WvSyncStream(
WvStream *cloned, size_t bps,
00044 size_t avgchunk, size_t maxchunk);
00045
virtual ~WvSyncStream();
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
WvSyncStream(
WvStream *cloned,
bool owner,
int srate,
int bits,
00058
int msec = 10);
00059
00060
virtual size_t
uread(
void *buf, size_t count);
00061
virtual bool pre_select(SelectInfo &si);
00062
virtual bool post_select(SelectInfo &si);
00063
00064
private:
00065
void init(size_t _bps, size_t _avgchunk, size_t _maxchunk);
00066
00067
00068
void poll();
00069
00070
void resettimer();
00071 };
00072
00073
#endif // __WVSYNCSTREAM_H