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

Packages/win/VideoDemo/AppSrc/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 <atlbase.h>
00018 #include <streams.h>
00019 #include <initguid.h>
00020 
00021 #define MAX_LOADSTRING 100
00022 #define FRAMERATE               30
00023 #define SCREENWIDTH 160 
00024 #define SCREENHEIGHT 120
00025 #define WM_GRAPHNOTIFY   WM_APP + 1
00026 
00027 #define NUM_PROJECTS 5
00028 enum ds_project{ds_mpisearch = 0, ds_eyefinder, ds_blinkDetector, ds_colorTracker, ds_mpisearchAda};
00029 const char ds_projectNames[NUM_PROJECTS][256] = {"mpisearch", "eyefinder", "blinkDetector", "colorTracker", "mpisearchAda"};
00030 
00031 enum ds_recordMode{ds_capture = 0, ds_pause, ds_stop};
00032 
00033 class MPDirectShow
00034 {
00035 
00036 public:
00037         ds_recordMode m_recordMode;
00038         char m_deviceNames[100][256];
00039         int m_devicePos;
00040 
00041         MPDirectShow();
00042         ~MPDirectShow();
00043 
00044         HRESULT RunDirectShow(HWND hWnd);
00045         HRESULT StopCapture();
00046         HRESULT PauseFilter();
00047         HRESULT RunFilter();
00048         HRESULT ChangeMPFilter(HWND hWnd);
00049         HRESULT SaveGraphEditFile(WCHAR* wszFileName);
00050         HRESULT SaveVideo();
00051         void SetProject(ds_project curProject);
00052         void SetInput(int width, int height);
00053 
00054 private:
00055 
00056         // DShow Member Variables
00057         int m_width;
00058         int m_height;
00059         bool m_usingCompressor;
00060         ds_project m_curProject;
00061         CString m_ErrMsg;
00062         IGraphBuilder *pGraph;
00063         ICaptureGraphBuilder2 *pBuild;
00064         CComPtr< IReferenceClock > pClock;
00065         CComQIPtr< IMediaControl> pControl;
00066         CComQIPtr< IVideoWindow> pWindow;
00067         CComQIPtr< IMediaEventEx> pEvent;
00068 
00069         HRESULT FindAllDevices( REFCLSID clsidDeviceClass, int* totalFound);
00070         HRESULT GetDefaultCapDevice( IBaseFilter ** ppCap, BYTE AVtype );
00071         HRESULT GetListedDevice( IBaseFilter ** ppCom, REFCLSID clsidDeviceClass, char* deviceName );
00072         HRESULT GetPin(IBaseFilter *, PIN_DIRECTION, IPin **);
00073         HRESULT GetPin_Name(IBaseFilter *pFilter, char* name, IPin **ppPin);
00074         HRESULT ConnectFilters(IBaseFilter *, IBaseFilter *);
00075         HRESULT ConnectFilters(IPin *pOut, IBaseFilter *pSecond);
00076         HRESULT DisonnectFilters(IBaseFilter *pFilter, PIN_DIRECTION pindir);
00077         HRESULT CreateManualGraph(HWND hWnd);
00078         HRESULT SetDisplayWnd(HWND hWnd);
00079         HRESULT GetMediaType(IPin *outPin, IPin *inPin, AM_MEDIA_TYPE *ppMediaType);
00080         void EnumFilters(void);
00081         void EnumPins(IBaseFilter *pFilter);
00082 
00083 };
00084 
00085 #endif //_MPDIRECTSHOW_H_
00086 
00087 /*
00088  * 
00089  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00090  * 
00091  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00092  *    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.
00093  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00094  * 
00095  * 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.
00096  * 
00097  */
00098 
00099 

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