The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Libraries/mputil/DirectShow/MPDirectShow.h

Go to the documentation of this file.
00001 /* 
00002  *  MPDirectShow.h
00003  *
00004  *  Created by Bret Fortenberry in June, 2004.
00005  *  Fixes: 
00006  * 
00007  *  Copyright (c) 2004 Machine Perception Laboratory 
00008  *  University of California San Diego.
00009  * 
00010  * Please read the disclaimer and notes about redistribution 
00011  * at the end of this file.
00012  *  
00013  */
00014 #ifndef _MPDIRECTSHOW_H_
00015 #define _MPDIRECTSHOW_H_
00016 
00017 #include <stdlib.h>
00018 #include <atlbase.h>
00019 #include <streams.h>
00020 #include <initguid.h>
00021 
00022 #define NUM_PROJECTS 5
00023 enum ds_project{ds_mpisearch = 0, ds_eyefinder, ds_blinkDetector, ds_colorTracker, ds_mpisearchAda};
00024 const char ds_projectNames[NUM_PROJECTS][256] = {"mpisearch", "eyefinder", "blinkDetector", "colorTracker", "mpisearchAda"};
00025 
00026 enum ds_recordMode{ds_capture = 0, ds_pause, ds_stop};
00027 
00028 class MPDirectShow
00029 {
00030 
00031 public:
00032         ds_recordMode m_recordMode;
00033         char m_deviceNames[100][256];
00034         int m_devicePos;
00035 
00036         MPDirectShow();
00037         ~MPDirectShow();
00038 
00039         HRESULT RunDirectShow(HWND hWnd);
00040         HRESULT StopCapture();
00041         HRESULT PauseFilter();
00042         HRESULT RunFilter();
00043         HRESULT ChangeMPFilter(HWND hWnd);
00044         HRESULT SaveGraphEditFile(WCHAR* wszFileName);
00045         HRESULT SaveVideo();
00046         void SetProject(ds_project curProject);
00047         void SetInput(int width, int height);
00048         int GetVideoDevices();
00049         void SetVideoDevices(int pos);
00050 
00051 private:
00052 
00053         // DShow Member Variables
00054         int m_width;
00055         int m_height;
00056         bool m_usingCompressor;
00057         ds_project m_curProject;
00058   //string m_ErrMsg;
00059         IGraphBuilder *pGraph;
00060         ICaptureGraphBuilder2 *pBuild;
00061         CComPtr< IReferenceClock > pClock;
00062         CComQIPtr< IMediaControl> pControl;
00063         CComQIPtr< IVideoWindow> pWindow;
00064         CComQIPtr< IMediaEventEx> pEvent;
00065 
00066         HRESULT FindAllDevices( REFCLSID clsidDeviceClass, int* totalFound);
00067         HRESULT GetDefaultCapDevice( IBaseFilter ** ppCap, REFCLSID clsidDeviceClass );
00068         HRESULT GetListedDevice( IBaseFilter ** ppCom, REFCLSID clsidDeviceClass, char* deviceName );
00069         HRESULT GetPin(IBaseFilter *, PIN_DIRECTION, IPin **);
00070         HRESULT GetPin_Name(IBaseFilter *pFilter, char* name, IPin **ppPin);
00071         HRESULT ConnectFilters(IBaseFilter *, IBaseFilter *);
00072         HRESULT ConnectFilters(IPin *pOut, IBaseFilter *pSecond);
00073         HRESULT DisonnectFilters(IBaseFilter *pFilter, PIN_DIRECTION pindir);
00074         HRESULT CreateManualGraph(HWND hWnd);
00075         HRESULT SetDisplayWnd(HWND hWnd);
00076         HRESULT GetMediaType(IPin *outPin, IPin *inPin, AM_MEDIA_TYPE *ppMediaType);
00077         void EnumFilters(void);
00078         void EnumPins(IBaseFilter *pFilter);
00079 
00080 };
00081 
00082 #endif //_MPDIRECTSHOW_H_
00083 
00084 /*
00085  * 
00086  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00087  * 
00088  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00089  *    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00090  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00091  * 
00092  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00093  * 
00094  */
00095 
00096 

Generated on Mon Nov 8 17:07:43 2004 for MPT by  doxygen 1.3.9.1