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