📄 hxvsurf.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file, are
* subject to the current version of the RealNetworks Public Source License
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
* in which case the RCSL will apply. You may also obtain the license terms
* directly from RealNetworks. You may not use this file except in
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
* applicable to this file, the RCSL. Please see the applicable RPSL or
* RCSL for the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the portions
* it created.
*
* This file, and the files included with this file, is distributed and made
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _HXVSURF_H_
#define _HXVSURF_H_
/*
* Forward declarations of some interfaces defined or used here-in.
*/
typedef _INTERFACE IHXBuffer IHXBuffer;
typedef _INTERFACE IHXValues IHXValues;
/****************************************************************************
*
* Video Surface Data Structures and Constants
*/
typedef struct _HXBitmapInfoHeader
{
UINT32 biSize;
INT32 biWidth;
INT32 biHeight;
UINT16 biPlanes;
UINT16 biBitCount;
UINT32 biCompression;
UINT32 biSizeImage;
INT32 biXPelsPerMeter;
INT32 biYPelsPerMeter;
UINT32 biClrUsed;
UINT32 biClrImportant;
UINT32 rcolor;
UINT32 gcolor;
UINT32 bcolor;
} HXBitmapInfoHeader;
/*
* HXBitmapInfo structure.
*/
typedef struct _HXBitmapInfo
{
struct
{
UINT32 biSize; /* use OFFSETOF(dwBitMask) here */
INT32 biWidth; /* image width (in pixels) */
INT32 biHeight; /* image height */
UINT16 biPlanes; /* # of bitplanes; always use 1 */
UINT16 biBitCount; /* average # bits/pixel */
UINT32 biCompression; /* one of the RMA_... FOURCC codes */
UINT32 biSizeImage; /* = width * height * bitCount / 8 */
INT32 biXPelsPerMeter;/* always 0 */
INT32 biYPelsPerMeter;/* always 0 */
UINT32 biClrUsed; /* !0, if 8-bit RGB; 0, otherwise */
UINT32 biClrImportant; /* !0, if 8-bit RGB; 0, otherwise */
} bmiHeader;
union
{
UINT32 dwBitMask[3]; /* color masks (for BI_BITFIELDS) */
UINT32 dwPalette[256]; /* palette (for 8-bit RGB image) */
} un;
} HXBitmapInfo;
typedef UINT32 HX_COMPRESSION_TYPE;
/*
* Structure for source inputs used in IHXVideoSurface2::ColorConvert
*/
typedef struct _tagSourceInputStruct
{
UCHAR* *aSrcInput;
INT32 *aSrcPitch;
INT32 nNumInputs;
} SourceInputStruct;
/*
* Structure for alpha blending in IHXVideoSurface2
*/
typedef struct _tagAlphaStruct
{
UCHAR* pBuffer; /* buffer for source image data */
UINT32 ulFourCC; /* fourcc of pBuffer */
INT32 lPitch; /* pitch of pBuffer */
UINT32 ulImageWidth; /* source image width */
UINT32 ulImageHeight; /* source image height */
HXxRect rcImageRect; /* subrect of src image requested */
} AlphaStruct;
/*
* Structure for IHXVideoSurface2::GetVideoMem
*/
typedef struct _tagVideoMemStruct
{
UCHAR* pVidMem; /* pointer to video memory */
INT32 lPitch; /* pitch of pVidMem */
HXBitmapInfoHeader bmi; /* desciption of pVidMem */
AlphaStruct* pAlphaList; /* alpha blending list */
UINT32 ulCount; /* alpha blending list length */
} VideoMemStruct;
/*
* Windows DIB formats & MKFOURCC() macro:
*/
#ifndef BI_RGB
#define BI_RGB 0L /* RGB-8, 16, 24, or 32 */
#define BI_RLE8 1L /* 8-bit RLE compressed image */
#define BI_RLE4 2L /* 4-bit RLE compressed image */
#define BI_BITFIELDS 3L /* RGB 555, 565, etc. */
#endif
#ifndef MKFOURCC
#define MKFOURCC(c0,c1,c2,c3) \
((UINT32)(BYTE)(c0) | ((UINT32)(BYTE)(c1) << 8) | \
((UINT32)(BYTE)(c2) << 16) | ((UINT32)(BYTE)(c3) << 24))
#endif
/*
* RMA image formats:
*/
#define HX_RGB BI_RGB /* Windows-compatible RGB formats: */
#define HX_RLE8 BI_RLE8
#define HX_RLE4 BI_RLE4
#define HX_BITFIELDS BI_BITFIELDS
#define HX_I420 MKFOURCC('I','4','2','0') /* planar YCrCb */
#define HX_YV12 MKFOURCC('Y','V','1','2') /* planar YVU420 */
#define HX_YUY2 MKFOURCC('Y','U','Y','2') /* packed YUV422 */
#define HX_UYVY MKFOURCC('U','Y','V','Y') /* packed YUV422 */
#define HX_YVU9 MKFOURCC('Y','V','U','9') /* Intel YVU9 */
#define HX_ARGB MKFOURCC('A','R','G','B') /* ARGB32 */
#define HX_DVPF MKFOURCC('D','V','P','F') /* dvpf */
/*
* Non-standard FOURCC formats (these are just few aliases to what can be
* represented by the standard formats, and they are left for backward
* compatibility only).
*/
#define HXCOLOR_RGB3_ID MKFOURCC('3','B','G','R') /* RGB-32 ?? */
#define HXCOLOR_RGB24_ID MKFOURCC('B','G','R',' ') /* top-down RGB-24*/
#define HXCOLOR_RGB565_ID MKFOURCC('6','B','G','R') /* RGB-16 565 */
#define HXCOLOR_RGB555_ID MKFOURCC('5','B','G','R') /* RGB-16 555 */
#define HXCOLOR_8BIT_ID MKFOURCC('T','I','B','8') /* RGB-8 w. pal-e */
#define HXCOLOR_YUV420_ID MKFOURCC('2','V','U','Y') /* planar YCrCb */
#define HXCOLOR_YUVA_ID MKFOURCC('Y','U','V','A') /* planar YCrCb */
#define HXCOLOR_YUV411_ID MKFOURCC('1','V','U','Y') /* ??? */
#define HXCOLOR_YUVRAW_ID MKFOURCC('R','V','U','Y') /* ??? */
/*
* Flags for IHXVideoSurface2
*/
/* Flags for GetVideoMemory */
#define HX_WAIT_FOREVER 0 /* Do not return until a buffer is available */
#define HX_WAIT_NEVER 1 /* Return an error if no buffer is available */
/* Flags for Present */
#define HX_MODE_TIMED 0 /* Synchronize the frame to IHXRenderTimeLine */
#define HX_MODE_IMMEDIATE 1 /* Display the frame ASAP */
#define HX_MODE_REFRESH (1<<1) /* Refresh the current frame */
/****************************************************************************
*
* Interface:
*
* IHXVideoSurface
*
* Purpose:
*
* Interface for IHXVideoSurface objects.
*
* IID_IHXVideoSurface:
*
* {00002200-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXVideoSurface, 0x00002200, 0x901, 0x11d1, 0x8b,
0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXVideoSurface
DECLARE_INTERFACE_(IHXVideoSurface, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/*
* IHXVideoSurface methods usually called by renderers to
* Draw on the surface
*/
STDMETHOD(Blt) (THIS_
UCHAR* /*IN*/ pImageBits,
HXBitmapInfoHeader* /*IN*/ pBitmapInfo,
REF(HXxRect) /*IN*/ rDestRect,
REF(HXxRect) /*IN*/ rSrcRect) PURE;
/************************************************************************
* Method:
* IHXVideoSurface::BeginOptimizedBlt
* Purpose:
* Called by renderer to commit to a bitmap format for all future
* OptimizedBlt calls.
*/
STDMETHOD(BeginOptimizedBlt)(THIS_
HXBitmapInfoHeader* /*IN*/ pBitmapInfo) PURE;
/************************************************************************
* Method:
* IHXVideoSurface::OptimizedBlt
* Purpose:
* Called by renderer to draw to the video surface, in the format
* previously specified by calling BeginOptimizedBlt.
*/
STDMETHOD(OptimizedBlt) (THIS_
UCHAR* /*IN*/ pImageBits,
REF(HXxRect) /*IN*/ rDestRect,
REF(HXxRect) /*IN*/ rSrcRect) PURE;
/************************************************************************
* Method:
* IHXVideoSurface::EndOptimizedBlt
* Purpose:
* Called by renderer allow the video surface to cleanup after all
* OptimizedBlt calls have been made.
*/
STDMETHOD(EndOptimizedBlt) (THIS) PURE;
/************************************************************************
* Method:
* IHXVideoSurface::GetOptimizedFormat
* Purpose:
* Called by the client to find out what compression type the
* renderer committed to when it called BeginOptimizedBlt.
*/
STDMETHOD(GetOptimizedFormat)(THIS_
REF(HX_COMPRESSION_TYPE) /*OUT*/ ulType) PURE;
/************************************************************************
* Method:
* IHXVideoSurface::GetPreferredFormat
* Purpose:
* Called by renderer to find out what compression type the video
* surface would prefer to be given in BeginOptimizedBlt.
*/
STDMETHOD(GetPreferredFormat)(THIS_
REF(HX_COMPRESSION_TYPE) /*OUT*/ ulType) PURE;
};
/****************************************************************************
*
* Interface:
*
* IHXVideoHook
*
* Purpose:
*
* Interface for IHXVideoHook objects.
*
* IID_IHXVideoHook:
*
* {00002202-0901-11d1-8B06-00A024406D59}
*
*/
DEFINE_GUID(IID_IHXVideoHook, 0x00002202, 0x901, 0x11d1, 0x8b,
0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);
#undef INTERFACE
#define INTERFACE IHXVideoHook
DECLARE_INTERFACE_(IHXVideoHook, IUnknown)
{
/*
* IUnknown methods
*/
STDMETHOD(QueryInterface) (THIS_
REFIID riid,
void** ppvObj) PURE;
STDMETHOD_(ULONG32,AddRef) (THIS) PURE;
STDMETHOD_(ULONG32,Release) (THIS) PURE;
/***
* IHXVideoHook::OnVideoFrame
***
* This method will be called from the drawing thread, with the current
* frame, right before the frame is blitted to the screen. All 3rd party
* calculations that occur here are delaying the timely delivery of the
* frame to the screen. They should be as optimized as possible. pInFrame
* is the input frame buffer pOutFrame should be set to contain the output
* data on return, and destRect is provided so that the 3rd party can make
* sense of mouse events, but cannot be changed and does not have any
* direct bearing on image size. srcRect is provided for inspection only
* for compatibility with the possible future addition of unfixed size
* input frames. The client is responcible for maintaining and freeing
* the memory which they return in pOutFrame. Simply setting pOutFrame to
* pInFrame is acceptable for in-place modifications as a result since it
* will still only be freed the requisite one time.
***/
STDMETHOD(OnVideoFrame) (THIS_
UCHAR* /* In */ pInFrame,
ULONG32 /* In */ ulTimeStamp,
REF(HXxRect) /* In */ srcRect,
REF(HXxRect) /* In */ destRect,
REF(UCHAR*) /* Out */ pOutFrame) PURE;
/***
* IHXVideoHook::HandleHookEvent
***
* This method provides a quick pass through by which events received by
* the IHXVideoHookSink, such as mouse clicks, can be handed on to
* registered IHXVideoHook objects. Hook objects can use or ignore this
* information but setting the handled member of the passed HXxEvent is
* not allowed.
***/
STDMETHOD(HandleHookEvent) (THIS_
HXxEvent* pEvent) PURE;
/***
* IHXVideoHook::GetProperties
***
* This method provides a way for holders of an IHXVideoHook object to
* query it for descriptive information. Suggested property bindings are:
* "Description" - CString describing plugin functionality.
* "Copyright" - CString copyright notice.
* "MoreInfo" - CString URL for obtaining more info.
* "Version" - ULONG32 version number.
* "InputFormat" - IHXBuffer containing input HXBitmapInfoHeader
* flattened as UCHAR array.
* "OutputFormat" - IHXBuffer containing output HXBitmapInfoHeader
* flattened as UCHAR array.
* Others can obviously be included for specific hook-hook
* communications, and more may also be required.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -