kernel32: Update version to Win 10.
[wine.git] / dlls / wineqtdecoder / qtutils.c
blob4c88656dc18dbab69c13c795c8b063d25e48b1db
1 /*
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
21 #include "config.h"
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>
65 #undef LoadResource
66 #undef CompareString
67 #undef GetCurrentThread
68 #undef _CDECL
69 #undef GetCurrentProcess
70 #undef AnimatePalette
71 #undef EqualRgn
72 #undef FillRgn
73 #undef FrameRgn
74 #undef GetPixel
75 #undef InvertRgn
76 #undef LineTo
77 #undef OffsetRgn
78 #undef PaintRgn
79 #undef Polygon
80 #undef ResizePalette
81 #undef SetRectRgn
82 #undef CheckMenuItem
83 #undef DeleteMenu
84 #undef DrawMenuBar
85 #undef EnableMenuItem
86 #undef EqualRect
87 #undef FillRect
88 #undef FrameRect
89 #undef GetCursor
90 #undef GetMenu
91 #undef InvertRect
92 #undef IsWindowVisible
93 #undef MoveWindow
94 #undef OffsetRect
95 #undef PtInRect
96 #undef SetCursor
97 #undef SetRect
98 #undef ShowCursor
99 #undef ShowWindow
100 #undef UnionRect
102 #undef ULONG
103 #undef HRESULT
104 #undef STDMETHODCALLTYPE
106 #include "windef.h"
107 #include "winbase.h"
108 #include "wtypes.h"
109 #include "winuser.h"
110 #include "dshow.h"
112 #include "wine/debug.h"
113 #include "qtprivate.h"
115 WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
117 typedef struct {
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;
128 OSType actualType;
129 int i;
131 actualType = CVPixelBufferGetPixelFormatType(pixelBuffer);
132 if (k32ARGBPixelFormat != actualType)
134 ERR("Pixel Buffer is not desired Type\n");
135 return E_FAIL;
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++)
145 int j;
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);
153 out+=3;
155 pPixels += bytesPerRow;
157 CVPixelBufferUnlockBaseAddress(pixelBuffer,0);
158 return S_OK;