Initial
This commit is contained in:
140
dvcap/CaptureDeviceGraph.hpp
Normal file
140
dvcap/CaptureDeviceGraph.hpp
Normal file
@@ -0,0 +1,140 @@
|
||||
#ifndef _DVCAP_CAPTUREDEVICEGRAPH_HPP_
|
||||
#define _DVCAP_CAPTUREDEVICEGRAPH_HPP_
|
||||
#ifndef _COMMON_DXSDK_HPP_
|
||||
#include <common/dxsdk.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_GUIWINDOW_HPP_
|
||||
#include <common/GUIWnd.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_FILE_HPP_
|
||||
#include <common/file.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SYSTEMTIME_HPP_
|
||||
#include <common/systime.hpp>
|
||||
#endif
|
||||
#ifndef _COM_COM_HPP_
|
||||
#include <com/com.hpp>
|
||||
#endif
|
||||
#ifndef _COM_BSTRING_HPP_
|
||||
#include <com/bstring.hpp>
|
||||
#endif
|
||||
#ifndef _COM_COMPOINTER_HPP_
|
||||
#include <com/comptr.hpp>
|
||||
#endif
|
||||
#ifndef _DVCAP_NUKER_HPP_
|
||||
#include <dvcap/Nuker.hpp>
|
||||
#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<IBaseFilter> &ppf,InterleavingMode interleaveMode);
|
||||
void log(const String &string);
|
||||
void error(const String &string);
|
||||
|
||||
ComPointer<IGraphBuilder> mGraph;
|
||||
ComPointer<ICaptureGraphBuilder2> mCaptureGraphBuilder;
|
||||
ComPointer<IMediaControl> mMediaControl;
|
||||
ComPointer<IMediaEventEx> mMediaEvent;
|
||||
ComPointer<IBaseFilter> mDeviceFilter;
|
||||
ComPointer<IBaseFilter> mInputFileFilter;
|
||||
ComPointer<IVideoWindow> mVideoWindow;
|
||||
ComPointer<IAMDroppedFrames> mDroppedFrames;
|
||||
ComPointer<IAMExtDevice> mExtDevice;
|
||||
ComPointer<IAMExtTransport> mExtTransport;
|
||||
ComPointer<IAMTimecodeReader> 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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user