COverlayController.h
上传用户:hhs829
上传日期:2022-06-17
资源大小:586k
文件大小:3k
- //
- // COverlayController.h
- //
- #ifndef __H_COverlayController__
- #define __H_COverlayController__
- #include "CBasePixel.h"
- #include "OverlayDefs.h"
- class COverlayController
- {
- protected:
- CBasePixel * mPixelConverter;
- BOOL mCanDoOverlay; // Title overlay workable flag
- BOOL mIsOverlayByCover;
- long mOverlayCounter;
- double mDoubleStartTime; // Actual start and end time
- double mDoubleEndTime;
- long mOverlayStartTime; // Using frame index
- long mOverlayEndTime;
- // Title property
- char * mTitle;
- unsigned char * mTitleDIBBits;
- unsigned char mColorRed; // Text color
- unsigned char mColorGreen;
- unsigned char mColorBlue;
- SIZE mTitleSize;
- POINT mStartPos; // Start position to draw text
- LOGFONT mTitleFont;
- BOOL mIsFontChanged;
- long mDIBWidthInBytes;
- // Input video property
- RGB_FORMAT mInputColorSpace;
- long mImageWidth;
- long mImageHeight; // This is an absolute value
- long mImageWidthInBytes; // the line width in bytes
- WORD mImageBitCount;
- BOOL mIsBottomUpImage;
- double mInputFrameRate;
- public:
- COverlayController();
- virtual ~COverlayController();
- void SetInputColorSpace(RGB_FORMAT inColorSpace);
- void SetInputVideoInfo(const VIDEOINFOHEADER * inInfoHeader);
- // If VIDEOINFOHEADER not contain valid frame rate,
- // using the following method to set an estimated value.
- void SetEstimatedFrameRate(double inFrameRate);
- void SetOverlayStyle(BOOL inUsingCover);
- void GetOverlayStyle(BOOL * outUsingCover);
- virtual void SetTitle(const char * inTitle, int inLength);
- void SetTitleColor(BYTE inR, BYTE inG, BYTE inB);
- void SetTitleStartPosition(POINT inStartPos);
- void SetTitleFont(LOGFONT inFont);
- void SetTitleDuration(double inStart, double inEnd);
- // Get the title length by passing NULL to outBuffer
- int GetTitle(char * outBuffer);
- void GetTitleColor(BYTE * outR, BYTE * outG, BYTE * outB);
- void GetTitleStartPosition(POINT * outStartPos);
- void GetTitleFont(LOGFONT * outFont);
- void GetTitleDuration(double * outStart, double * outEnd);
-
- public:
- virtual BOOL StartTitleOverlay(void);
- virtual BOOL StopTitleOverlay(void);
- BOOL DoTitleOverlay(PBYTE inImage);
- protected:
- void ReleasePixelConverter(void);
- void ReleaseTitleBuffer(void);
- void ReleaseTitleDIB(void);
- BOOL CreateTitleDIBBits(void);
- HBITMAP ActualCreateTitleDIB(HDC inDC);
- virtual BOOL ValidateTitleDIBSize(void);
- virtual void SideEffectProgressChanged(void);
- virtual void SideEffectColorSpaceChanged(void);
- virtual void SideEffectFontChanged(void);
-
- // Subclass can use these methods to do more details
- virtual BOOL BeforeActualOverlay(void);
- virtual BOOL AfterActualOverlay(void);
- virtual BOOL ActualOverlay(PBYTE inImage);
- };
- #endif // __H_COverlayController__