include/avcap/windows/DS_VidCapManager.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 DSVIDCAPMANAGER_H_
00026 #define DSVIDCAPMANAGER_H_
00027 
00028 #include <list>
00029 
00030 #include "CaptureManager.h"
00031 #include "SampleGrabberCallback.h"
00032 #include "avcap-export.h"
00033 
00034 namespace avcap
00035 {
00036 class DS_DeviceDescriptor;
00037 class DS_FormatManager;
00038 class IOBuffer;
00039 class CaptureHandler;
00040 class SampleGrabberCallback;
00041 
00043 
00044         class AVCAP_Export DS_VidCapManager : public CaptureManager
00045         {
00046         private:
00047                 typedef std::list<IOBuffer*> IOBufList;
00048                 
00049                 DS_DeviceDescriptor*    mDSDeviceDescriptor;
00050                 SampleGrabberCallback*  mGrabberCallback;
00051                 HANDLE                                  mLock;
00052                 int                                     mSequence;
00053                 int                                     mNumBuffers;
00054 
00055         public:
00056                 DS_VidCapManager(DS_DeviceDescriptor* dd, DS_FormatManager* fmt_mgr,
00057                                 int nbufs = DEFAULT_BUFFERS);
00058         
00059                 virtual ~DS_VidCapManager();
00060         
00061                 int init();
00062         
00063                 int destroy();
00064         
00065                 int startCapture();
00066         
00067                 int stopCapture();
00068                 
00069                 int getNumIOBuffers();
00070         
00071         private:
00072                 IOBuffer* dequeue();
00073 
00074                 int enqueue(IOBuffer* buf);
00075         
00076                 friend class IOBuffer;
00077                 friend class SampleGrabberCallback;
00078         };
00079 
00080         class MutexGuard
00081         {
00082         private:
00083                 HANDLE  mLock;
00084                 
00085         public:
00086                 inline MutexGuard(HANDLE lock) : 
00087                         mLock(lock)
00088                         { WaitForSingleObject(mLock, INFINITE); }
00089                         
00090                 inline virtual ~MutexGuard()
00091                         { ReleaseMutex(mLock); }
00092         private:
00093                 inline MutexGuard()
00094                         {}
00095         };
00096 }
00097 
00098 #endif // DSVIDCAPMANAGER_H_

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