1 #ifndef MPLAYER_COMPONENTS_H
2 #define MPLAYER_COMPONENTS_H
3
4 #include <inttypes.h>
5
6 #include "mppacked.h"
7
8 // Basic types:
9
10 typedef char * Ptr;
11 typedef Ptr * Handle;
12 typedef int32_t Size;
13 typedef unsigned char Boolean;
14 typedef unsigned char Str31[32];
15 typedef int32_t Fixed;
16
17 typedef int16_t OSErr;
18 typedef int OSType;
19
20 typedef int32_t ComponentResult;
21 typedef unsigned char UInt8;
22 typedef signed char SInt8;
23 typedef unsigned short UInt16;
24 typedef signed short SInt16;
25 typedef uint32_t UInt32;
26 typedef int32_t SInt32;
27
28 #define FOUR_CHAR_CODE(a,b,c,d) ((uint32_t)(a)<<24 | (uint32_t)(b)<<16 | (uint32_t)(c)<<8 | (uint32_t)(d)) /* otherwise compiler will complain about values with high bit set */
29
30 // codec private shit:
31 typedef void *GlobalsPtr;
32 typedef void **Globals;
33
34 enum {
35 kInitializeQTMLNoSoundFlag = (1L << 0),
36 kInitializeQTMLUseGDIFlag = (1L << 1),
37 kInitializeQTMLDisableDirectSound = (1L << 2),
38 kInitializeQTMLUseExclusiveFullScreenModeFlag = (1L << 3),
39 kInitializeQTMLDisableDDClippers = (1L << 4)
40 };
41
42 //==================== COMPONENTS ===========================
43
44 MP_PACKED(
45 struct, ComponentParameters {
46 UInt8 flags; /* call modifiers: sync/async, deferred, immed, etc */
47 UInt8 paramSize; /* size in bytes of actual parameters passed to this call */
48 short what; /* routine selector, negative for Component management calls */
49 int32_t params[1]; /* actual parameters for the indicated routine */
50 };
51 )
52 typedef struct ComponentParameters ComponentParameters;
53
54
55 MP_PACKED(
56 struct, ComponentDescription {
57 OSType componentType; /* A unique 4-byte code indentifying the command set */
58 OSType componentSubType; /* Particular flavor of this instance */
59 OSType componentManufacturer; /* Vendor indentification */
60 uint32_t componentFlags; /* 8 each for Component,Type,SubType,Manuf/revision */
61 uint32_t componentFlagsMask; /* Mask for specifying which flags to consider in search, zero during registration */
62 };
63 )
64 typedef struct ComponentDescription ComponentDescription;
65
66
67 MP_PACKED(
68 struct, ResourceSpec {
69 OSType resType; /* 4-byte code */
70 short resID; /* */
71 };
72 )
73 typedef struct ResourceSpec ResourceSpec;
74
75
76 MP_PACKED(
77 struct, ComponentResource {
78 ComponentDescription cd; /* Registration parameters */
79 ResourceSpec component; /* resource where Component code is found */
80 ResourceSpec componentName; /* name string resource */
81 ResourceSpec componentInfo; /* info string resource */
82 ResourceSpec componentIcon; /* icon resource */
83 };
84 )
85 typedef struct ComponentResource ComponentResource;
86 typedef ComponentResource * ComponentResourcePtr;
87 typedef ComponentResourcePtr * ComponentResourceHandle;
88
89
90 MP_PACKED(
91 struct, ComponentRecord {
92 int32_t data[1];
93 };
94 )
95 typedef struct ComponentRecord ComponentRecord;
96 typedef ComponentRecord * Component;
97
98
99 MP_PACKED(
100 struct, ComponentInstanceRecord {
101 int32_t data[1];
102 };
103 )
104 typedef struct ComponentInstanceRecord ComponentInstanceRecord;
105
106 typedef ComponentInstanceRecord * ComponentInstance;
107
108 // ========================= QUICKDRAW =========================
109
110 MP_PACKED(
111 struct, Rect {
112 short top;
113 short left;
114 short bottom;
115 short right;
116 };
117 )
118 typedef struct Rect Rect;
119 typedef Rect * RectPtr;
120
121 MP_PACKED(
122 struct, RGBColor {
123 unsigned short red; /*magnitude of red component*/
124 unsigned short green; /*magnitude of green component*/
125 unsigned short blue; /*magnitude of blue component*/
126 };
127 )
128 typedef struct RGBColor RGBColor;
129 typedef RGBColor * RGBColorPtr;
130 typedef RGBColorPtr * RGBColorHdl;
131
132 MP_PACKED(
133 struct, ColorSpec {
134 short value; /*index or other value*/
135 RGBColor rgb; /*true color*/
136 };
137 )
138 typedef struct ColorSpec ColorSpec;
139 typedef ColorSpec * ColorSpecPtr;
140 typedef ColorSpec CSpecArray[1];
141
142 MP_PACKED(
143 struct, ColorTable {
144 int32_t ctSeed; /*unique identifier for table*/
145 short ctFlags; /*high bit: 0 = PixMap; 1 = device*/
146 short ctSize; /*number of entries in CTTable*/
147 CSpecArray ctTable; /*array [0..0] of ColorSpec*/
148 };
149 )
150 typedef struct ColorTable ColorTable;
151 typedef ColorTable * CTabPtr;
152 typedef CTabPtr * CTabHandle;
153
154 MP_PACKED(
155 struct, MatrixRecord {
156 Fixed matrix[3][3];
157 };
158 )
159 typedef struct MatrixRecord MatrixRecord;
160 typedef MatrixRecord * MatrixRecordPtr;
161
162 typedef int32_t ImageSequence;
163 typedef OSType CodecType;
164 typedef unsigned short CodecFlags;
165 typedef uint32_t CodecQ;
166
167 MP_PACKED(
168 struct, ImageDescription {
169 int32_t idSize; /* total size of ImageDescription including extra data ( CLUTs and other per sequence data ) */
170 CodecType cType; /* what kind of codec compressed this data */
171 int32_t resvd1; /* reserved for Apple use */
172 short resvd2; /* reserved for Apple use */
173 short dataRefIndex; /* set to zero */
174 short version; /* which version is this data */
175 short revisionLevel; /* what version of that codec did this */
176 int32_t vendor; /* whose codec compressed this data */
177 CodecQ temporalQuality; /* what was the temporal quality factor */
178 CodecQ spatialQuality; /* what was the spatial quality factor */
179 short width; /* how many pixels wide is this data */
180 short height; /* how many pixels high is this data */
181 Fixed hRes; /* horizontal resolution */
182 Fixed vRes; /* vertical resolution */
183 int32_t dataSize; /* if known, the size of data for this image descriptor */
184 short frameCount; /* number of frames this description applies to */
185 Str31 name; /* name of codec ( in case not installed ) */
186 short depth; /* what depth is this data (1-32) or ( 33-40 grayscale ) */
187 short clutID; /* clut id or if 0 clut follows or -1 if no clut */
188 };
189 )
190 typedef struct ImageDescription ImageDescription;
191 typedef ImageDescription * ImageDescriptionPtr;
192 typedef ImageDescriptionPtr * ImageDescriptionHandle;
193
194 /* values for PixMap.pixelFormat*/
195 enum {
196 k16LE555PixelFormat = FOUR_CHAR_CODE('L','5','5','5'), /* 16 bit LE rgb 555 (PC)*/
197 k16LE5551PixelFormat = FOUR_CHAR_CODE('5','5','5','1'), /* 16 bit LE rgb 5551*/
198 k16BE565PixelFormat = FOUR_CHAR_CODE('B','5','6','5'), /* 16 bit BE rgb 565*/
199 k16LE565PixelFormat = FOUR_CHAR_CODE('L','5','6','5'), /* 16 bit LE rgb 565*/
200 k24BGRPixelFormat = FOUR_CHAR_CODE('2','4','B','G'), /* 24 bit bgr */
201 k32BGRAPixelFormat = FOUR_CHAR_CODE('B','G','R','A'), /* 32 bit bgra (Matrox)*/
202 k32ABGRPixelFormat = FOUR_CHAR_CODE('A','B','G','R'), /* 32 bit abgr */
203 k32RGBAPixelFormat = FOUR_CHAR_CODE('R','G','B','A'), /* 32 bit rgba */
204 kYUVSPixelFormat = FOUR_CHAR_CODE('y','u','v','s'), /* YUV 4:2:2 byte ordering 16-unsigned = 'YUY2'*/
205 kYUVUPixelFormat = FOUR_CHAR_CODE('y','u','v','u'), /* YUV 4:2:2 byte ordering 16-signed*/
206 kYVU9PixelFormat = FOUR_CHAR_CODE('Y','V','U','9'), /* YVU9 Planar 9*/
207 kYUV411PixelFormat = FOUR_CHAR_CODE('Y','4','1','1'), /* YUV 4:1:1 Interleaved 16*/
208 kYVYU422PixelFormat = FOUR_CHAR_CODE('Y','V','Y','U'), /* YVYU 4:2:2 byte ordering 16*/
209 kUYVY422PixelFormat = FOUR_CHAR_CODE('U','Y','V','Y'), /* UYVY 4:2:2 byte ordering 16*/
210 kYUV211PixelFormat = FOUR_CHAR_CODE('Y','2','1','1'), /* YUV 2:1:1 Packed 8*/
211 k2vuyPixelFormat = FOUR_CHAR_CODE('2','v','u','y') /* UYVY 4:2:2 byte ordering 16*/
212 };
213
214 MP_PACKED(
215 struct, PixMapExtension {
216 int32_t extSize; /*size of struct, duh!*/
217 uint32_t pmBits; /*pixmap attributes bitfield*/
218 void * pmGD; /*this is a GDHandle*/
219 int32_t pmSeed;
220 Fixed gammaLevel; /*pixmap gammalevel*/
221 Fixed requestedGammaLevel;
222 uint32_t reserved2;
223 int32_t longRowBytes; /*used when rowBytes > 16382*/
224 uint32_t signature;
225 Handle baseAddrHandle;
226 };
227 )
228 typedef struct PixMapExtension PixMapExtension;
229
230 typedef PixMapExtension * PixMapExtPtr;
231 typedef PixMapExtPtr * PixMapExtHandle;
232
233
234 MP_PACKED(
235 struct, PixMap {
236 Ptr baseAddr; /*pointer to pixels*/
237 short rowBytes; /*offset to next line*/
238 Rect bounds; /*encloses bitmap*/
239 short pmVersion; /*pixMap version number*/
240 short packType; /*defines packing format*/
241 int32_t packSize; /*length of pixel data*/
242 Fixed hRes; /*horiz. resolution (ppi)*/
243 Fixed vRes; /*vert. resolution (ppi)*/
244 short pixelType; /*defines pixel type*/
245 short pixelSize; /*# bits in pixel*/
246 short cmpCount; /*# components in pixel*/
247 short cmpSize; /*# bits per component*/
248 OSType pixelFormat; /*fourCharCode representation*/
249 CTabHandle pmTable; /*color map for this pixMap*/
250 PixMapExtHandle pmExt; /*Handle to pixMap extension*/
251 };
252 )
253 typedef struct PixMap PixMap;
254 typedef PixMap * PixMapPtr;
255 typedef PixMapPtr * PixMapHandle;
256
257
258 MP_PACKED(
259 struct, BitMap {
260 Ptr baseAddr;
261 short rowBytes;
262 Rect bounds;
263 };
264 )
265 typedef struct BitMap BitMap;
266 typedef BitMap * BitMapPtr;
267 typedef BitMapPtr * BitMapHandle;
268 typedef struct OpaqueRgnHandle* RgnHandle;
269
270 struct Pattern {
271 UInt8 pat[8];
272 };
273 typedef struct Pattern Pattern;
274 typedef unsigned char Style;
275 typedef Style StyleField;
276 MP_PACKED(
277 struct, Point {
278 short v;
279 short h;
280 };
281 )
282 typedef struct Point Point;
283 MP_PACKED(
284 struct, GrafPort {
285 short device;
286 BitMap portBits;
287 Rect portRect;
288 RgnHandle visRgn;
289 RgnHandle clipRgn;
290 Pattern bkPat;
291 Pattern fillPat;
292 Point pnLoc;
293 Point pnSize;
294 short pnMode;
295 Pattern pnPat;
296 short pnVis;
297 short txFont;
298 StyleField txFace; /*StyleField occupies 16-bits, but only first 8-bits are used*/
299 UInt8 txFlags; /* QuickTime uses second 8 bits of StyleField for txFlags */
300 short txMode;
301 short txSize;
302 Fixed spExtra;
303 int32_t fgColor;
304 int32_t bkColor;
305 short colrBit;
306 short patStretch;
307 Handle picSave;
308 Handle rgnSave;
309 Handle polySave;
310 /*QDProcsPtr*/void* grafProcs;
311 };
312 )
313 typedef struct GrafPort GrafPort;
314 typedef GrafPort *GWorldPtr;
315 typedef GWorldPtr *GWorldHandle;
316 #define anyCodec ((CodecComponent)0)
317 enum {
318 /* transfer modes */
319 srcCopy = 0, /*the 16 transfer modes*/
320 srcOr = 1,
321 srcXor = 2,
322 srcBic = 3,
323 notSrcCopy = 4,
324 notSrcOr = 5,
325 notSrcXor = 6,
326 notSrcBic = 7,
327 patCopy = 8,
328 patOr = 9,
329 patXor = 10,
330 patBic = 11,
331 notPatCopy = 12,
332 notPatOr = 13,
333 notPatXor = 14,
334 notPatBic = 15, /* Special Text Transfer Mode */
335 grayishTextOr = 49,
336 hilitetransfermode = 50,
337 hilite = 50, /* Arithmetic transfer modes */
338 blend = 32,
339 addPin = 33,
340 addOver = 34,
341 subPin = 35,
342 addMax = 37,
343 adMax = 37,
344 subOver = 38,
345 adMin = 39,
346 ditherCopy = 64, /* Transparent mode constant */
347 transparent = 36
348 };
349
350 typedef uint32_t GWorldFlags;
351
352
353
354 // ============================== CODECS ===========================
355
356 typedef Component CompressorComponent;
357 typedef Component DecompressorComponent;
358 typedef Component CodecComponent;
359
360 enum {
361 codecLosslessQuality = 0x00000400,
362 codecMaxQuality = 0x000003FF,
363 codecMinQuality = 0x00000000,
364 codecLowQuality = 0x00000100,
365 codecNormalQuality = 0x00000200,
366 codecHighQuality = 0x00000300
367 };
368
369
370
371 // callbacks:
372 typedef void* ImageCodecDrawBandCompleteUPP;
373 typedef int64_t ICMProgressProcRecord;
374 typedef int64_t ICMCompletionProcRecord;
375 typedef ICMCompletionProcRecord* ICMCompletionProcRecordPtr;
376 typedef int64_t ICMDataProcRecord;
377 typedef void* ICMFrameTimePtr;
378 typedef void* CDSequenceDataSourcePtr;
379 typedef void* ICMFrameTimeInfoPtr;
380
381 // graphics port
382 typedef struct OpaqueGrafPtr* GrafPtr;
383 typedef GrafPtr CGrafPtr;
384
385
386 /* codec capabilities flags */
387 enum {
388 codecCanScale = 1L << 0, // 1
389 codecCanMask = 1L << 1, // 2
390 codecCanMatte = 1L << 2, // 4
391 codecCanTransform = 1L << 3, // 8
392 codecCanTransferMode = 1L << 4, // 10
393 codecCanCopyPrev = 1L << 5, // 20
394 codecCanSpool = 1L << 6, // 40
395 codecCanClipVertical = 1L << 7, // 80
396 codecCanClipRectangular = 1L << 8, // 100
397 codecCanRemapColor = 1L << 9, // 200
398 codecCanFastDither = 1L << 10, // 400
399 codecCanSrcExtract = 1L << 11, // 800
400 codecCanCopyPrevComp = 1L << 12, // 1000
401 codecCanAsync = 1L << 13, // 2000
402 codecCanMakeMask = 1L << 14, // 4000
403 codecCanShift = 1L << 15, // 8000
404 codecCanAsyncWhen = 1L << 16, // 10000
405 codecCanShieldCursor = 1L << 17, // 20000
406 codecCanManagePrevBuffer = 1L << 18, // 40000
407 codecHasVolatileBuffer = 1L << 19, // 80000 /* codec requires redraw after window movement */
408 codecWantsRegionMask = 1L << 20, // 100000
409 codecImageBufferIsOnScreen = 1L << 21, // 200000 /* old def of codec using overlay surface, = ( codecIsDirectToScreenOnly | codecUsesOverlaySurface | codecImageBufferIsOverlaySurface | codecSrcMustBeImageBuffer ) */
410 codecWantsDestinationPixels = 1L << 22, // 400000
411 codecWantsSpecialScaling = 1L << 23, // 800000
412 codecHandlesInputs = 1L << 24, // 1000000
413 codecCanDoIndirectSurface = 1L << 25, /* codec can handle indirect surface (GDI) */
414 codecIsSequenceSensitive = 1L << 26,
415 codecRequiresOffscreen = 1L << 27,
416 codecRequiresMaskBits = 1L << 28,
417 codecCanRemapResolution = 1L << 29,
418 codecIsDirectToScreenOnly = 1L << 30, /* codec can only decompress data to the screen */
419 codecCanLockSurface = 1L << 31 /* codec can lock destination surface, icm doesn't lock for you */
420 };
421
422 /* codec capabilities flags2 */
423 enum {
424 codecUsesOverlaySurface = 1L << 0, /* codec uses overlay surface */
425 codecImageBufferIsOverlaySurface = 1L << 1, /* codec image buffer is overlay surface, the bits in the buffer are on the screen */
426 codecSrcMustBeImageBuffer = 1L << 2, /* codec can only source data from an image buffer */
427 codecImageBufferIsInAGPMemory = 1L << 4, /* codec image buffer is in AGP space, byte writes are OK */
428 codecImageBufferIsInPCIMemory = 1L << 5 /* codec image buffer is across a PCI bus; byte writes are bad */
429 };
430
431 /* codec condition flags */
432 // FFD = 13 = 8+4+1
433 enum {
434 codecConditionFirstBand = 1L << 0, // 1
435 codecConditionLastBand = 1L << 1, // 2
436 codecConditionFirstFrame = 1L << 2, // 4
437 codecConditionNewDepth = 1L << 3, // 8
438 codecConditionNewTransform = 1L << 4, // 10
439 codecConditionNewSrcRect = 1L << 5, // 20
440 codecConditionNewMask = 1L << 6, // 40
441 codecConditionNewMatte = 1L << 7, // 80
442 codecConditionNewTransferMode = 1L << 8, // 100
443 codecConditionNewClut = 1L << 9, // 200
444 codecConditionNewAccuracy = 1L << 10, // 400
445 codecConditionNewDestination = 1L << 11, // 800
446 codecConditionFirstScreen = 1L << 12, // 1000
447 codecConditionDoCursor = 1L << 13, // 2000
448 codecConditionCatchUpDiff = 1L << 14, // 4000
449 codecConditionMaskMayBeChanged = 1L << 15, // 8000
450 codecConditionToBuffer = 1L << 16, // 10000
451 codecConditionCodecChangedMask = 1L << 31 // 20000
452 };
453
454
455
456 MP_PACKED(
457 struct, CodecCapabilities {
458 int32_t flags;
459 short wantedPixelSize;
460 short extendWidth;
461 short extendHeight;
462 short bandMin;
463 short bandInc;
464 short pad;
465 uint32_t time;
466 int32_t flags2; /* field new in QuickTime 4.0 */
467 };
468 )
469 typedef struct CodecCapabilities CodecCapabilities;
470
471 MP_PACKED(
472 struct, CodecDecompressParams {
473 ImageSequence sequenceID; /* predecompress,banddecompress */
474 ImageDescriptionHandle imageDescription; /* predecompress,banddecompress */
475 Ptr data;
476 int32_t bufferSize;
477
478 int32_t frameNumber;
479 int32_t startLine;
480 int32_t stopLine;
481 int32_t conditionFlags;
482
483 CodecFlags callerFlags; // short
484 CodecCapabilities * capabilities; /* predecompress,banddecompress */
485 ICMProgressProcRecord progressProcRecord;
486 ICMCompletionProcRecord completionProcRecord;
487
488 ICMDataProcRecord dataProcRecord;
489 CGrafPtr port; /* predecompress,banddecompress */
490 PixMap dstPixMap; /* predecompress,banddecompress */
491 BitMapPtr maskBits;
492 PixMapPtr mattePixMap;
493 Rect srcRect; /* predecompress,banddecompress */
494 MatrixRecord * matrix; /* predecompress,banddecompress */
495 CodecQ accuracy; /* predecompress,banddecompress */
496 short transferMode; /* predecompress,banddecompress */
497 ICMFrameTimePtr frameTime; /* banddecompress */
498 int32_t reserved[1];
499
500 /* The following fields only exist for QuickTime 2.0 and greater */
501 SInt8 matrixFlags; /* high bit set if 2x resize */
502 SInt8 matrixType;
503 Rect dstRect; /* only valid for simple transforms */
504
505 /* The following fields only exist for QuickTime 2.1 and greater */
506 UInt16 majorSourceChangeSeed;
507 UInt16 minorSourceChangeSeed;
508 CDSequenceDataSourcePtr sourceData;
509
510 RgnHandle maskRegion;
511
512 /* The following fields only exist for QuickTime 2.5 and greater */
513 OSType ** wantedDestinationPixelTypes; /* Handle to 0-terminated list of OSTypes */
514
515 int32_t screenFloodMethod;
516 int32_t screenFloodValue;
517 short preferredOffscreenPixelSize;
518
519 /* The following fields only exist for QuickTime 3.0 and greater */
520 ICMFrameTimeInfoPtr syncFrameTime; /* banddecompress */
521 Boolean needUpdateOnTimeChange; /* banddecompress */
522 Boolean enableBlackLining;
523 Boolean needUpdateOnSourceChange; /* band decompress */
524 Boolean pad;
525
526 int32_t unused;
527
528 CGrafPtr finalDestinationPort;
529
530 int32_t requestedBufferWidth; /* must set codecWantsSpecialScaling to indicate this field is valid*/
531 int32_t requestedBufferHeight; /* must set codecWantsSpecialScaling to indicate this field is valid*/
532
533 /* The following fields only exist for QuickTime 4.0 and greater */
534 Rect displayableAreaOfRequestedBuffer; /* set in predecompress*/
535 Boolean requestedSingleField;
536 Boolean needUpdateOnNextIdle;
537 Boolean pad2[2];
538 Fixed bufferGammaLevel;
539
540 /* The following fields only exist for QuickTime 5.0 and greater */
541 UInt32 taskWeight; /* preferred weight for MP tasks implementing this operation*/
542 OSType taskName; /* preferred name (type) for MP tasks implementing this operation*/
543 };
544 )
545 typedef struct CodecDecompressParams CodecDecompressParams;
546
547
548
549 MP_PACKED(
550 struct, ImageSubCodecDecompressCapabilities {
551 int32_t recordSize; /* sizeof(ImageSubCodecDecompressCapabilities)*/
552 int32_t decompressRecordSize; /* size of your codec's decompress record*/
553 Boolean canAsync; /* default true*/
554 UInt8 pad0;
555
556 /* The following fields only exist for QuickTime 4.0 and greater */
557 UInt16 suggestedQueueSize;
558 Boolean canProvideTrigger;
559
560 /* The following fields only exist for QuickTime 5.0 and greater */
561 Boolean subCodecFlushesScreen; /* only used on Mac OS X*/
562 Boolean subCodecCallsDrawBandComplete;
563 UInt8 pad2[1];
564
565 /* The following fields only exist for QuickTime 5.1 and greater */
566 Boolean isChildCodec; /* set by base codec before calling Initialize*/
567 UInt8 pad3[3];
568 };
569 )
570 typedef struct ImageSubCodecDecompressCapabilities ImageSubCodecDecompressCapabilities;
571
572
573 MP_PACKED(
574 struct, ImageSubCodecDecompressRecord {
575 Ptr baseAddr;
576 int32_t rowBytes;
577 Ptr codecData;
578 ICMProgressProcRecord progressProcRecord;
579 ICMDataProcRecord dataProcRecord;
580 void * userDecompressRecord; /* pointer to codec-specific per-band data*/
581 UInt8 frameType;
582 Boolean inhibitMP; /* set this in BeginBand to tell the base decompressor not to call DrawBand from an MP task for this frame. (Only has any effect for MP-capable subcodecs. New in QuickTime 5.0.)*/
583 UInt8 pad[2];
584 int32_t priv[2];
585
586 /* The following fields only exist for QuickTime 5.0 and greater */
587 ImageCodecDrawBandCompleteUPP drawBandCompleteUPP; /* only used if subcodec set subCodecCallsDrawBandComplete; if drawBandCompleteUPP is non-nil, codec must call it when a frame is finished, but may return from DrawBand before the frame is finished. */
588 void * drawBandCompleteRefCon; /* Note: do not call drawBandCompleteUPP directly from a hardware interrupt; instead, use DTInstall to run a function at deferred task time, and call drawBandCompleteUPP from that. */
589 };
590 )
591 typedef struct ImageSubCodecDecompressRecord ImageSubCodecDecompressRecord;
592
593
594 /* These are the bits that are set in the Component flags, and also in the codecInfo struct. */
595 enum {
596 codecInfoDoes1 = (1L << 0), /* codec can work with 1-bit pixels */
597 codecInfoDoes2 = (1L << 1), /* codec can work with 2-bit pixels */
598 codecInfoDoes4 = (1L << 2), /* codec can work with 4-bit pixels */
599 codecInfoDoes8 = (1L << 3), /* codec can work with 8-bit pixels */
600 codecInfoDoes16 = (1L << 4), /* codec can work with 16-bit pixels */
601 codecInfoDoes32 = (1L << 5), /* codec can work with 32-bit pixels */
602 codecInfoDoesDither = (1L << 6), /* codec can do ditherMode */
603 codecInfoDoesStretch = (1L << 7), /* codec can stretch to arbitrary sizes */
604 codecInfoDoesShrink = (1L << 8), /* codec can shrink to arbitrary sizes */
605 codecInfoDoesMask = (1L << 9), /* codec can mask to clipping regions */
606 codecInfoDoesTemporal = (1L << 10), /* codec can handle temporal redundancy */
607 codecInfoDoesDouble = (1L << 11), /* codec can stretch to double size exactly */
608 codecInfoDoesQuad = (1L << 12), /* codec can stretch to quadruple size exactly */
609 codecInfoDoesHalf = (1L << 13), /* codec can shrink to half size */
610 codecInfoDoesQuarter = (1L << 14), /* codec can shrink to quarter size */
611 codecInfoDoesRotate = (1L << 15), /* codec can rotate on decompress */
612 codecInfoDoesHorizFlip = (1L << 16), /* codec can flip horizontally on decompress */
613 codecInfoDoesVertFlip = (1L << 17), /* codec can flip vertically on decompress */
614 codecInfoHasEffectParameterList = (1L << 18), /* codec implements get effects parameter list call, once was codecInfoDoesSkew */
615 codecInfoDoesBlend = (1L << 19), /* codec can blend on decompress */
616 codecInfoDoesWarp = (1L << 20), /* codec can warp arbitrarily on decompress */
617 codecInfoDoesRecompress = (1L << 21), /* codec can recompress image without accumulating errors */
618 codecInfoDoesSpool = (1L << 22), /* codec can spool image data */
619 codecInfoDoesRateConstrain = (1L << 23) /* codec can data rate constrain */
620 };
621
622
623 enum {
624 codecInfoDepth1 = (1L << 0), /* compressed data at 1 bpp depth available */
625 codecInfoDepth2 = (1L << 1), /* compressed data at 2 bpp depth available */
626 codecInfoDepth4 = (1L << 2), /* compressed data at 4 bpp depth available */
627 codecInfoDepth8 = (1L << 3), /* compressed data at 8 bpp depth available */
628 codecInfoDepth16 = (1L << 4), /* compressed data at 16 bpp depth available */
629 codecInfoDepth32 = (1L << 5), /* compressed data at 32 bpp depth available */
630 codecInfoDepth24 = (1L << 6), /* compressed data at 24 bpp depth available */
631 codecInfoDepth33 = (1L << 7), /* compressed data at 1 bpp monochrome depth available */
632 codecInfoDepth34 = (1L << 8), /* compressed data at 2 bpp grayscale depth available */
633 codecInfoDepth36 = (1L << 9), /* compressed data at 4 bpp grayscale depth available */
634 codecInfoDepth40 = (1L << 10), /* compressed data at 8 bpp grayscale depth available */
635 codecInfoStoresClut = (1L << 11), /* compressed data can have custom cluts */
636 codecInfoDoesLossless = (1L << 12), /* compressed data can be stored in lossless format */
637 codecInfoSequenceSensitive = (1L << 13) /* compressed data is sensitive to out of sequence decoding */
638 };
639
640 MP_PACKED(
641 struct, CodecInfo {
642 Str31 typeName; /* name of the codec type i.e.: 'Apple Image Compression' */
643 short version; /* version of the codec data that this codec knows about */
644 short revisionLevel; /* revision level of this codec i.e: 0x00010001 (1.0.1) */
645 int32_t vendor; /* Maker of this codec i.e: 'appl' */
646 int32_t decompressFlags; /* codecInfo flags for decompression capabilities */
647 int32_t compressFlags; /* codecInfo flags for compression capabilities */
648 int32_t formatFlags; /* codecInfo flags for compression format details */
649 UInt8 compressionAccuracy; /* measure (1-255) of accuracy of this codec for compress (0 if unknown) */
650 UInt8 decompressionAccuracy; /* measure (1-255) of accuracy of this codec for decompress (0 if unknown) */
651 unsigned short compressionSpeed; /* ( millisecs for compressing 320x240 on base mac II) (0 if unknown) */
652 unsigned short decompressionSpeed; /* ( millisecs for decompressing 320x240 on mac II)(0 if unknown) */
653 UInt8 compressionLevel; /* measure (1-255) of compression level of this codec (0 if unknown) */
654 UInt8 resvd; /* pad */
655 short minimumHeight; /* minimum height of image (block size) */
656 short minimumWidth; /* minimum width of image (block size) */
657 short decompressPipelineLatency; /* in milliseconds ( for asynchronous codecs ) */
658 short compressPipelineLatency; /* in milliseconds ( for asynchronous codecs ) */
659 int32_t privateData;
660 };
661 )
662 typedef struct CodecInfo CodecInfo;
663
664 enum {
665 codecFlagUseImageBuffer = (1L << 0), /* decompress*/
666 codecFlagUseScreenBuffer = (1L << 1), /* decompress*/
667 codecFlagUpdatePrevious = (1L << 2), /* compress*/
668 codecFlagNoScreenUpdate = (1L << 3), /* decompress*/
669 codecFlagWasCompressed = (1L << 4), /* compress*/
670 codecFlagDontOffscreen = (1L << 5), /* decompress*/
671 codecFlagUpdatePreviousComp = (1L << 6), /* compress*/
672 codecFlagForceKeyFrame = (1L << 7), /* compress*/
673 codecFlagOnlyScreenUpdate = (1L << 8), /* decompress*/
674 codecFlagLiveGrab = (1L << 9), /* compress*/
675 codecFlagDiffFrame = (1L << 9), /* decompress*/
676 codecFlagDontUseNewImageBuffer = (1L << 10), /* decompress*/
677 codecFlagInterlaceUpdate = (1L << 11), /* decompress*/
678 codecFlagCatchUpDiff = (1L << 12), /* decompress*/
679 codecFlagSupportDisable = (1L << 13), /* decompress*/
680 codecFlagReenable = (1L << 14) /* decompress*/
681 };
682
dump_ImageDescription(void * xxx)683 static inline void dump_ImageDescription(void* xxx){
684 ImageDescription* id=(ImageDescription*)xxx;
685 unsigned char* x;
686 int i;
687
688 for(i=0;i<id->idSize;i++){
689 printf(" %02X",((unsigned char*)id)[i]);
690 if((i%16)==15) printf("\n");
691 }
692 printf("\n");
693
694
695 printf("=============== ImageDescription at %p ==================\n",xxx);
696 printf("idSize=0x%X fourcc=0x%08X\n",id->idSize,id->cType);
697 printf("ver=%d rev=%d vendor=0x%08X\n",id->version,id->revisionLevel,id->vendor);
698 printf("tempQ=%d spatQ=%d dim: %d x %d dpi: %.2f x %.2f depth: %d\n",
699 id->temporalQuality,id->spatialQuality,
700 id->width, id->height,
701 id->hRes / 65536.0, id->vRes / 65536.0,
702 id->depth);
703 printf("dataSize=%d frameCount=%d clutID=%d\n",id->dataSize, id->frameCount, id->clutID);
704 printf("name='%.*s'\n",((char*)(&id->name))[0],((char*)(&id->name))+1);
705 x=((char*)(&id->clutID))+2;
706 if(id->idSize>sizeof(ImageDescription)){
707 printf("%02X %02X %02X %02X | %02X %02X %02X %02X | %02X %02X %02X %02X | %02X %02X %02X %02X\n",
708 x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]);
709 }
710 printf("=========================================================\n");
711 }
712
dump_Rect(char * title,Rect * r)713 static inline void dump_Rect(char* title,Rect *r){
714 printf("%s: %d;%d - %d;%d\n",title,
715 (int)r->top,(int)r->left,(int)r->bottom,(int)r->right);
716 }
717
dump_MatrixRecord(char * title,MatrixRecord * m)718 static inline void dump_MatrixRecord(char* title, MatrixRecord *m){
719 printf("%s: [%d %d %d][%d %d %d][%d %d %d]\n",title,
720 m->matrix[0][0],m->matrix[0][1],m->matrix[0][2],
721 m->matrix[1][0],m->matrix[1][1],m->matrix[1][2],
722 m->matrix[2][0],m->matrix[2][1],m->matrix[2][2]);
723 }
724
dump_PixMap(void * xxx)725 static inline void dump_PixMap(void* xxx){
726 PixMap *p=xxx;
727 printf("=============== PixMap at %p ==================\n",xxx);
728 printf("base=%p stride=%d\n",p->baseAddr, p->rowBytes);
729 dump_Rect("bounds",&p->bounds);
730 printf("pmVersion=0x%X packType=0x%X\n packSize=0x%X\n",
731 p->pmVersion,p->packType, p->packSize);
732 printf("hRes=0x%X vRes=0x%X pixelType=0x%X pixelSize=0x%X\n",
733 p->hRes,p->vRes,p->pixelType,p->pixelSize);
734 printf("cmpCount=0x%X cmpSize=0x%X pixelFormat=0x%X\n",
735 p->cmpCount,p->cmpSize,p->pixelFormat);
736 printf("pmTable=%p pmExt=%p\n",p->pmTable,p->pmExt);
737 printf("=========================================================\n");
738 }
739
dump_CodecCapabilities(void * xxx)740 static inline void dump_CodecCapabilities(void* xxx){
741 CodecCapabilities* cc=xxx;
742 if(!xxx) return;
743 printf("=============== CodecCapabilities at %p =================\n",xxx);
744 printf("flags=0x%X flags2=0x%X\n",cc->flags,cc->flags2);
745 printf("wantedPixelSize=%d extendWidth=%d extendHeight=%d band=%d+%d\n",
746 cc->wantedPixelSize,cc->extendWidth,cc->extendHeight,
747 cc->bandMin,cc->bandInc);
748 printf("pad=0x%X time=0x%X\n",cc->pad,cc->time);
749 printf("=========================================================\n");
750 }
751
dump_CodecDecompressParams(void * xxx)752 static inline void dump_CodecDecompressParams(void* xxx){
753 CodecDecompressParams* cd=xxx;
754 ImageDescription **idh;
755 int i;
756 if(!xxx) return;
757 printf("=============== CodecDecompressParams at %p ==================\n",xxx);
758 printf("sequenceID=%d\n",cd->sequenceID);
759 idh=cd->imageDescription;
760 if(idh && idh[0]) dump_ImageDescription(idh[0]);
761
762 for(i=0;i<sizeof(CodecDecompressParams);i++){
763 printf(" %02X",((unsigned char*)cd)[i]);
764 if((i%16)==15) printf("\n");
765 }
766 printf("\n");
767
768 printf("data=%p size=%d\n",cd->data,cd->bufferSize);
769 printf("frameno=%d lines: %d .. %d condflags=0x%X callerflags=0x%X\n",
770 cd->frameNumber, cd->startLine, cd->stopLine, cd->conditionFlags,cd->callerFlags);
771 // printf("maskBits=%p mattePixMap=%p\n",
772 // cd->maskBits,cd->mattePixMap);
773 dump_PixMap(&cd->dstPixMap);
774 // if(cd->mattePixMap) dump_PixMap(cd->mattePixMap);
775 if(cd->matrix) dump_MatrixRecord("matrix",cd->matrix);
776 if(cd->capabilities) dump_CodecCapabilities(cd->capabilities);
777 printf("accuracy=%d transferMode=%d matrixFlags=0x%X matrixType=%d\n",
778 (int)cd->accuracy, (int)cd->transferMode, (int)cd->matrixFlags, (int)cd->matrixType);
779 printf("srcrect: %d;%d - %d;%d\n",cd->srcRect.top,cd->srcRect.left,cd->srcRect.bottom,cd->srcRect.right);
780 printf("dstrect: %d;%d - %d;%d\n",cd->dstRect.top,cd->dstRect.left,cd->dstRect.bottom,cd->dstRect.right);
781 printf("wantedDestinationPixelTypes=%p\n",cd->wantedDestinationPixelTypes);
782 if(cd->wantedDestinationPixelTypes){
783 unsigned int* p=cd->wantedDestinationPixelTypes;
784 while(p[0]){
785 printf(" 0x%08X %p\n",p[0],&p[0]);
786 ++p;
787 }
788 }
789 printf("screenFloodMethod=%d value=%d preferredOffscreenPixelSize=%d\n",
790 cd->screenFloodMethod, cd->screenFloodValue, cd->preferredOffscreenPixelSize);
791 printf("callbacks: progress=%"PRId64" compl=%"PRId64" data=%"PRId64" ftime=%p srcdata=%p sync=%p\n",
792 cd->progressProcRecord, cd->completionProcRecord,
793 cd->dataProcRecord, cd->frameTime, cd->sourceData, cd->syncFrameTime);
794 // printf("\n");
795
796 printf("=========================================================\n");
797
798
799 }
800
801 #endif /* MPLAYER_COMPONENTS_H */
802