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
70 #undef GetCurrentProcess
93 #undef IsWindowVisible
106 #undef STDMETHODCALLTYPE
114 #include "wine/debug.h"
115 #include "qtprivate.h"
117 WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder
);
120 UInt8 a
; /* Alpha Channel */
121 UInt8 r
; /* red component */
122 UInt8 g
; /* green component */
123 UInt8 b
; /* blue component */
124 } ARGBPixelRecord
, *ARGBPixelPtr
, **ARGBPixelHdl
;
126 HRESULT
AccessPixelBufferPixels( CVPixelBufferRef pixelBuffer
, LPBYTE pbDstStream
)
128 LPBYTE pPixels
= NULL
;
129 size_t bytesPerRow
= 0, height
= 0, width
= 0;
133 actualType
= CVPixelBufferGetPixelFormatType(pixelBuffer
);
134 if (k32ARGBPixelFormat
!= actualType
)
136 ERR("Pixel Buffer is not desired Type\n");
139 CVPixelBufferLockBaseAddress(pixelBuffer
,0);
140 pPixels
= (LPBYTE
)CVPixelBufferGetBaseAddress(pixelBuffer
);
141 bytesPerRow
= CVPixelBufferGetBytesPerRow(pixelBuffer
);
142 height
= CVPixelBufferGetHeight(pixelBuffer
);
143 width
= CVPixelBufferGetWidth(pixelBuffer
);
145 for (i
= 1; i
<= height
; i
++)
148 LPBYTE out
= pbDstStream
+ ((height
- i
) * width
* 3);
150 for (j
= 0; j
< width
; j
++)
152 *((DWORD
*)out
) = (((ARGBPixelPtr
)pPixels
)[j
].r
) << 16
153 | (((ARGBPixelPtr
)pPixels
)[j
].g
) << 8
154 | (((ARGBPixelPtr
)pPixels
)[j
].b
);
157 pPixels
+= bytesPerRow
;
159 CVPixelBufferUnlockBaseAddress(pixelBuffer
,0);