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