00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef IOBUFFER_H_
00026 #define IOBUFFER_H_
00027
00028
00029 #include <sys/types.h>
00030 #include <time.h>
00031 #include <iostream>
00032
00033 #if !defined(_MSC_VER) && !defined(USE_PREBUILD_LIBS)
00034 # include <sys/time.h>
00035 # include "avcap-config.h"
00036 #endif
00037
00038 #ifdef _WIN32
00039 # include <windows.h>
00040 #endif
00041
00042 #include "CaptureManager.h"
00043 #include "avcap-export.h"
00044
00045 namespace avcap
00046 {
00048
00055 class AVCAP_Export IOBuffer
00056 {
00057 public:
00058
00060 enum State
00061 {
00062 STATE_USED = 0,
00063 STATE_UNUSED,
00064 };
00065
00066 private:
00067 CaptureManager *mMgr;
00068 void* mPtr;
00069 size_t mSize;
00070 int mIndex;
00071 int mState;
00072 long mSequence;
00073 size_t mValid;
00074 struct timeval mTimestamp;
00075
00076 public:
00077
00079 IOBuffer(CaptureManager* mgr, void* ptr, size_t size, int index = 0);
00080 virtual ~IOBuffer();
00081
00083
00084 inline void* getPtr() const
00085 { return mPtr; }
00086
00088
00089 inline size_t getSize() const
00090 { return mSize; }
00091
00093
00094 inline long getSequence() const
00095 { return mSequence; }
00096
00098
00099 inline size_t getValidBytes() const
00100 { return mValid; }
00101
00103
00104 unsigned long getTimestamp();
00105
00107 void release();
00108
00110
00111 inline int getIndex() const
00112 { return mIndex; }
00113
00115
00117
00121
00122
00126
00131