#ifndef _DVCAP_CAPTUREDEVICEGRAPH_HPP_ #define _DVCAP_CAPTUREDEVICEGRAPH_HPP_ #ifndef _COMMON_DXSDK_HPP_ #include #endif #ifndef _COMMON_GUIWINDOW_HPP_ #include #endif #ifndef _COMMON_FILE_HPP_ #include #endif #ifndef _COMMON_SYSTEMTIME_HPP_ #include #endif #ifndef _COM_COM_HPP_ #include #endif #ifndef _COM_BSTRING_HPP_ #include #endif #ifndef _COM_COMPOINTER_HPP_ #include #endif #ifndef _DVCAP_NUKER_HPP_ #include #endif #ifdef _DVCAP_DEBUG #define LOG(s) log(s) #else #define LOG(s) #endif class CaptureDeviceGraph { public: typedef enum DVMode{CameraMode=0,VCRMode,UnknownMode}; typedef enum GraphType{GraphPreview,GraphDVToFile,GraphDVToFileNoPre,GraphFileToDV,GraphFileToDVNoPre, GraphDVToFileType2,GraphDVToFileNoPreType2,GraphFileToDVType2,GraphFileToDVNoPreType2}; CaptureDeviceGraph(); virtual ~CaptureDeviceGraph(); bool buildBasicGraph(void); bool getTapeInfo(void); _DVENCODERVIDEOFORMAT getVideoFormat(void)const; const BString &getDeviceName(void)const; bool getTimecode(TIMECODE_SAMPLE &tcSample); // should wrap TIMECODE_SAMPLE & provide formatting capabilities bool seekAtn(int hour,int minute,int second,int frame); bool stopGraph(void); bool pauseGraph(void); bool startGraph(void); bool makePreviewGraph(void); // type 1 file (capture/playback/transmit) bool makeDVToFileGraphType1(const BString &pathOutputFileName); bool makeDVToFileGraphNoPreType1(const BString &pathOutputFileName); bool makeFileToDVGraphType1(const BString &pathInputFileName); bool makeFileToDVGraphNoPreType1(const BString &pathInputFileName); bool makeDVToFileGraphType2(const BString &pathOutputFileName); bool makeDVToFileGraphNoPreType2(const BString &pathOutputFileName); bool makeFileToDVGraphType2(const BString &pathInputFileName); bool makeFileToDVGraphNoPreType2(const BString &pathInputFileName); bool getDroppedFrameNum(bool &isModeTransmit,long &dropped,long ¬Dropped); bool changeFrameRate(bool halfFrameRate); bool getVideoWindowDimensions(int &width,int &height,bool changeResolution=false,GUIWindow &window=GUIWindow()); bool setNotifyWindow(GUIWindow &window,int command); bool putOwner(GUIWindow &window); bool putWindowStyle(int style); bool setVideoWindowPosition(int left,int top,int width,int height); bool setVideoWindowVisible(bool visible); bool putIAMExtTransportMode(int mode); bool seekATN(int iHr,int iMn,int iSc,int iFr); DVMode getDVMode(void); bool saveGraphToFile(const BString &pathOutputFileName); bool nukeInputFileFilter(); bool nukeDeviceFilter(); private: enum{DVEncoderWidth=720,PALDVEncoderHeight=576,NTSCDVEncoderHeight=480}; void freeFilters(void); bool initializeGraph(void); bool addDeviceFilter(void); bool getResolutionFromDVDecoderPropertyPage(GUIWindow &window,bool changeResolution); bool setAviOptions(ComPointer &ppf,InterleavingMode interleaveMode); void log(const String &string); void error(const String &string); ComPointer mGraph; ComPointer mCaptureGraphBuilder; ComPointer mMediaControl; ComPointer mMediaEvent; ComPointer mDeviceFilter; ComPointer mInputFileFilter; ComPointer mVideoWindow; ComPointer mDroppedFrames; ComPointer mExtDevice; ComPointer mExtTransport; ComPointer mTimecodeReader; BString mDeviceName; DVMode mSubunitMode; GraphType mGraphType; _DVENCODERVIDEOFORMAT mVideoFormat; LONG mAverageTimePerFrame; _DVRESOLUTION mDVResolution; BString mLastErrorText; File mLogFile; }; inline _DVENCODERVIDEOFORMAT CaptureDeviceGraph::getVideoFormat(void)const { return mVideoFormat; } inline const BString &CaptureDeviceGraph::getDeviceName(void)const { return mDeviceName; } inline void CaptureDeviceGraph::error(const String &string) { SystemTime systemTime; mLogFile.writeLine(String("[ERROR]")+String("[")+systemTime.toString()+String("]")+string); mLastErrorText=string; } inline void CaptureDeviceGraph::log(const String &string) { SystemTime systemTime; mLogFile.writeLine(String("[LOG]")+String("[")+systemTime.toString()+String("]")+string); } #endif