include/avcap/IOBuffer.h

Go to the documentation of this file.
00001 /*
00002  * (c) 2005, 2008 Nico Pranke <Nico.Pranke@googlemail.com>, Robin Luedtke <RobinLu@gmx.de> 
00003  *
00004  * This file is part of avcap.
00005  *
00006  * avcap is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * avcap is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with avcap.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 /* avcap is free for non-commercial use.
00021  * To use it in commercial endeavors, please contact Nico Pranke <Nico.Pranke@googlemail.com>
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 

Generated on Mon Nov 30 11:10:30 2009 for avcap-0.1 by  doxygen 1.5.1