home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow / Capture / DVApp / CDVGraph.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  3.9 KB  |  116 lines

  1. // ---------------------------------------------------------------------------
  2. // File: CDVGraph.h
  3. // 
  4. // Desc: CDVGraph Class declaration, it supports DV Graph Building
  5. //       This is the base class to build all AVC graphs using 
  6. //       MSTape.sys
  7. //      
  8. // Copyright (c) 2000-2001, Microsoft Corporation. All rights reserved.
  9. //----------------------------------------------------------------------------
  10.  
  11. #pragma once
  12.  
  13. #define SAFE_RELEASE(pObject) if(pObject){ pObject->Release(); pObject = NULL;}
  14.  
  15. #define DVENCODER_WIDTH             720
  16. #define PAL_DVENCODER_HEIGHT        576
  17. #define NTSC_DVENCODER_HEIGHT       480
  18.  
  19.  
  20. //track device mode or active 
  21. enum DV_MODE
  22. {
  23.     CameraMode  = 0L,
  24.     VcrMode     = 1L,
  25.     UnknownMode = 2L
  26. }; 
  27.  
  28. enum GRAPH_TYPE
  29. {
  30.     GRAPH_PREVIEW, 
  31.     GRAPH_DV_TO_FILE, 
  32.     GRAPH_DV_TO_FILE_NOPRE, 
  33.     GRAPH_FILE_TO_DV, 
  34.     GRAPH_FILE_TO_DV_NOPRE, 
  35.     GRAPH_DV_TO_FILE_TYPE2, 
  36.     GRAPH_DV_TO_FILE_NOPRE_TYPE2, 
  37.     GRAPH_FILE_TO_DV_TYPE2, 
  38.     GRAPH_FILE_TO_DV_NOPRE_TYPE2
  39. };
  40.  
  41. class CDVGraph 
  42. {
  43. public:
  44.  
  45.     // variables
  46.     // Basic DirectShow Interfaces needed for Graph Building
  47.     IGraphBuilder           *m_pGraph;
  48.     ICaptureGraphBuilder2   *m_pCaptureGraphBuilder;
  49.  
  50.     IMediaControl           *m_pMediaControl;
  51.     IMediaEventEx           *m_pMediaEvent;
  52.     IBaseFilter             *m_pDeviceFilter;
  53.     IBaseFilter             *m_pInputFileFilter;  
  54.  
  55.     IVideoWindow            *m_pVideoWindow;
  56.     IAMDroppedFrames        *m_pDroppedFrames;
  57.  
  58.     IAMExtDevice            *m_pIAMExtDevice;
  59.     IAMExtTransport         *m_pIAMExtTransport;
  60.     IAMTimecodeReader       *m_pIAMTCReader;
  61.  
  62.     TCHAR                   m_DeviceName[_MAX_PATH];
  63.     // State maintaining member variables
  64.     DV_MODE                 m_SubunitMode; // vcr or camera
  65.     _DVENCODERVIDEOFORMAT   m_VideoFormat; //pal or ntsc
  66.     LONG                    m_AvgTimePerFrame;              
  67.     _DVRESOLUTION           m_DVResolution; //  resolution of DV decoder
  68.     GRAPH_TYPE              m_iGraphType;
  69.     
  70.     // member functions
  71.     //constructor & destructor
  72.     CDVGraph(void);
  73.     ~CDVGraph(void);
  74.     
  75.     // Graph Building Helper Methods
  76.     HRESULT BuildBasicGraph(void);
  77.     HRESULT GetTapeInfo(void);
  78.     HRESULT StopGraph(void);
  79.     HRESULT PauseGraph(void);
  80.     HRESULT StartGraph(void);
  81.  
  82.     HRESULT MakePreviewGraph(void);
  83.     
  84.     // Type 1 File (capture\playback\transmit)
  85.     HRESULT MakeDvToFileGraph_Type1(TCHAR*        OutputFileName);
  86.     HRESULT MakeDvToFileGraph_NoPre_Type1(TCHAR*  OutputFileName);
  87.     HRESULT MakeFileToDvGraph_Type1(TCHAR*        InputFileName);
  88.     HRESULT MakeFileToDvGraph_NoPre_Type1(TCHAR*  InputFileName);
  89.     
  90.     // Type 2 File (capture\playback\transmit)
  91.     HRESULT MakeDvToFileGraph_Type2(TCHAR*        OutputFileName);
  92.     HRESULT MakeDvToFileGraph_NoPre_Type2(TCHAR*        OutputFileName);
  93.     HRESULT MakeFileToDvGraph_Type2(TCHAR*  InputFileName);
  94.     HRESULT MakeFileToDvGraph_NoPre_Type2(TCHAR*  InputFileName);
  95.  
  96.     HRESULT getDroppedFrameNum(BOOL *bIsModeTransmit, long* pDropped, long* pNotdropped);
  97.     HRESULT ChangeFrameRate( BOOL bHalfFrameRate );
  98.     HRESULT GetVideoWindowDimensions(int *pWidth, int *pHeight, BOOL bChangeResolution,HWND hwndApp);
  99.     HRESULT SeekATN(int iHr, int iMn, int iSc, int iFr);
  100.     HRESULT GetDVMode(DV_MODE *pSubunitMode );   
  101.     HRESULT SaveGraphToFile(TCHAR* pFileName);                                                          
  102.     HRESULT NukeFilters(IBaseFilter *pFilter, BOOL bNukeDownStream);
  103.  
  104. private:
  105.     // variables
  106.  
  107.     // member functions
  108.     void FreeFilters();
  109.     HRESULT InitializeGraph(void);
  110.     HRESULT AddDeviceFilter(void);
  111.     HRESULT GetResolutionFromDVDecoderPropertyPage(HWND hwndApp, BOOL bChangeResolution);
  112.     HRESULT SetAviOptions(IBaseFilter *ppf, InterleavingMode INTERLEAVE_MODE);
  113.  
  114. };
  115.  
  116.