Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SOUND_AUXSTREAM_H
00021 #define SOUND_AUXSTREAM_H
00022
00023 #include "InputStream.h"
00024
00025 #include <boost/cstdint.hpp>
00026
00027 namespace gnash {
00028 namespace sound {
00029
00031 typedef unsigned int (*aux_streamer_ptr)(void *udata,
00032 boost::int16_t* samples, unsigned int nSamples, bool& eof);
00033
00034 class AuxStream : public InputStream {
00035 public:
00036 AuxStream(aux_streamer_ptr cb, void* arg)
00037 :
00038 _samplesFetched(0),
00039 _eof(false),
00040 _cb(cb),
00041 _cbArg(arg)
00042 {}
00043
00044
00045 unsigned int fetchSamples(boost::int16_t* to, unsigned int nSamples)
00046 {
00047 unsigned int wrote = _cb(_cbArg, to, nSamples, _eof);
00048 _samplesFetched += wrote;
00049 return wrote;
00050 }
00051
00052
00053 unsigned int samplesFetched() const
00054 {
00055 return _samplesFetched;
00056 }
00057
00058
00059 bool eof() const
00060 {
00061 return _eof;
00062 }
00063
00064 private:
00065 unsigned int _samplesFetched;
00066 bool _eof;
00067 aux_streamer_ptr _cb;
00068 void* _cbArg;
00069 };
00070
00071 }
00072 }
00073
00074 #endif // SOUND_AUXSTREAM_H