2 * QuickTime Toolkit decoder utils
4 * Copyright 2011 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define ULONG CoreFoundation_ULONG
24 #define HRESULT CoreFoundation_HRESULT
26 #define LoadResource __carbon_LoadResource
27 #define CompareString __carbon_CompareString
28 #define GetCurrentThread __carbon_GetCurrentThread
29 #define GetCurrentProcess __carbon_GetCurrentProcess
30 #define AnimatePalette __carbon_AnimatePalette
31 #define EqualRgn __carbon_EqualRgn
32 #define FillRgn __carbon_FillRgn
33 #define FrameRgn __carbon_FrameRgn
34 #define GetPixel __carbon_GetPixel
35 #define InvertRgn __carbon_InvertRgn
36 #define LineTo __carbon_LineTo
37 #define OffsetRgn __carbon_OffsetRgn
38 #define PaintRgn __carbon_PaintRgn
39 #define Polygon __carbon_Polygon
40 #define ResizePalette __carbon_ResizePalette
41 #define SetRectRgn __carbon_SetRectRgn
43 #define CheckMenuItem __carbon_CheckMenuItem
44 #define DeleteMenu __carbon_DeleteMenu
45 #define DrawMenuBar __carbon_DrawMenuBar
46 #define EnableMenuItem __carbon_EnableMenuItem
47 #define EqualRect __carbon_EqualRect
48 #define FillRect __carbon_FillRect
49 #define FrameRect __carbon_FrameRect
50 #define GetCursor __carbon_GetCursor
51 #define GetMenu __carbon_GetMenu
52 #define InvertRect __carbon_InvertRect
53 #define IsWindowVisible __carbon_IsWindowVisible
54 #define MoveWindow __carbon_MoveWindow
55 #define OffsetRect __carbon_OffsetRect
56 #define PtInRect __carbon_PtInRect
57 #define SetCursor __carbon_SetCursor
58 #define SetRect __carbon_SetRect
59 #define ShowCursor __carbon_ShowCursor
60 #define ShowWindow __carbon_ShowWindow
61 #define UnionRect __carbon_UnionRect
63 #include <CoreVideo/CVPixelBuffer.h>
67 #undef GetCurrentThread
69 #undef GetCurrentProcess
92 #undef IsWindowVisible
104 #undef STDMETHODCALLTYPE
112 #include "wine/debug.h"
113 #include "qtprivate.h"
115 WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder
);
118 UInt8 a
; /* Alpha Channel */
119 UInt8 r
; /* red component */
120 UInt8 g
; /* green component */
121 UInt8 b
; /* blue component */
122 } ARGBPixelRecord
, *ARGBPixelPtr
, **ARGBPixelHdl
;
124 HRESULT
AccessPixelBufferPixels( CVPixelBufferRef pixelBuffer
, LPBYTE pbDstStream
)
126 LPBYTE pPixels
= NULL
;
127 size_t bytesPerRow
= 0, height
= 0, width
= 0;
131 actualType
= CVPixelBufferGetPixelFormatType(pixelBuffer
);
132 if (k32ARGBPixelFormat
!= actualType
)
134 ERR("Pixel Buffer is not desired Type\n");
137 CVPixelBufferLockBaseAddress(pixelBuffer
,0);
138 pPixels
= (LPBYTE
)CVPixelBufferGetBaseAddress(pixelBuffer
);
139 bytesPerRow
= CVPixelBufferGetBytesPerRow(pixelBuffer
);
140 height
= CVPixelBufferGetHeight(pixelBuffer
);
141 width
= CVPixelBufferGetWidth(pixelBuffer
);
143 for (i
= 1; i
<= height
; i
++)
146 LPBYTE out
= pbDstStream
+ ((height
- i
) * width
* 3);
148 for (j
= 0; j
< width
; j
++)
150 *((DWORD
*)out
) = (((ARGBPixelPtr
)pPixels
)[j
].r
) << 16
151 | (((ARGBPixelPtr
)pPixels
)[j
].g
) << 8
152 | (((ARGBPixelPtr
)pPixels
)[j
].b
);
155 pPixels
+= bytesPerRow
;
157 CVPixelBufferUnlockBaseAddress(pixelBuffer
,0);