home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / VideoRenderer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  3.3 KB  |  119 lines

  1. /* 
  2.  *  VideoRenderer.h 
  3.  *
  4.  *    Copyright (C) Alberto Vigata - July 2000 - ultraflask@yahoo.com
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24. #if !defined(AFX_VIDEORENDERER_H__76B3ADF0_38CE_4243_890F_89B05B944B77__INCLUDED_)
  25. #define AFX_VIDEORENDERER_H__76B3ADF0_38CE_4243_890F_89B05B944B77__INCLUDED_
  26.  
  27. #if _MSC_VER > 1000
  28. #pragma once
  29. #endif // _MSC_VER > 1000
  30.  
  31. #include <windows.h>
  32. #include "thread.h"
  33. #include "framesource.h"
  34.  
  35.  
  36. #include "ddraw.h"
  37.  
  38. #define SafeRelease(x) { (x)->Release(); (x)=NULL; }
  39. #define MASKCOLOR            RGB(16, 0, 16) // Color for the overlay
  40.  
  41. #define VR_WAITFORLOCK 1
  42.  
  43. class CVideoRenderer  
  44. {
  45. public:
  46.   CVideoRenderer(HWND hRenderWnd, bool bFixedFormat, 
  47.                                   int nFixedFormat ); // bFixedFormat forces the 
  48.                                                       //  renderer to render video always in the same format nFixedFormat
  49.  
  50.   virtual ~CVideoRenderer();
  51.   void Draw(CFrame *pFrame, int flags = VR_WAITFORLOCK );
  52.   void Update();
  53.   void UpdateOverlay();
  54.   ui32 GetFormat(){return m_nCurrentFormat;}
  55.   void SetStaticFrame(CFrame *pFrame);
  56.   void StartPlaying(){ m_nState = Playing; }
  57.   void StopPlaying(){ m_nState = Stopped; }
  58.  
  59.   bool CVideoRenderer::SetOverlay(int nWidth, int nHeight, long StoreFormat);
  60.  
  61.   enum OverlayMode { YuvMode=0, RgbMode };
  62.   enum RendererState { Stopped=0,  Playing };
  63. private:
  64.   // DirectDraw support
  65.   // Try to open direct draw driver
  66.   bool OpenDirectDraw();
  67.   void CloseDirectDraw();
  68.  
  69.   bool GetInfoOverlay(DWORD * FccCodes, DDCAPS * Caps);
  70.  
  71.   bool OpenOverlay(long StoreFormat,int nWidth, int nHeight);
  72.  
  73.   void CloseOverlay();
  74.   void PaintKey();
  75.  
  76.   DWORD DDColorMatch(LPDIRECTDRAWSURFACE pdds, COLORREF rgb);
  77.  
  78.   // 
  79.   bool m_bDDrawPresent;
  80.   bool m_bDDCanUseYuvOverlay;
  81.   bool m_bDDCanUseRgbOverlay;
  82.  
  83.   // DirectDraw structures
  84.   LPDIRECTDRAW        m_pDD;    
  85.   LPDIRECTDRAW2            m_pDD2;
  86.   LPDIRECTDRAWSURFACE m_pDDSPrimary;  
  87.   LPDIRECTDRAWSURFACE m_pDDSOverlay;  
  88.   DDOVERLAYFX         m_OverlayFX;         
  89.   DDCAPS              m_ddcaps;
  90.   DDSURFACEDESC       m_ddsd;
  91.  
  92.   bool m_bOverlayFlag;
  93.   bool m_bDirectDrawFlag;
  94.  
  95.  
  96.   CFrame m_oStaticFrame;
  97.   CFrame m_oRgbFrame;   // Used when color space conversion is needed
  98.   HWND m_hRenderWnd;
  99.  
  100.   DWORD m_nWidth;
  101.   DWORD m_nHeight;
  102.   // Background
  103.   double fTime;
  104.   double fPhase1, fPhase2;
  105.  
  106.   RendererState m_nState;
  107.  
  108.   int m_nCurrentFormat;
  109.  
  110.   bool m_bFixedFormat;
  111.  
  112.   CFlCritSec m_csDirectDraw;
  113. //  IID_IDirectDraw2 *pDD2;
  114.  
  115. };
  116.  
  117.  
  118. #endif // !defined(AFX_VIDEORENDERER_H__76B3ADF0_38CE_4243_890F_89B05B944B77__INCLUDED_)
  119.