1 |
bearsoft |
1.1 |
//------------------------------------------------------------------------------
|
2 |
|
|
// File: AMVideo.h
|
3 |
|
|
//
|
4 |
|
|
// Desc: Video related definitions and interfaces for ActiveMovie.
|
5 |
|
|
//
|
6 |
|
|
// Copyright (c) 1992 - 2000, Microsoft Corporation. All rights reserved.
|
7 |
|
|
//------------------------------------------------------------------------------
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
#ifndef __AMVIDEO__
|
11 |
|
|
#define __AMVIDEO__
|
12 |
|
|
|
13 |
|
|
#ifdef __cplusplus
|
14 |
|
|
extern "C" {
|
15 |
|
|
#endif // __cplusplus
|
16 |
|
|
|
17 |
|
|
#include <ddraw.h>
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
// This is an interface on the video renderer that provides information about
|
21 |
|
|
// DirectDraw with respect to its use by the renderer. For example it allows
|
22 |
|
|
// an application to get details of the surface and any hardware capabilities
|
23 |
|
|
// that are available. It also allows someone to adjust the surfaces that the
|
24 |
|
|
// renderer should use and furthermore even set the DirectDraw instance. We
|
25 |
|
|
// allow someone to set the DirectDraw instance because DirectDraw can only
|
26 |
|
|
// be opened once per process so it helps resolve conflicts. There is some
|
27 |
|
|
// duplication in this interface as the hardware/emulated/FOURCCs available
|
28 |
|
|
// can all be found through the IDirectDraw interface, this interface allows
|
29 |
|
|
// simple access to that information without calling the DirectDraw provider
|
30 |
|
|
// itself. The AMDDS prefix is ActiveMovie DirectDraw Switches abbreviated.
|
31 |
|
|
|
32 |
|
|
#define AMDDS_NONE 0x00 // No use for DCI/DirectDraw
|
33 |
|
|
#define AMDDS_DCIPS 0x01 // Use DCI primary surface
|
34 |
|
|
#define AMDDS_PS 0x02 // Use DirectDraw primary
|
35 |
|
|
#define AMDDS_RGBOVR 0x04 // RGB overlay surfaces
|
36 |
|
|
#define AMDDS_YUVOVR 0x08 // YUV overlay surfaces
|
37 |
|
|
#define AMDDS_RGBOFF 0x10 // RGB offscreen surfaces
|
38 |
|
|
#define AMDDS_YUVOFF 0x20 // YUV offscreen surfaces
|
39 |
|
|
#define AMDDS_RGBFLP 0x40 // RGB flipping surfaces
|
40 |
|
|
#define AMDDS_YUVFLP 0x80 // YUV flipping surfaces
|
41 |
|
|
#define AMDDS_ALL 0xFF // ALL the previous flags
|
42 |
|
|
#define AMDDS_DEFAULT AMDDS_ALL // Use all available surfaces
|
43 |
|
|
|
44 |
|
|
#define AMDDS_YUV (AMDDS_YUVOFF | AMDDS_YUVOVR | AMDDS_YUVFLP)
|
45 |
|
|
#define AMDDS_RGB (AMDDS_RGBOFF | AMDDS_RGBOVR | AMDDS_RGBFLP)
|
46 |
|
|
#define AMDDS_PRIMARY (AMDDS_DCIPS | AMDDS_PS)
|
47 |
|
|
|
48 |
|
|
// be nice to our friends in C
|
49 |
|
|
#undef INTERFACE
|
50 |
|
|
#define INTERFACE IDirectDrawVideo
|
51 |
|
|
|
52 |
|
|
DECLARE_INTERFACE_(IDirectDrawVideo, IUnknown)
|
53 |
|
|
{
|
54 |
|
|
// IUnknown methods
|
55 |
|
|
|
56 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
|
57 |
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
58 |
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
59 |
|
|
|
60 |
|
|
// IDirectDrawVideo methods
|
61 |
|
|
|
62 |
|
|
STDMETHOD(GetSwitches)(THIS_ DWORD *pSwitches) PURE;
|
63 |
|
|
STDMETHOD(SetSwitches)(THIS_ DWORD Switches) PURE;
|
64 |
|
|
STDMETHOD(GetCaps)(THIS_ DDCAPS *pCaps) PURE;
|
65 |
|
|
STDMETHOD(GetEmulatedCaps)(THIS_ DDCAPS *pCaps) PURE;
|
66 |
|
|
STDMETHOD(GetSurfaceDesc)(THIS_ DDSURFACEDESC *pSurfaceDesc) PURE;
|
67 |
|
|
STDMETHOD(GetFourCCCodes)(THIS_ DWORD *pCount,DWORD *pCodes) PURE;
|
68 |
|
|
STDMETHOD(SetDirectDraw)(THIS_ LPDIRECTDRAW pDirectDraw) PURE;
|
69 |
|
|
STDMETHOD(GetDirectDraw)(THIS_ LPDIRECTDRAW *ppDirectDraw) PURE;
|
70 |
|
|
STDMETHOD(GetSurfaceType)(THIS_ DWORD *pSurfaceType) PURE;
|
71 |
|
|
STDMETHOD(SetDefault)(THIS) PURE;
|
72 |
|
|
STDMETHOD(UseScanLine)(THIS_ long UseScanLine) PURE;
|
73 |
|
|
STDMETHOD(CanUseScanLine)(THIS_ long *UseScanLine) PURE;
|
74 |
|
|
STDMETHOD(UseOverlayStretch)(THIS_ long UseOverlayStretch) PURE;
|
75 |
|
|
STDMETHOD(CanUseOverlayStretch)(THIS_ long *UseOverlayStretch) PURE;
|
76 |
|
|
STDMETHOD(UseWhenFullScreen)(THIS_ long UseWhenFullScreen) PURE;
|
77 |
|
|
STDMETHOD(WillUseFullScreen)(THIS_ long *UseWhenFullScreen) PURE;
|
78 |
|
|
};
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
// be nice to our friends in C
|
82 |
|
|
#undef INTERFACE
|
83 |
|
|
#define INTERFACE IQualProp
|
84 |
|
|
|
85 |
|
|
DECLARE_INTERFACE_(IQualProp, IUnknown)
|
86 |
|
|
{
|
87 |
|
|
// IUnknown methods
|
88 |
|
|
|
89 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
|
90 |
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
91 |
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
92 |
|
|
|
93 |
|
|
// Compare these with the functions in class CGargle in gargle.h
|
94 |
|
|
|
95 |
|
|
STDMETHOD(get_FramesDroppedInRenderer)(THIS_ int *pcFrames) PURE; // Out
|
96 |
|
|
STDMETHOD(get_FramesDrawn)(THIS_ int *pcFramesDrawn) PURE; // Out
|
97 |
|
|
STDMETHOD(get_AvgFrameRate)(THIS_ int *piAvgFrameRate) PURE; // Out
|
98 |
|
|
STDMETHOD(get_Jitter)(THIS_ int *iJitter) PURE; // Out
|
99 |
|
|
STDMETHOD(get_AvgSyncOffset)(THIS_ int *piAvg) PURE; // Out
|
100 |
|
|
STDMETHOD(get_DevSyncOffset)(THIS_ int *piDev) PURE; // Out
|
101 |
|
|
};
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
// This interface allows an application or plug in distributor to control a
|
105 |
|
|
// full screen renderer. The Modex renderer supports this interface. When
|
106 |
|
|
// connected a renderer should load the display modes it has available
|
107 |
|
|
// The number of modes available can be obtained through CountModes. Then
|
108 |
|
|
// information on each individual mode is available by calling GetModeInfo
|
109 |
|
|
// and IsModeAvailable. An application may enable and disable any modes
|
110 |
|
|
// by calling the SetEnabled flag with OATRUE or OAFALSE (not C/C++ TRUE
|
111 |
|
|
// and FALSE values) - the current value may be queried by IsModeEnabled
|
112 |
|
|
|
113 |
|
|
// A more generic way of setting the modes enabled that is easier to use
|
114 |
|
|
// when writing applications is the clip loss factor. This defines the
|
115 |
|
|
// amount of video that can be lost when deciding which display mode to
|
116 |
|
|
// use. Assuming the decoder cannot compress the video then playing an
|
117 |
|
|
// MPEG file (say 352x288) into a 320x200 display will lose about 25% of
|
118 |
|
|
// the image. The clip loss factor specifies the upper range permissible.
|
119 |
|
|
// To allow typical MPEG video to be played in 320x200 it defaults to 25%
|
120 |
|
|
|
121 |
|
|
// be nice to our friends in C
|
122 |
|
|
#undef INTERFACE
|
123 |
|
|
#define INTERFACE IFullScreenVideo
|
124 |
|
|
|
125 |
|
|
DECLARE_INTERFACE_(IFullScreenVideo, IUnknown)
|
126 |
|
|
{
|
127 |
|
|
// IUnknown methods
|
128 |
|
|
|
129 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
|
130 |
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
131 |
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
132 |
|
|
|
133 |
|
|
// IFullScreenVideo methods
|
134 |
|
|
|
135 |
|
|
STDMETHOD(CountModes)(THIS_ long *pModes) PURE;
|
136 |
|
|
STDMETHOD(GetModeInfo)(THIS_ long Mode,long *pWidth,long *pHeight,long *pDepth) PURE;
|
137 |
|
|
STDMETHOD(GetCurrentMode)(THIS_ long *pMode) PURE;
|
138 |
|
|
STDMETHOD(IsModeAvailable)(THIS_ long Mode) PURE;
|
139 |
|
|
STDMETHOD(IsModeEnabled)(THIS_ long Mode) PURE;
|
140 |
|
|
STDMETHOD(SetEnabled)(THIS_ long Mode,long bEnabled) PURE;
|
141 |
|
|
STDMETHOD(GetClipFactor)(THIS_ long *pClipFactor) PURE;
|
142 |
|
|
STDMETHOD(SetClipFactor)(THIS_ long ClipFactor) PURE;
|
143 |
|
|
STDMETHOD(SetMessageDrain)(THIS_ HWND hwnd) PURE;
|
144 |
|
|
STDMETHOD(GetMessageDrain)(THIS_ HWND *hwnd) PURE;
|
145 |
|
|
STDMETHOD(SetMonitor)(THIS_ long Monitor) PURE;
|
146 |
|
|
STDMETHOD(GetMonitor)(THIS_ long *Monitor) PURE;
|
147 |
|
|
STDMETHOD(HideOnDeactivate)(THIS_ long Hide) PURE;
|
148 |
|
|
STDMETHOD(IsHideOnDeactivate)(THIS) PURE;
|
149 |
|
|
STDMETHOD(SetCaption)(THIS_ BSTR strCaption) PURE;
|
150 |
|
|
STDMETHOD(GetCaption)(THIS_ BSTR *pstrCaption) PURE;
|
151 |
|
|
STDMETHOD(SetDefault)(THIS) PURE;
|
152 |
|
|
};
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
// This adds the accelerator table capabilities in fullscreen. This is being
|
156 |
|
|
// added between the original runtime release and the full SDK release. We
|
157 |
|
|
// cannot just add the method to IFullScreenVideo as we don't want to force
|
158 |
|
|
// applications to have to ship the ActiveMovie support DLLs - this is very
|
159 |
|
|
// important to applications that plan on being downloaded over the Internet
|
160 |
|
|
|
161 |
|
|
// be nice to our friends in C
|
162 |
|
|
#undef INTERFACE
|
163 |
|
|
#define INTERFACE IFullScreenVideoEx
|
164 |
|
|
|
165 |
|
|
DECLARE_INTERFACE_(IFullScreenVideoEx, IFullScreenVideo)
|
166 |
|
|
{
|
167 |
|
|
// IUnknown methods
|
168 |
|
|
|
169 |
|
|
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppvObj) PURE;
|
170 |
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
171 |
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
172 |
|
|
|
173 |
|
|
// IFullScreenVideo methods
|
174 |
|
|
|
175 |
|
|
STDMETHOD(CountModes)(THIS_ long *pModes) PURE;
|
176 |
|
|
STDMETHOD(GetModeInfo)(THIS_ long Mode,long *pWidth,long *pHeight,long *pDepth) PURE;
|
177 |
|
|
STDMETHOD(GetCurrentMode)(THIS_ long *pMode) PURE;
|
178 |
|
|
STDMETHOD(IsModeAvailable)(THIS_ long Mode) PURE;
|
179 |
|
|
STDMETHOD(IsModeEnabled)(THIS_ long Mode) PURE;
|
180 |
|
|
STDMETHOD(SetEnabled)(THIS_ long Mode,long bEnabled) PURE;
|
181 |
|
|
STDMETHOD(GetClipFactor)(THIS_ long *pClipFactor) PURE;
|
182 |
|
|
STDMETHOD(SetClipFactor)(THIS_ long ClipFactor) PURE;
|
183 |
|
|
STDMETHOD(SetMessageDrain)(THIS_ HWND hwnd) PURE;
|
184 |
|
|
STDMETHOD(GetMessageDrain)(THIS_ HWND *hwnd) PURE;
|
185 |
|
|
STDMETHOD(SetMonitor)(THIS_ long Monitor) PURE;
|
186 |
|
|
STDMETHOD(GetMonitor)(THIS_ long *Monitor) PURE;
|
187 |
|
|
STDMETHOD(HideOnDeactivate)(THIS_ long Hide) PURE;
|
188 |
|
|
STDMETHOD(IsHideOnDeactivate)(THIS) PURE;
|
189 |
|
|
STDMETHOD(SetCaption)(THIS_ BSTR strCaption) PURE;
|
190 |
|
|
STDMETHOD(GetCaption)(THIS_ BSTR *pstrCaption) PURE;
|
191 |
|
|
STDMETHOD(SetDefault)(THIS) PURE;
|
192 |
|
|
|
193 |
|
|
// IFullScreenVideoEx
|
194 |
|
|
|
195 |
|
|
STDMETHOD(SetAcceleratorTable)(THIS_ HWND hwnd,HACCEL hAccel) PURE;
|
196 |
|
|
STDMETHOD(GetAcceleratorTable)(THIS_ HWND *phwnd,HACCEL *phAccel) PURE;
|
197 |
|
|
STDMETHOD(KeepPixelAspectRatio)(THIS_ long KeepAspect) PURE;
|
198 |
|
|
STDMETHOD(IsKeepPixelAspectRatio)(THIS_ long *pKeepAspect) PURE;
|
199 |
|
|
};
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
// The SDK base classes contain a base video mixer class. Video mixing in a
|
203 |
|
|
// software environment is tricky because we typically have multiple streams
|
204 |
|
|
// each sending data at unpredictable times. To work with this we defined a
|
205 |
|
|
// pin that is the lead pin, when data arrives on this pin we do a mix. As
|
206 |
|
|
// an alternative we may not want to have a lead pin but output samples at
|
207 |
|
|
// predefined spaces, like one every 1/15 of a second, this interfaces also
|
208 |
|
|
// supports that mode of operations (there is a working video mixer sample)
|
209 |
|
|
|
210 |
|
|
// be nice to our friends in C
|
211 |
|
|
#undef INTERFACE
|
212 |
|
|
#define INTERFACE IBaseVideoMixer
|
213 |
|
|
|
214 |
|
|
DECLARE_INTERFACE_(IBaseVideoMixer, IUnknown)
|
215 |
|
|
{
|
216 |
|
|
STDMETHOD(SetLeadPin)(THIS_ int iPin) PURE;
|
217 |
|
|
STDMETHOD(GetLeadPin)(THIS_ int *piPin) PURE;
|
218 |
|
|
STDMETHOD(GetInputPinCount)(THIS_ int *piPinCount) PURE;
|
219 |
|
|
STDMETHOD(IsUsingClock)(THIS_ int *pbValue) PURE;
|
220 |
|
|
STDMETHOD(SetUsingClock)(THIS_ int bValue) PURE;
|
221 |
|
|
STDMETHOD(GetClockPeriod)(THIS_ int *pbValue) PURE;
|
222 |
|
|
STDMETHOD(SetClockPeriod)(THIS_ int bValue) PURE;
|
223 |
|
|
};
|
224 |
|
|
|
225 |
|
|
#define iPALETTE_COLORS 256 // Maximum colours in palette
|
226 |
|
|
#define iEGA_COLORS 16 // Number colours in EGA palette
|
227 |
|
|
#define iMASK_COLORS 3 // Maximum three components
|
228 |
|
|
#define iTRUECOLOR 16 // Minimum true colour device
|
229 |
|
|
#define iRED 0 // Index position for RED mask
|
230 |
|
|
#define iGREEN 1 // Index position for GREEN mask
|
231 |
|
|
#define iBLUE 2 // Index position for BLUE mask
|
232 |
|
|
#define iPALETTE 8 // Maximum colour depth using a palette
|
233 |
|
|
#define iMAXBITS 8 // Maximum bits per colour component
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
// Used for true colour images that also have a palette
|
237 |
|
|
|
238 |
|
|
typedef struct tag_TRUECOLORINFO {
|
239 |
|
|
DWORD dwBitMasks[iMASK_COLORS];
|
240 |
|
|
RGBQUAD bmiColors[iPALETTE_COLORS];
|
241 |
|
|
} TRUECOLORINFO;
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
// The BITMAPINFOHEADER contains all the details about the video stream such
|
245 |
|
|
// as the actual image dimensions and their pixel depth. A source filter may
|
246 |
|
|
// also request that the sink take only a section of the video by providing a
|
247 |
|
|
// clipping rectangle in rcSource. In the worst case where the sink filter
|
248 |
|
|
// forgets to check this on connection it will simply render the whole thing
|
249 |
|
|
// which isn't a disaster. Ideally a sink filter will check the rcSource and
|
250 |
|
|
// if it doesn't support image extraction and the rectangle is not empty then
|
251 |
|
|
// it will reject the connection. A filter should use SetRectEmpty to reset a
|
252 |
|
|
// rectangle to all zeroes (and IsRectEmpty to later check the rectangle).
|
253 |
|
|
// The rcTarget specifies the destination rectangle for the video, for most
|
254 |
|
|
// source filters they will set this to all zeroes, a downstream filter may
|
255 |
|
|
// request that the video be placed in a particular area of the buffers it
|
256 |
|
|
// supplies in which case it will call QueryAccept with a non empty target
|
257 |
|
|
|
258 |
|
|
typedef struct tagVIDEOINFOHEADER {
|
259 |
|
|
|
260 |
|
|
RECT rcSource; // The bit we really want to use
|
261 |
|
|
RECT rcTarget; // Where the video should go
|
262 |
|
|
DWORD dwBitRate; // Approximate bit data rate
|
263 |
|
|
DWORD dwBitErrorRate; // Bit error rate for this stream
|
264 |
|
|
REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units)
|
265 |
|
|
|
266 |
|
|
BITMAPINFOHEADER bmiHeader;
|
267 |
|
|
|
268 |
|
|
} VIDEOINFOHEADER;
|
269 |
|
|
|
270 |
|
|
// make sure the pbmi is initialized before using these macros
|
271 |
|
|
#define TRUECOLOR(pbmi) ((TRUECOLORINFO *)(((LPBYTE)&((pbmi)->bmiHeader)) \
|
272 |
|
|
+ (pbmi)->bmiHeader.biSize))
|
273 |
|
|
#define COLORS(pbmi) ((RGBQUAD *)(((LPBYTE)&((pbmi)->bmiHeader)) \
|
274 |
|
|
+ (pbmi)->bmiHeader.biSize))
|
275 |
|
|
#define BITMASKS(pbmi) ((DWORD *)(((LPBYTE)&((pbmi)->bmiHeader)) \
|
276 |
|
|
+ (pbmi)->bmiHeader.biSize))
|
277 |
|
|
|
278 |
|
|
// All the image based filters use this to communicate their media types. It's
|
279 |
|
|
// centred principally around the BITMAPINFO. This structure always contains a
|
280 |
|
|
// BITMAPINFOHEADER followed by a number of other fields depending on what the
|
281 |
|
|
// BITMAPINFOHEADER contains. If it contains details of a palettised format it
|
282 |
|
|
// will be followed by one or more RGBQUADs defining the palette. If it holds
|
283 |
|
|
// details of a true colour format then it may be followed by a set of three
|
284 |
|
|
// DWORD bit masks that specify where the RGB data can be found in the image
|
285 |
|
|
// (For more information regarding BITMAPINFOs see the Win32 documentation)
|
286 |
|
|
|
287 |
|
|
// The rcSource and rcTarget fields are not for use by filters supplying the
|
288 |
|
|
// data. The destination (target) rectangle should be set to all zeroes. The
|
289 |
|
|
// source may also be zero filled or set with the dimensions of the video. So
|
290 |
|
|
// if the video is 352x288 pixels then set it to (0,0,352,288). These fields
|
291 |
|
|
// are mainly used by downstream filters that want to ask the source filter
|
292 |
|
|
// to place the image in a different position in an output buffer. So when
|
293 |
|
|
// using for example the primary surface the video renderer may ask a filter
|
294 |
|
|
// to place the video images in a destination position of (100,100,452,388)
|
295 |
|
|
// on the display since that's where the window is positioned on the display
|
296 |
|
|
|
297 |
|
|
// !!! WARNING !!!
|
298 |
|
|
// DO NOT use this structure unless you are sure that the BITMAPINFOHEADER
|
299 |
|
|
// has a normal biSize == sizeof(BITMAPINFOHEADER) !
|
300 |
|
|
// !!! WARNING !!!
|
301 |
|
|
|
302 |
|
|
typedef struct tagVIDEOINFO {
|
303 |
|
|
|
304 |
|
|
RECT rcSource; // The bit we really want to use
|
305 |
|
|
RECT rcTarget; // Where the video should go
|
306 |
|
|
DWORD dwBitRate; // Approximate bit data rate
|
307 |
|
|
DWORD dwBitErrorRate; // Bit error rate for this stream
|
308 |
|
|
REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units)
|
309 |
|
|
|
310 |
|
|
BITMAPINFOHEADER bmiHeader;
|
311 |
|
|
|
312 |
|
|
union {
|
313 |
|
|
RGBQUAD bmiColors[iPALETTE_COLORS]; // Colour palette
|
314 |
|
|
DWORD dwBitMasks[iMASK_COLORS]; // True colour masks
|
315 |
|
|
TRUECOLORINFO TrueColorInfo; // Both of the above
|
316 |
|
|
};
|
317 |
|
|
|
318 |
|
|
} VIDEOINFO;
|
319 |
|
|
|
320 |
|
|
// These macros define some standard bitmap format sizes
|
321 |
|
|
|
322 |
|
|
#define SIZE_EGA_PALETTE (iEGA_COLORS * sizeof(RGBQUAD))
|
323 |
|
|
#define SIZE_PALETTE (iPALETTE_COLORS * sizeof(RGBQUAD))
|
324 |
|
|
#define SIZE_MASKS (iMASK_COLORS * sizeof(DWORD))
|
325 |
|
|
#define SIZE_PREHEADER (FIELD_OFFSET(VIDEOINFOHEADER,bmiHeader))
|
326 |
|
|
#define SIZE_VIDEOHEADER (sizeof(BITMAPINFOHEADER) + SIZE_PREHEADER)
|
327 |
|
|
// !!! for abnormal biSizes
|
328 |
|
|
// #define SIZE_VIDEOHEADER(pbmi) ((pbmi)->bmiHeader.biSize + SIZE_PREHEADER)
|
329 |
|
|
|
330 |
|
|
// DIBSIZE calculates the number of bytes required by an image
|
331 |
|
|
|
332 |
|
|
#define WIDTHBYTES(bits) ((DWORD)(((bits)+31) & (~31)) / 8)
|
333 |
|
|
#define DIBWIDTHBYTES(bi) (DWORD)WIDTHBYTES((DWORD)(bi).biWidth * (DWORD)(bi).biBitCount)
|
334 |
|
|
#define _DIBSIZE(bi) (DIBWIDTHBYTES(bi) * (DWORD)(bi).biHeight)
|
335 |
|
|
#define DIBSIZE(bi) ((bi).biHeight < 0 ? (-1)*(_DIBSIZE(bi)) : _DIBSIZE(bi))
|
336 |
|
|
|
337 |
|
|
// This compares the bit masks between two VIDEOINFOHEADERs
|
338 |
|
|
|
339 |
|
|
#define BIT_MASKS_MATCH(pbmi1,pbmi2) \
|
340 |
|
|
(((pbmi1)->dwBitMasks[iRED] == (pbmi2)->dwBitMasks[iRED]) && \
|
341 |
|
|
((pbmi1)->dwBitMasks[iGREEN] == (pbmi2)->dwBitMasks[iGREEN]) && \
|
342 |
|
|
((pbmi1)->dwBitMasks[iBLUE] == (pbmi2)->dwBitMasks[iBLUE]))
|
343 |
|
|
|
344 |
|
|
// These zero fill different parts of the VIDEOINFOHEADER structure
|
345 |
|
|
|
346 |
|
|
// Only use these macros for pbmi's with a normal BITMAPINFOHEADER biSize
|
347 |
|
|
#define RESET_MASKS(pbmi) (ZeroMemory((PVOID)(pbmi)->dwBitFields,SIZE_MASKS))
|
348 |
|
|
#define RESET_HEADER(pbmi) (ZeroMemory((PVOID)(pbmi),SIZE_VIDEOHEADER))
|
349 |
|
|
#define RESET_PALETTE(pbmi) (ZeroMemory((PVOID)(pbmi)->bmiColors,SIZE_PALETTE));
|
350 |
|
|
|
351 |
|
|
#if 0
|
352 |
|
|
// !!! This is the right way to do it, but may break existing code
|
353 |
|
|
#define RESET_MASKS(pbmi) (ZeroMemory((PVOID)(((LPBYTE)(pbmi)->bmiHeader) + \
|
354 |
|
|
(pbmi)->bmiHeader.biSize,SIZE_MASKS)))
|
355 |
|
|
#define RESET_HEADER(pbmi) (ZeroMemory((PVOID)(pbmi), SIZE_PREHEADER + \
|
356 |
|
|
sizeof(BITMAPINFOHEADER)))
|
357 |
|
|
#define RESET_PALETTE(pbmi) (ZeroMemory((PVOID)(((LPBYTE)(pbmi)->bmiHeader) + \
|
358 |
|
|
(pbmi)->bmiHeader.biSize,SIZE_PALETTE))
|
359 |
|
|
#endif
|
360 |
|
|
|
361 |
|
|
// Other (hopefully) useful bits and bobs
|
362 |
|
|
|
363 |
|
|
#define PALETTISED(pbmi) ((pbmi)->bmiHeader.biBitCount <= iPALETTE)
|
364 |
|
|
#define PALETTE_ENTRIES(pbmi) ((DWORD) 1 << (pbmi)->bmiHeader.biBitCount)
|
365 |
|
|
|
366 |
|
|
// Returns the address of the BITMAPINFOHEADER from the VIDEOINFOHEADER
|
367 |
|
|
#define HEADER(pVideoInfo) (&(((VIDEOINFOHEADER *) (pVideoInfo))->bmiHeader))
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
// MPEG variant - includes a DWORD length followed by the
|
371 |
|
|
// video sequence header after the video header.
|
372 |
|
|
//
|
373 |
|
|
// The sequence header includes the sequence header start code and the
|
374 |
|
|
// quantization matrices associated with the first sequence header in the
|
375 |
|
|
// stream so is a maximum of 140 bytes long.
|
376 |
|
|
|
377 |
|
|
typedef struct tagMPEG1VIDEOINFO {
|
378 |
|
|
|
379 |
|
|
VIDEOINFOHEADER hdr; // Compatible with VIDEOINFO
|
380 |
|
|
DWORD dwStartTimeCode; // 25-bit Group of pictures time code
|
381 |
|
|
// at start of data
|
382 |
|
|
DWORD cbSequenceHeader; // Length in bytes of bSequenceHeader
|
383 |
|
|
BYTE bSequenceHeader[1]; // Sequence header including
|
384 |
|
|
// quantization matrices if any
|
385 |
|
|
} MPEG1VIDEOINFO;
|
386 |
|
|
|
387 |
|
|
#define MAX_SIZE_MPEG1_SEQUENCE_INFO 140
|
388 |
|
|
#define SIZE_MPEG1VIDEOINFO(pv) (FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader[0]) + (pv)->cbSequenceHeader)
|
389 |
|
|
#define MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader)
|
390 |
|
|
|
391 |
|
|
|
392 |
|
|
// Analog video variant - Use this when the format is FORMAT_AnalogVideo
|
393 |
|
|
//
|
394 |
|
|
// rcSource defines the portion of the active video signal to use
|
395 |
|
|
// rcTarget defines the destination rectangle
|
396 |
|
|
// both of the above are relative to the dwActiveWidth and dwActiveHeight fields
|
397 |
|
|
// dwActiveWidth is currently set to 720 for all formats (but could change for HDTV)
|
398 |
|
|
// dwActiveHeight is 483 for NTSC and 575 for PAL/SECAM (but could change for HDTV)
|
399 |
|
|
|
400 |
|
|
typedef struct tagAnalogVideoInfo {
|
401 |
|
|
RECT rcSource; // Width max is 720, height varies w/ TransmissionStd
|
402 |
|
|
RECT rcTarget; // Where the video should go
|
403 |
|
|
DWORD dwActiveWidth; // Always 720 (CCIR-601 active samples per line)
|
404 |
|
|
DWORD dwActiveHeight; // 483 for NTSC, 575 for PAL/SECAM
|
405 |
|
|
REFERENCE_TIME AvgTimePerFrame; // Normal ActiveMovie units (100 nS)
|
406 |
|
|
} ANALOGVIDEOINFO;
|
407 |
|
|
|
408 |
|
|
//
|
409 |
|
|
// AM_KSPROPSETID_FrameStep property set definitions
|
410 |
|
|
//
|
411 |
|
|
typedef enum {
|
412 |
|
|
// Step
|
413 |
|
|
AM_PROPERTY_FRAMESTEP_STEP = 0x01,
|
414 |
|
|
AM_PROPERTY_FRAMESTEP_CANCEL = 0x02,
|
415 |
|
|
|
416 |
|
|
// S_OK for these 2 means we can - S_FALSE if we can't
|
417 |
|
|
AM_PROPERTY_FRAMESTEP_CANSTEP = 0x03,
|
418 |
|
|
AM_PROPERTY_FRAMESTEP_CANSTEPMULTIPLE = 0x04
|
419 |
|
|
} AM_PROPERTY_FRAMESTEP;
|
420 |
|
|
|
421 |
|
|
typedef struct _AM_FRAMESTEP_STEP
|
422 |
|
|
{
|
423 |
|
|
// 1 means step 1 frame forward
|
424 |
|
|
// 0 is invalid
|
425 |
|
|
// n (n > 1) means skip n - 1 frames and show the nth
|
426 |
|
|
DWORD dwFramesToStep;
|
427 |
|
|
} AM_FRAMESTEP_STEP;
|
428 |
|
|
|
429 |
|
|
#ifdef __cplusplus
|
430 |
|
|
}
|
431 |
|
|
#endif // __cplusplus
|
432 |
|
|
#endif // __AMVIDEO__
|
433 |
|
|
|