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